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