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
|
define nagios::service (
$ensure = present,
$host_name = $fqdn,
$check_command,
$check_period = '',
$normal_check_interval = '',
$retry_check_interval = '',
$max_check_attempts = '',
$notification_interval = '',
$notification_period = '',
$notification_options = '',
$contact_groups = '',
$use = 'generic-service',
$service_description = 'absent' )
{
# TODO: this resource should normally accept all nagios_host parameters
$real_name = "${hostname}_${name}"
@@nagios_service { "${real_name}":
ensure => $ensure,
check_command => $check_command,
host_name => $host_name,
use => $use,
notify => Service[nagios],
service_description => $service_description ?{
'absent' => $name,
default => $service_description
}
}
if ($check_period != '') {
Nagios_service["${real_name}"] { check_period => $check_period }
}
if ($normal_check_interval != '') {
Nagios_service["${real_name}"] { normal_check_interval => $normal_check_interval }
}
if ($retry_check_interval != '') {
Nagios_service["${real_name}"] { retry_check_interval => $retry_check_interval }
}
if ($max_check_attempts != '') {
Nagios_service["${real_name}"] { max_check_attempts => $max_check_attempts }
}
if ($notification_interval != '') {
Nagios_service["${real_name}"] { notification_interval => $notification_interval }
}
if ($notification_period != '') {
Nagios_service["${real_name}"] { notification_period => $notification_period }
}
if ($notification_options != '') {
Nagios_service["${real_name}"] { notification_options => $notification_options }
}
if ($contact_groups != '') {
Nagios_service["${real_name}"] { contact_groups => $contact_groups }
}
}
|