diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/default.pp | 14 | ||||
-rw-r--r-- | manifests/defaults.pp | 13 | ||||
-rw-r--r-- | manifests/defaults/commands.pp | 47 | ||||
-rw-r--r-- | manifests/defaults/contactgroups.pp | 9 | ||||
-rw-r--r-- | manifests/defaults/contacts.pp | 15 | ||||
-rw-r--r-- | manifests/defaults/host_templates.pp | 21 | ||||
-rw-r--r-- | manifests/defaults/hostgroups.pp | 13 | ||||
-rw-r--r-- | manifests/defaults/service_templates.pp | 29 | ||||
-rw-r--r-- | manifests/defaults/timeperiods.pp | 33 |
9 files changed, 180 insertions, 14 deletions
diff --git a/manifests/default.pp b/manifests/default.pp deleted file mode 100644 index 1ce5862..0000000 --- a/manifests/default.pp +++ /dev/null @@ -1,14 +0,0 @@ -define nagios::default { - - file { "nagios_default_${name}" : - path => "${nagios::nagios_cfg_dir}/defaults/${name}.cfg", - source => [ "puppet://$server/files/nagios/configs/${fqdn}/defaults/${name}.cfg", - "puppet://$server/files/nagios/configs/${operatingsystem}/defaults/${name}.cfg", - "puppet://$server/files/nagios/configs/defaults/${name}.cfg", - "puppet://$server/nagios/configs/${operatingsystem}/defaults/${name}.cfg", - "puppet://$server/nagios/configs/defaults/${name}.cfg" ], - notify => Service['nagios'], - mode => 0644, owner => root, group => root; - } - -} diff --git a/manifests/defaults.pp b/manifests/defaults.pp new file mode 100644 index 0000000..93c10f7 --- /dev/null +++ b/manifests/defaults.pp @@ -0,0 +1,13 @@ +class nagios::defaults { + + # include some default nagios objects + + include nagios::defaults::commands + include nagios::defaults::contactgroups + include nagios::defaults::contacts + include nagios::defaults::hostgroups + include nagios::defaults::host_templates + include nagios::defaults::service_templates + include nagios::defaults::timeperiods + +} diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp new file mode 100644 index 0000000..7130b26 --- /dev/null +++ b/manifests/defaults/commands.pp @@ -0,0 +1,47 @@ +class nagios::defaults::commands { + + # common service commands + + nagios_command { + ssh_port: + command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$'; + # from apache2.pp + http_port: + command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$'; + # from bind.pp + check_dig2: + command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$'; + check_ntp_time: + command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1'; + check_http_url: + command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$'; + check_http_url_regex: + command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$'; + check_https_url: + command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$'; + check_https_url_regex: + command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$'; + check_https: + command_line => '$USER1$/check_http -S -H $HOSTADDRESS$'; + check_silc: + command_line => '$USER1$/check_tcp -p 706 -H $ARG1$'; + check_sobby: + command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$'; + check_jabber: + command_line => '$USER1$/check_jabber -H $ARG1$'; + check_jabber_login: + command_line => '$USER1$/check_jabber_login $ARG1$ $ARG2$', + require => Nagios::Plugin['check_jabber_login']; + } + + # notification commands + + nagios_command { + 'notify-host-by-email': + command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$'; + 'notify-service-by-email': + command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$' + + } + +} diff --git a/manifests/defaults/contactgroups.pp b/manifests/defaults/contactgroups.pp new file mode 100644 index 0000000..f5affc6 --- /dev/null +++ b/manifests/defaults/contactgroups.pp @@ -0,0 +1,9 @@ +class nagios::defaults::contactgroups { + + nagios_contactgroup { + 'admins': + alias => 'Nagios Administrators', + members => 'root', + } + +} diff --git a/manifests/defaults/contacts.pp b/manifests/defaults/contacts.pp new file mode 100644 index 0000000..0252b5a --- /dev/null +++ b/manifests/defaults/contacts.pp @@ -0,0 +1,15 @@ +class nagios::defaults::contacts { + + nagios_contact { + 'root': + alias => 'Root', + service_notification_period => '24x7', + host_notification_period => '24x7', + service_notification_options => 'w,u,c,r', + host_notification_options => 'd,r', + service_notification_commands => 'notify-service-by-email', + host_notification_commands => 'notify-host-by-email', + email => 'root@localhost', + } + +} diff --git a/manifests/defaults/host_templates.pp b/manifests/defaults/host_templates.pp new file mode 100644 index 0000000..30d7544 --- /dev/null +++ b/manifests/defaults/host_templates.pp @@ -0,0 +1,21 @@ +class nagios::defaults::host_templates { + + nagios_host { + 'generic-host': + notifications_enabled => '1', + event_handler_enabled => '1', + flap_detection_enabled => '1', + failure_prediction_enabled => '1', + process_perf_data => '1', + retain_status_information => '1', + retain_nonstatus_information => '1', + check_command => 'check-host-alive', + max_check_attempts => '10', + notification_interval => '0', + notification_period => '24x7', + notification_options => 'd,u,r', + contact_groups => 'admins', + register => '0', + } + +} diff --git a/manifests/defaults/hostgroups.pp b/manifests/defaults/hostgroups.pp new file mode 100644 index 0000000..3a4f4d1 --- /dev/null +++ b/manifests/defaults/hostgroups.pp @@ -0,0 +1,13 @@ +class nagios::defaults::hostgroups { + + nagios_hostgroup { + 'all': + alias => 'All Servers', + members => '*'; + 'debian-servers': + alias => 'Debian GNU/Linux Servers'; + 'centos-servers': + alias => 'CentOS GNU/Linux Servers'; + } + +} diff --git a/manifests/defaults/service_templates.pp b/manifests/defaults/service_templates.pp new file mode 100644 index 0000000..12247a0 --- /dev/null +++ b/manifests/defaults/service_templates.pp @@ -0,0 +1,29 @@ +class nagios::defaults::service_templates { + + nagios_service { + 'generic-service': + active_checks_enabled => '1', + passive_checks_enabled => '1', + parallelize_check => '1', + obsess_over_service => '1', + check_freshness => '0', + notifications_enabled => '1', + event_handler_enabled => '1', + flap_detection_enabled => '1', + failure_prediction_enabled => '1', + process_perf_data => '1', + retain_status_information => '1', + retain_nonstatus_information => '1', + notification_interval => '0', + is_volatile => '0', + check_period => '24x7', + normal_check_interval => '5', + retry_check_interval => '1', + max_check_attempts => '4', + notification_period => '24x7', + notification_options => 'w,u,c,r', + contact_groups => 'admins', + register => '0', + } + +} diff --git a/manifests/defaults/timeperiods.pp b/manifests/defaults/timeperiods.pp new file mode 100644 index 0000000..0d05118 --- /dev/null +++ b/manifests/defaults/timeperiods.pp @@ -0,0 +1,33 @@ +class nagios::defaults::timeperiods { + + nagios_timeperiod { + '24x7': + alias => '24 Hours A Day, 7 Days A Week', + sunday => '00:00-24:00', + 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'; + 'workhours': + alias => 'Standard Work Hours', + monday => '09:00-17:00', + tuesday => '09:00-17:00', + wednesday => '09:00-17:00', + thursday => '09:00-17:00', + friday => '09:00-17:00'; + 'nonworkhours': + alias => 'Non-Work Hours', + sunday => '00:00-24:00', + monday => '00:00-09:00,17:00-24:00', + tuesday => '00:00-09:00,17:00-24:00', + wednesday => '00:00-09:00,17:00-24:00', + thursday => '00:00-09:00,17:00-24:00', + friday => '00:00-09:00,17:00-24:00', + saturday => '00:00-24:00'; + 'never': + alias => 'Never'; + } + +} |