diff options
author | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2009-12-02 17:19:20 -0500 |
---|---|---|
committer | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2009-12-02 17:19:20 -0500 |
commit | 97e13bd2809d1e431fcac063abeb757f235f2394 (patch) | |
tree | 225f906abe213aa3037b4b20bfa8f527aaf60416 /manifests/defaults | |
parent | 0bcac1357115fe9b03ec884632d46c93efb317d9 (diff) |
replace defaults based on cfg files by puppet resources
Diffstat (limited to 'manifests/defaults')
-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 |
7 files changed, 167 insertions, 0 deletions
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'; + } + +} |