Report abuse

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
class nagios::client inherits nagios {
        realize(
                File["/opt/nagios/etc/nrpe.cfg"],
                File["/opt/nagios/sbin/nrpe"],
                File["/etc/xinetd.d/nrpe"],
        )
        @@nagios_host { "$fqdn":
                use => "generic-host" ,
                host_name => "$fqdn" ,
                alias => "$fqdn" ,
                address => "$ipaddress_eth0" ,
                contact_groups => "$nagios_contact_groups" ,
                target => "/opt/nagios/etc/$nagios_hostgroup/hosts.cfg" ,
                tag => "nagios_host"  ,
        }
}

define nagios::service ( $use = "generic-service" , $host_name = $fqdn , $service_description , $notification_enabled = 1 , $event_handler = false  , $check_command ) {

        @@nagios_service { "$service_description":
                service_description => $service_description ,
                notifications_enabled => $notification_enabled ,
                event_handler => $even_handler ,
                use => "$use" ,
                check_command => "$check_command" ,
                target => "/opt/nagios/etc/$nagios_hostgroup/$fqdn" ,
                tag => "nagios_service"  ,
        }
}

~