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 | |
parent | 0bcac1357115fe9b03ec884632d46c93efb317d9 (diff) |
replace defaults based on cfg files by puppet resources
26 files changed, 180 insertions, 815 deletions
diff --git a/files/configs/CentOS/defaults/commands.cfg b/files/configs/CentOS/defaults/commands.cfg deleted file mode 100644 index fbf8670..0000000 --- a/files/configs/CentOS/defaults/commands.cfg +++ /dev/null @@ -1,253 +0,0 @@ -################################################################################ -# Sample command definitions for Nagios 2.10 -# -# Read the documentation for more information on this configuration file. I've -# provided some comments here, but things may not be so clear without further -# explanation, so make sure to read the HTML documentation! -# -# Last Modified: 11-21-2006 -# -################################################################################ - - -################################################################################ -# COMMAND DEFINITIONS -# -# SYNTAX: -# -# define command{ -# template <templatename> -# name <objectname> -# command_name <commandname> -# command_line <commandline> -# } -# -# WHERE: -# -# <templatename> = object name of another command definition that should be -# used as a template for this definition (optional) -# <objectname> = object name of command definition, referenced by other -# command definitions that use it as a template (optional) -# <commandname> = name of the command, as recognized/used by Nagios -# <commandline> = command line -# -################################################################################ - - - - -################################################################################ -# -# SAMPLE SERVICE CHECK COMMANDS -# -# These are some example service check commands. They may or may not work on -# your system, as they must be modified for your plugins. See the HTML -# documentation on the plugins for examples of how to configure command definitions. -# -################################################################################ - - -################################################################################ -# NOTE: The following 'check_local_...' functions are designed to monitor -# various metrics on the host that Nagios is running on (i.e. this one). -################################################################################ - -# 'check_local_disk' command definition -define command{ - command_name check_local_disk - command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ - } - - -# 'check_local_load' command definition -define command{ - command_name check_local_load - command_line $USER1$/check_load -w $ARG1$ -c $ARG2$ - } - - -# 'check_local_procs' command definition -define command{ - command_name check_local_procs - command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ - } - - -# 'check_local_users' command definition -define command{ - command_name check_local_users - command_line $USER1$/check_users -w $ARG1$ -c $ARG2$ - } - - - -################################################################################ -# NOTE: The following 'check_...' commands are used to monitor services on -# both local and remote hosts. -################################################################################ - -# 'check_dns' command definition -define command{ - command_name check_dns - command_line $USER1$/check_dns -H www.yahoo.com -s $HOSTADDRESS$ - } - - -# 'check_ftp' command definition -define command{ - command_name check_ftp - command_line $USER1$/check_ftp -H $HOSTADDRESS$ - } - - -# 'check_hpjd' command definition -define command{ - command_name check_hpjd - command_line $USER1$/check_hpjd -H $HOSTADDRESS$ -C public - } - - -# 'check_http' command definition -define command{ - command_name check_http - command_line $USER1$/check_http -H $HOSTADDRESS$ - } - - -# 'check_nntp' command definition -define command{ - command_name check_nntp - command_line $USER1$/check_nntp -H $HOSTADDRESS$ - } - - -# 'check_ping' command definition -define command{ - command_name check_ping - command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5 - } - - -# 'check_pop' command definition -define command{ - command_name check_pop - command_line $USER1$/check_pop -H $HOSTADDRESS$ - } - - -# 'check_smtp' command definition -define command{ - command_name check_smtp - command_line $USER1$/check_smtp -H $HOSTADDRESS$ - } - - -# 'check_tcp' command definition -define command{ - command_name check_tcp - command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ - } - - -# 'check_telnet' command definition -define command{ - command_name check_telnet - command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 23 - } - - -# 'check_udp' command definition -define command{ - command_name check_udp - command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ - } - - - - -################################################################################ -# -# SAMPLE HOST CHECK COMMANDS -# -################################################################################ - - -# This command checks to see if a host is "alive" by pinging it -# The check must result in a 100% packet loss or 5 second (5000ms) round trip -# average time to produce a critical error. -# Note: Only one ICMP echo packet is sent (determined by the '-p 1' argument) - -# 'check-host-alive' command definition -define command{ - command_name check-host-alive - command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1 - } - - - - -################################################################################ -# -# SAMPLE NOTIFICATION COMMANDS -# -# These are some example notification commands. They may or may not work on -# your system without modification. As an example, some systems will require -# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below. -# -################################################################################ - - -# 'host-notify-by-email' command definition -define command{ - command_name host-notify-by-email - command_line /usr/bin/printf "%b" "***** Nagios 2.10 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$ - } - - -# 'host-notify-by-epager' command definition -define command{ - command_name host-notify-by-epager - command_line /usr/bin/printf "%b" "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$ - } - -# 'notify-by-email' command definition -define command{ - command_name notify-by-email - command_line /usr/bin/printf "%b" "***** Nagios 2.10 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ - } - - -# 'notify-by-epager' command definition -define command{ - command_name notify-by-epager - command_line /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$ - } - - - - - -################################################################################ -# -# SAMPLE PERFORMANCE DATA COMMANDS -# -# These are sample performance data commands that can be used to send performance -# data output to two text files (one for hosts, another for services). If you -# plan on simply writing performance data out to a file, consider using the -# host_perfdata_file and service_perfdata_file options in the main config file. -# -################################################################################ - - -# 'process-host-perfdata' command definition -define command{ - command_name process-host-perfdata - command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/log/nagios/host-perfdata.out - } - - -# 'process-service-perfdata' command definition -define command{ - command_name process-service-perfdata - command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/log/nagios/service-perfdata.out - } diff --git a/files/configs/CentOS/defaults/contactgroups.cfg b/files/configs/CentOS/defaults/contactgroups.cfg deleted file mode 100644 index bab2857..0000000 --- a/files/configs/CentOS/defaults/contactgroups.cfg +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -############################################################################### -# -# CONTACT GROUPS -# -############################################################################### -############################################################################### - -# We only have one contact in this simple configuration file, so there is -# no need to create more than one contact group. - -define contactgroup{ - contactgroup_name admins - alias Nagios Administrators - members nagios-admin - } diff --git a/files/configs/CentOS/defaults/contacts.cfg b/files/configs/CentOS/defaults/contacts.cfg deleted file mode 100644 index 310fd93..0000000 --- a/files/configs/CentOS/defaults/contacts.cfg +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -############################################################################### -# -# CONTACTS -# -############################################################################### -############################################################################### - -# In this simple config file, a single contact will receive all alerts. -# This assumes that you have an account (or email alias) called -# "nagios-admin" on the local host. - -define contact{ - contact_name nagios-admin - alias Nagios Admin - service_notification_period 24x7 - host_notification_period 24x7 - service_notification_options w,u,c,r - host_notification_options d,r - service_notification_commands notify-by-email - host_notification_commands host-notify-by-email - email nagios-admin - } diff --git a/files/configs/CentOS/defaults/host_templates.cfg b/files/configs/CentOS/defaults/host_templates.cfg deleted file mode 100644 index 7606cb6..0000000 --- a/files/configs/CentOS/defaults/host_templates.cfg +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################### -############################################################################### -# -# HOSTS -# -############################################################################### -############################################################################### - -# Generic host definition template - This is NOT a real host, just a template! - -define host{ - name generic-host ; The name of this host template - notifications_enabled 1 ; Host notifications are enabled - event_handler_enabled 1 ; Host event handler is enabled - flap_detection_enabled 1 ; Flap detection is enabled - failure_prediction_enabled 1 ; Failure prediction is enabled - process_perf_data 1 ; Process performance data - retain_status_information 1 ; Retain status information across program restarts - retain_nonstatus_information 1 ; Retain non-status information across program restarts - notification_period 24x7 ; Send host notifications at any time - register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! - } - - -# Linux host definition template - This is NOT a real host, just a template! - -define host{ - name linux-server ; The name of this host template - use generic-host ; This template inherits other values from the generic-host template - check_period 24x7 ; By default, Linux hosts are checked round the clock - max_check_attempts 10 ; Check each Linux host 10 times (max) - check_command check-host-alive ; Default command to check Linux hosts - notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day - ; Note that the notification_period variable is being overridden from - ; the value that is inherited from the generic-host template! - notification_interval 120 ; Resend notification every 2 hours - notification_options d,u,r ; Only send notifications for specific host states - contact_groups admins ; Notifications get sent to the admins by default - register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! - } diff --git a/files/configs/CentOS/defaults/hostgroups.cfg b/files/configs/CentOS/defaults/hostgroups.cfg deleted file mode 100644 index 728111c..0000000 --- a/files/configs/CentOS/defaults/hostgroups.cfg +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -############################################################################### -# -# HOST GROUPS -# -############################################################################### -############################################################################### - -# We only have one host in our simple config file, so there is no need to -# create more than one hostgroup. - -define hostgroup{ - hostgroup_name test - alias Test Servers - members localhost - } diff --git a/files/configs/CentOS/defaults/localhost.cfg b/files/configs/CentOS/defaults/localhost.cfg deleted file mode 100644 index 27dbb4b..0000000 --- a/files/configs/CentOS/defaults/localhost.cfg +++ /dev/null @@ -1,59 +0,0 @@ -# A simple configuration file for monitoring the local host -# This can serve as an example for configuring other servers; -# Custom services specific to this host are added here, but services -# defined in nagios2-common_services.cfg may also apply. -# - -define host{ - use generic-host ; Name of host template to use - host_name localhost - alias localhost - address 127.0.0.1 - } - -# Define a service to check the disk space of the root partition -# on the local machine. Warning if < 20% free, critical if -# < 10% free space on partition. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Disk Space - check_command check_all_disks!20%!10% - } - - - -# Define a service to check the number of currently logged in -# users on the local machine. Warning if > 20 users, critical -# if > 50 users. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Current Users - check_command check_users!20!50 - } - - -# Define a service to check the number of currently running procs -# on the local machine. Warning if > 250 processes, critical if -# > 400 processes. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Total Processes - check_command check_procs!250!400 - } - - - -# Define a service to check the load on the local machine. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Current Load - check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 - } diff --git a/files/configs/CentOS/defaults/service_templates.cfg b/files/configs/CentOS/defaults/service_templates.cfg deleted file mode 100644 index 70eae7a..0000000 --- a/files/configs/CentOS/defaults/service_templates.cfg +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################### -############################################################################### -# -# SERVICES -# -############################################################################### -############################################################################### - -# Generic service definition template - This is NOT a real service, just a template! - -define service{ - name generic-service ; The 'name' of this service template - active_checks_enabled 1 ; Active service checks are enabled - passive_checks_enabled 1 ; Passive service checks are enabled/accepted - parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems) - obsess_over_service 1 ; We should obsess over this service (if necessary) - check_freshness 0 ; Default is to NOT check service 'freshness' - notifications_enabled 1 ; Service notifications are enabled - event_handler_enabled 1 ; Service event handler is enabled - flap_detection_enabled 1 ; Flap detection is enabled - failure_prediction_enabled 1 ; Failure prediction is enabled - process_perf_data 1 ; Process performance data - retain_status_information 1 ; Retain status information across program restarts - retain_nonstatus_information 1 ; Retain non-status information across program restarts - is_volatile 0 ; The service is not volatile - register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! - } - - -# Local service definition template - This is NOT a real service, just a template! - -define service{ - name local-service ; The name of this service template - use generic-service ; Inherit default values from the generic-service definition - check_period 24x7 ; The service can be checked at any time of the day - max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state - normal_check_interval 5 ; Check the service every 5 minutes under normal conditions - retry_check_interval 1 ; Re-check the service every minute until a hard state can be determined - contact_groups admins ; Notifications get sent out to everyone in the 'admins' group - notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events - notification_interval 60 ; Re-notify about service problems every hour - notification_period 24x7 ; Notifications can be sent out at any time - register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! - } - diff --git a/files/configs/CentOS/defaults/timeperiods.cfg b/files/configs/CentOS/defaults/timeperiods.cfg deleted file mode 100644 index 351d2f2..0000000 --- a/files/configs/CentOS/defaults/timeperiods.cfg +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################### -############################################################################### -# -# TIME PERIODS -# -############################################################################### -############################################################################### - -# This defines a timeperiod where all times are valid for checks, -# notifications, etc. The classic "24x7" support nightmare. :-) - -define timeperiod{ - timeperiod_name 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' timeperiod definition -define timeperiod{ - timeperiod_name workhours - alias "Normal" Working 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' timeperiod definition -define timeperiod{ - timeperiod_name 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 - } - - -# 'none' timeperiod definition -define timeperiod{ - timeperiod_name none - alias No Time Is A Good Time - } diff --git a/files/configs/Debian/defaults/commands.cfg b/files/configs/Debian/defaults/commands.cfg deleted file mode 100644 index 4698058..0000000 --- a/files/configs/Debian/defaults/commands.cfg +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################### -# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS -############################################################################### - - -################################################################################ -# NOTIFICATION COMMANDS -################################################################################ - - -# 'notify-host-by-email' command definition -define command{ - command_name 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 definition -define command{ - command_name 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$ - } - - - - - -################################################################################ -# HOST CHECK COMMANDS -################################################################################ - -# On Debian, check-host-alive is being defined from within the -# nagios-plugins-basic package - -################################################################################ -# PERFORMANCE DATA COMMANDS -################################################################################ - - -# 'process-host-perfdata' command definition -define command{ - command_name process-host-perfdata - command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-perfdata.out - } - - -# 'process-service-perfdata' command definition -define command{ - command_name process-service-perfdata - command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out - } - - diff --git a/files/configs/Debian/defaults/contactgroups.cfg b/files/configs/Debian/defaults/contactgroups.cfg deleted file mode 100644 index 6327c06..0000000 --- a/files/configs/Debian/defaults/contactgroups.cfg +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -############################################################################### -# -# CONTACT GROUPS -# -############################################################################### -############################################################################### - -# We only have one contact in this simple configuration file, so there is -# no need to create more than one contact group. - -define contactgroup{ - contactgroup_name admins - alias Nagios Administrators - members root - } diff --git a/files/configs/Debian/defaults/contacts.cfg b/files/configs/Debian/defaults/contacts.cfg deleted file mode 100644 index d062143..0000000 --- a/files/configs/Debian/defaults/contacts.cfg +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -############################################################################### -# -# CONTACTS -# -############################################################################### -############################################################################### - -# In this simple config file, a single contact will receive all alerts. - -define contact{ - contact_name 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/files/configs/Debian/defaults/extinfo.cfg b/files/configs/Debian/defaults/extinfo.cfg deleted file mode 100644 index 07bd594..0000000 --- a/files/configs/Debian/defaults/extinfo.cfg +++ /dev/null @@ -1,13 +0,0 @@ -## -## Extended Host and Service Information -## - -define hostextinfo{ - hostgroup_name debian-servers - notes Debian GNU/Linux servers -# notes_url http://webserver.localhost.localdomain/hostinfo.pl?host=netware1 - icon_image base/debian.png - icon_image_alt Debian GNU/Linux - vrml_image debian.png - statusmap_image base/debian.gd2 - } diff --git a/files/configs/Debian/defaults/host_templates.cfg b/files/configs/Debian/defaults/host_templates.cfg deleted file mode 100644 index e6d96ac..0000000 --- a/files/configs/Debian/defaults/host_templates.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Generic host definition template - This is NOT a real host, just a template! - -define host{ - name generic-host ; The name of this host template - notifications_enabled 1 ; Host notifications are enabled - event_handler_enabled 1 ; Host event handler is enabled - flap_detection_enabled 1 ; Flap detection is enabled - failure_prediction_enabled 1 ; Failure prediction is enabled - process_perf_data 1 ; Process performance data - retain_status_information 1 ; Retain status information across program restarts - retain_nonstatus_information 1 ; Retain non-status information across program restarts - 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 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! - } diff --git a/files/configs/Debian/defaults/hostgroups.cfg b/files/configs/Debian/defaults/hostgroups.cfg deleted file mode 100644 index e711755..0000000 --- a/files/configs/Debian/defaults/hostgroups.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# Some generic hostgroup definitions - -# A simple wildcard hostgroup -define hostgroup { - hostgroup_name all - alias All Servers - members * - } - -# A list of your Debian GNU/Linux servers -define hostgroup { - hostgroup_name debian-servers - alias Debian GNU/Linux Servers - members localhost - } - -# A list of your web servers -define hostgroup { - hostgroup_name http-servers - alias HTTP servers - members localhost - } - -# A list of your ssh-accessible servers -define hostgroup { - hostgroup_name ssh-servers - alias SSH servers - members localhost - } - -# nagios doesn't like monitoring hosts without services, so this is -# a group for devices that have no other "services" monitorable -# (like routers w/out snmp for example) -define hostgroup { - hostgroup_name ping-servers - alias Pingable servers - members gateway - } diff --git a/files/configs/Debian/defaults/localhost.cfg b/files/configs/Debian/defaults/localhost.cfg deleted file mode 100644 index 27dbb4b..0000000 --- a/files/configs/Debian/defaults/localhost.cfg +++ /dev/null @@ -1,59 +0,0 @@ -# A simple configuration file for monitoring the local host -# This can serve as an example for configuring other servers; -# Custom services specific to this host are added here, but services -# defined in nagios2-common_services.cfg may also apply. -# - -define host{ - use generic-host ; Name of host template to use - host_name localhost - alias localhost - address 127.0.0.1 - } - -# Define a service to check the disk space of the root partition -# on the local machine. Warning if < 20% free, critical if -# < 10% free space on partition. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Disk Space - check_command check_all_disks!20%!10% - } - - - -# Define a service to check the number of currently logged in -# users on the local machine. Warning if > 20 users, critical -# if > 50 users. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Current Users - check_command check_users!20!50 - } - - -# Define a service to check the number of currently running procs -# on the local machine. Warning if > 250 processes, critical if -# > 400 processes. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Total Processes - check_command check_procs!250!400 - } - - - -# Define a service to check the load on the local machine. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Current Load - check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 - } diff --git a/files/configs/Debian/defaults/service_templates.cfg b/files/configs/Debian/defaults/service_templates.cfg deleted file mode 100644 index 4d60c79..0000000 --- a/files/configs/Debian/defaults/service_templates.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# generic service template definition -define service{ - name generic-service ; The 'name' of this service template - active_checks_enabled 1 ; Active service checks are enabled - passive_checks_enabled 1 ; Passive service checks are enabled/accepted - parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems) - obsess_over_service 1 ; We should obsess over this service (if necessary) - check_freshness 0 ; Default is to NOT check service 'freshness' - notifications_enabled 1 ; Service notifications are enabled - event_handler_enabled 1 ; Service event handler is enabled - flap_detection_enabled 1 ; Flap detection is enabled - failure_prediction_enabled 1 ; Failure prediction is enabled - process_perf_data 1 ; Process performance data - retain_status_information 1 ; Retain status information across program restarts - retain_nonstatus_information 1 ; Retain non-status information across program restarts - notification_interval 0 ; Only send notifications on status change by default. - 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 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! - } diff --git a/files/configs/Debian/defaults/timeperiods.cfg b/files/configs/Debian/defaults/timeperiods.cfg deleted file mode 100644 index 55ecf9d..0000000 --- a/files/configs/Debian/defaults/timeperiods.cfg +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################### -# timeperiods.cfg -############################################################################### - -# This defines a timeperiod where all times are valid for checks, -# notifications, etc. The classic "24x7" support nightmare. :-) - -define timeperiod{ - timeperiod_name 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 - } - -# Here is a slightly friendlier period during work hours -define timeperiod{ - timeperiod_name 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 - } - -# The complement of workhours -define timeperiod{ - timeperiod_name 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 - } - -# This one is a favorite: never :) -define timeperiod{ - timeperiod_name never - alias Never - } - -# end of file 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'; + } + +} |