Resources
File["/etc/httpd/conf.d/nagios.conf"]
owner => "root"
group => "root"
mode => "0644"
content => $apache_httpd_conf_content
notify => Service["httpd"]
require => Package["nagios"]
File["/etc/nagios/cgi.cfg"]
owner => "root"
group => "root"
mode => "0644"
content => template("nagios/cgi.cfg.erb")
require => Package["nagios"]
File["/etc/nagios/nagios.cfg"]
owner => "root"
group => "root"
mode => "0644"
content => template("nagios/nagios.cfg.erb")
notify => Service["nagios"]
require => Package["nagios"]
File["/etc/nagios/nagios_command.cfg", "/etc/nagios/nagios_contact.cfg", "/etc/nagios/nagios_contactgroup.cfg", "/etc/nagios/nagios_host.cfg", "/etc/nagios/nagios_hostdependency.cfg", "/etc/nagios/nagios_hostgroup.cfg", "/etc/nagios/nagios_service.cfg", "/etc/nagios/nagios_timeperiod.cfg"]
owner => "root"
group => "nagios"
mode => "0640"
Work around a puppet bug where created files
are 600 root:root
File["/etc/nagios/private/resource.cfg"]
owner => "root"
group => "nagios"
mode => "0640"
content => template("nagios/resource.cfg.erb")
notify => Service["nagios"]
require => Package["nagios"]
Nagios_command["check-host-alive"]
command_line => "$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5"
Nagios_command["check_dhcp"]
command_line => "$USER1$/check_dhcp $ARG1$"
Nagios_command["check_dns"]
command_line => "$USER1$/check_dns -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_dns_addr"]
command_line => "$USER1$/check_dns -H $ARG1$ $ARG2$"
Nagios_command["check_ftp"]
command_line => "$USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_hpjd"]
command_line => "$USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_http"]
command_line => "$USER1$/check_http -I $HOSTADDRESS$ $ARG1$"
Nagios_command["check_http_url"]
command_line => "$USER1$/check_http -H $ARG1$ -p $ARG2$ $ARG3$"
Nagios_command["check_imap"]
command_line => "$USER1$/check_imap -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_nginx"]
command_line => "$USER1$/check_nginx $ARG1$"
Nagios_command["check_nrpe_couchbase"]
command_line => $nrpe -c check_couchbase
Nagios_command["check_nrpe_cpu"]
command_line => $nrpe -c check_cpu
Nagios_command["check_nrpe_disk"]
command_line => $nrpe -c check_disk
Nagios_command["check_nrpe_load"]
command_line => $nrpe -c check_load
Nagios_command["check_nrpe_megaraid_sas"]
command_line => $nrpe -c check_megaraid_sas
Custom NRPE-based commands using custom plugins, conditionally enabled
Nagios_command["check_nrpe_membase"]
command_line => $nrpe -c check_membase
Nagios_command["check_nrpe_moxi"]
command_line => $nrpe -c check_moxi
Nagios_command["check_nrpe_mptsas"]
command_line => $nrpe -c check_mptsas
Nagios_command["check_nrpe_ntp_time"]
command_line => $nrpe -c check_ntp_time
Nagios_command["check_nrpe_proc"]
command_line => $nrpe -c check_proc
Nagios_command["check_nrpe_ram"]
command_line => $nrpe -c check_ram
Custom NRPE-based commands using custom plugins
Nagios_command["check_nrpe_swap"]
command_line => $nrpe -c check_swap
Nagios_command["check_nrpe_total_procs"]
command_line => $nrpe -c check_total_procs
Nagios_command["check_nrpe_users"]
command_line => $nrpe -c check_users
Custom NRPE-based commands
Nagios_command["check_nrpe_zombie_procs"]
command_line => $nrpe -c check_zombie_procs
Nagios_command["check_nt"]
command_line => "$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$"
Nagios_command["check_ping"]
command_line => "$USER1$/check_ping -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_ping_addr"]
command_line => "$USER1$/check_ping -H $ARG1$ -w $ARG2$ -c $ARG3$ -p 5"
Nagios_command["check_pop"]
command_line => "$USER1$/check_pop -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_proxy"]
command_line => "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$"
Nagios_command["check_smtp"]
command_line => "$USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_snmp"]
command_line => "$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$"
Nagios_command["check_ssh"]
command_line => "$USER1$/check_ssh $ARG1$ $HOSTADDRESS$"
Nagios_command["check_tcp"]
command_line => "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$"
Nagios_command["check_udp"]
command_line => "$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$"
Nagios_command["notify-host-by-email"]
command_line => $notify_host_by_email_command_line
Nagios commands Taken from commands.cfg
Nagios_command["notify-service-by-email"]
command_line => $notify_service_by_email_command_line
Nagios_contact["nagiosadmin"]
use => "generic-contact"
alias => "Nagios Admin"
email => $admin_email
Nagios contacts and contactgroups Taken from contacts.cfg
Nagios_contactgroup["admins"]
alias => "Nagios Administrators"
members => $admins_members
Nagios_hostgroup["nagios"]
alias => "Nagios Servers"
Nagios hostgroup, we need at least one for puppet to create the file
Nagios_timeperiod["24x7"]
alias => "24 Hours A Day, 7 Days A Week"
monday => "00:00-24:00"
tuesday => "00:00-24:00"
wednesday => "00:00-24:00"
thursday => "00:00-24:00"
friday => "00:00-24:00"
saturday => "00:00-24:00"
sunday => "00:00-24:00"
Nagios timeperiods Taken from timeperiods.cfg
Nagios_timeperiod["none"]
alias => "No Time Is A Good Time"
Nagios_timeperiod["workhours"]
alias => "Normal Work Hours"
monday => $timeperiod_workhours
tuesday => $timeperiod_workhours
wednesday => $timeperiod_workhours
thursday => $timeperiod_workhours
friday => $timeperiod_workhours
Package["mailx"]
ensure => installed
Package["nagios", "nagios-plugins-dhcp", "nagios-plugins-dns", "nagios-plugins-http", "nagios-plugins-icmp", "nagios-plugins-ldap", "nagios-plugins-nrpe", "nagios-plugins-ping", "nagios-plugins-smtp", "nagios-plugins-snmp", "nagios-plugins-ssh", "nagios-plugins-tcp", "nagios-plugins-udp"]
ensure => installed
Plugin packages required on the server side
Resources["nagios_command", "nagios_contact", "nagios_contactgroup", "nagios_host", "nagios_hostdependency", "nagios_hostgroup", "nagios_service", "nagios_timeperiod"]
purge => true
Works great, but only if the "target" is the default (known
limitation)
Service["nagios"]
enable => true
ensure => running
hasstatus => false
pattern => "/usr/sbin/nagios"
restart => "/bin/chgrp nagios /etc/nagios/nagios_*.cfg && /bin/chmod 640 /etc/nagios/nagios_*.cfg && /sbin/service nagios reload"
require => Package["nagios"]