diff options
Diffstat (limited to 'modules/profile/manifests/monitoring/services.pp')
-rw-r--r-- | modules/profile/manifests/monitoring/services.pp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/modules/profile/manifests/monitoring/services.pp b/modules/profile/manifests/monitoring/services.pp new file mode 100644 index 0000000..39c2def --- /dev/null +++ b/modules/profile/manifests/monitoring/services.pp | |||
@@ -0,0 +1,89 @@ | |||
1 | class profile::monitoring::services { | ||
2 | $real_hostname = lookup("base_installation::real_hostname") | ||
3 | |||
4 | Nagios_service { | ||
5 | ensure => "present", | ||
6 | owner => "naemon", | ||
7 | group => "naemon", | ||
8 | target => "/etc/naemon/objects.cfg", | ||
9 | notify => Service["naemon"], | ||
10 | before => Service["naemon"], | ||
11 | } | ||
12 | |||
13 | $service_generic = { | ||
14 | active_checks_enabled => "1", | ||
15 | check_freshness => "0", | ||
16 | check_interval => "10", | ||
17 | check_period => "24x7", | ||
18 | contact_groups => "admins", | ||
19 | event_handler_enabled => "1", | ||
20 | flap_detection_enabled => "1", | ||
21 | is_volatile => "0", | ||
22 | max_check_attempts => "3", | ||
23 | notification_interval => "60", | ||
24 | notification_options => "w,u,c,r", | ||
25 | notification_period => "24x7", | ||
26 | notifications_enabled => "1", | ||
27 | obsess_over_service => "1", | ||
28 | passive_checks_enabled => "1", | ||
29 | process_perf_data => "1", | ||
30 | retain_nonstatus_information => "1", | ||
31 | retain_status_information => "1", | ||
32 | retry_interval => "2", | ||
33 | } | ||
34 | |||
35 | |||
36 | $service_local = merge($service_generic, { | ||
37 | host_name => $real_hostname, | ||
38 | check_interval => "5", | ||
39 | max_check_attempts => "4", | ||
40 | retry_interval => "1", | ||
41 | }) | ||
42 | |||
43 | sudo::conf { | ||
44 | default: | ||
45 | sudo_file_name => "naemon"; | ||
46 | 'naemon-fail2ban': | ||
47 | content => "naemon ALL=(root) NOPASSWD: /usr/bin/fail2ban-client ping"; | ||
48 | } | ||
49 | |||
50 | nagios_service { | ||
51 | default: * => $service_local; | ||
52 | "Size on root partition": | ||
53 | service_description => "Size on root partition", | ||
54 | check_command => "check_local_disk!20%!10%!/"; | ||
55 | "Total number of process": | ||
56 | service_description => "Total number of process", | ||
57 | check_command => "check_local_procs!250!400!RSZDT"; | ||
58 | "Average load": | ||
59 | service_description => "Average load", | ||
60 | check_command => "check_local_load!8.0,8.0,8.0!10.0,10.0,10.0"; | ||
61 | "Swap usage": | ||
62 | service_description => "Swap usage", | ||
63 | check_command => "check_local_swap!20!10"; | ||
64 | "fail2ban is active": | ||
65 | service_description => "fail2ban is active", | ||
66 | check_command => "check_command_output!fail2ban-client ping!pong!-r root", | ||
67 | require => Sudo::Conf["naemon-fail2ban"]; | ||
68 | "NTP is activated and working": | ||
69 | service_description => "NTP is activated and working", | ||
70 | check_command => "check_ntp"; | ||
71 | } | ||
72 | |||
73 | if empty(find_file("/proc/mdstat")) { | ||
74 | nagios_service { | ||
75 | default: * => $service_local; | ||
76 | "No mdadm array is degraded": | ||
77 | ensure => "absent", | ||
78 | service_description => "No mdadm array is degraded", | ||
79 | check_command => "check_md_raid"; | ||
80 | } | ||
81 | } else { | ||
82 | nagios_service { | ||
83 | default: * => $service_local; | ||
84 | "No mdadm array is degraded": | ||
85 | service_description => "No mdadm array is degraded", | ||
86 | check_command => "check_md_raid"; | ||
87 | } | ||
88 | } | ||
89 | } | ||