diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-07-08 15:35:43 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-07-09 20:16:21 +0200 |
commit | 6962463657db999c33f1aabe60e0567be218918d (patch) | |
tree | 8d1d7c924fe68c56a4478165e50e5dc1bbc758aa /modules/profile/manifests/monitoring/services.pp | |
parent | d8f933bd00a5cc416da00cd26c9d13f7a1c02486 (diff) | |
download | Puppet-6962463657db999c33f1aabe60e0567be218918d.tar.gz Puppet-6962463657db999c33f1aabe60e0567be218918d.tar.zst Puppet-6962463657db999c33f1aabe60e0567be218918d.zip |
Prepare master monitoring
Diffstat (limited to 'modules/profile/manifests/monitoring/services.pp')
-rw-r--r-- | modules/profile/manifests/monitoring/services.pp | 102 |
1 files changed, 33 insertions, 69 deletions
diff --git a/modules/profile/manifests/monitoring/services.pp b/modules/profile/manifests/monitoring/services.pp index 39c2def..6e59ab1 100644 --- a/modules/profile/manifests/monitoring/services.pp +++ b/modules/profile/manifests/monitoring/services.pp | |||
@@ -1,45 +1,14 @@ | |||
1 | class profile::monitoring::services { | 1 | class profile::monitoring::services { |
2 | $real_hostname = lookup("base_installation::real_hostname") | ||
3 | 2 | ||
4 | Nagios_service { | 3 | Nagios_service { |
5 | ensure => "present", | 4 | ensure => "present", |
6 | owner => "naemon", | 5 | owner => "naemon", |
7 | group => "naemon", | 6 | group => "naemon", |
8 | target => "/etc/naemon/objects.cfg", | 7 | notify => Service["naemon"], |
9 | notify => Service["naemon"], | 8 | before => Service["naemon"], |
10 | before => Service["naemon"], | 9 | require => File["/etc/naemon"], |
11 | } | 10 | } |
12 | 11 | ||
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 { | 12 | sudo::conf { |
44 | default: | 13 | default: |
45 | sudo_file_name => "naemon"; | 14 | sudo_file_name => "naemon"; |
@@ -47,43 +16,38 @@ class profile::monitoring::services { | |||
47 | content => "naemon ALL=(root) NOPASSWD: /usr/bin/fail2ban-client ping"; | 16 | content => "naemon ALL=(root) NOPASSWD: /usr/bin/fail2ban-client ping"; |
48 | } | 17 | } |
49 | 18 | ||
50 | nagios_service { | 19 | profile::monitoring::local_service { |
51 | default: * => $service_local; | ||
52 | "Size on root partition": | 20 | "Size on root partition": |
53 | service_description => "Size on root partition", | 21 | local => { |
54 | check_command => "check_local_disk!20%!10%!/"; | 22 | check_command => "check_local_disk!20%!10%!/", |
23 | }; | ||
55 | "Total number of process": | 24 | "Total number of process": |
56 | service_description => "Total number of process", | 25 | local => { |
57 | check_command => "check_local_procs!250!400!RSZDT"; | 26 | check_command => "check_local_procs!50!100!RSZDT", |
27 | }; | ||
58 | "Average load": | 28 | "Average load": |
59 | service_description => "Average load", | 29 | local => { |
60 | check_command => "check_local_load!8.0,8.0,8.0!10.0,10.0,10.0"; | 30 | check_command => "check_local_load!8.0,8.0,8.0!10.0,10.0,10.0", |
31 | }; | ||
61 | "Swap usage": | 32 | "Swap usage": |
62 | service_description => "Swap usage", | 33 | local => { |
63 | check_command => "check_local_swap!20!10"; | 34 | check_command => "check_local_swap!20!10", |
35 | }; | ||
64 | "fail2ban is active": | 36 | "fail2ban is active": |
65 | service_description => "fail2ban is active", | 37 | local => { |
66 | check_command => "check_command_output!fail2ban-client ping!pong!-r root", | 38 | check_command => "check_command_output!fail2ban-client ping!pong!-r root", |
67 | require => Sudo::Conf["naemon-fail2ban"]; | 39 | require => Sudo::Conf["naemon-fail2ban"], |
40 | }; | ||
68 | "NTP is activated and working": | 41 | "NTP is activated and working": |
69 | service_description => "NTP is activated and working", | 42 | local => { |
70 | check_command => "check_ntp"; | 43 | check_command => "check_ntp", |
71 | } | 44 | }; |
72 | 45 | "No mdadm array is degraded": | |
73 | if empty(find_file("/proc/mdstat")) { | 46 | common => { |
74 | nagios_service { | 47 | ensure => (find_file("/proc/mdstat") == undef) ? { true => "absent", default =>"present" }, |
75 | default: * => $service_local; | 48 | }, |
76 | "No mdadm array is degraded": | 49 | local => { |
77 | ensure => "absent", | 50 | check_command => "check_md_raid", |
78 | service_description => "No mdadm array is degraded", | 51 | }; |
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 | } | 52 | } |
89 | } | 53 | } |