From 1e7b51004868a762f577831e686d1b851e2b08c2 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 1 Dec 2009 13:33:36 -0500 Subject: Add support for Debian; split up package defaults and create new nagios::default resource; add support for lighttpd and headless httpd configurations; move common commands definitions into nagios::commands --- files/configs/CentOS/defaults/commands.cfg | 253 +++++++++++++++++++++ files/configs/CentOS/defaults/contactgroups.cfg | 16 ++ files/configs/CentOS/defaults/contacts.cfg | 23 ++ files/configs/CentOS/defaults/host_templates.cfg | 40 ++++ files/configs/CentOS/defaults/hostgroups.cfg | 16 ++ files/configs/CentOS/defaults/localhost.cfg | 59 +++++ .../configs/CentOS/defaults/service_templates.cfg | 45 ++++ files/configs/CentOS/defaults/timeperiods.cfg | 55 +++++ files/configs/CentOS/nagios.cfg | 8 +- 9 files changed, 509 insertions(+), 6 deletions(-) create mode 100644 files/configs/CentOS/defaults/commands.cfg create mode 100644 files/configs/CentOS/defaults/contactgroups.cfg create mode 100644 files/configs/CentOS/defaults/contacts.cfg create mode 100644 files/configs/CentOS/defaults/host_templates.cfg create mode 100644 files/configs/CentOS/defaults/hostgroups.cfg create mode 100644 files/configs/CentOS/defaults/localhost.cfg create mode 100644 files/configs/CentOS/defaults/service_templates.cfg create mode 100644 files/configs/CentOS/defaults/timeperiods.cfg (limited to 'files/configs/CentOS') diff --git a/files/configs/CentOS/defaults/commands.cfg b/files/configs/CentOS/defaults/commands.cfg new file mode 100644 index 0000000..fbf8670 --- /dev/null +++ b/files/configs/CentOS/defaults/commands.cfg @@ -0,0 +1,253 @@ +################################################################################ +# 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 +# name +# command_name +# command_line +# } +# +# WHERE: +# +# = object name of another command definition that should be +# used as a template for this definition (optional) +# = object name of command definition, referenced by other +# command definitions that use it as a template (optional) +# = name of the command, as recognized/used by Nagios +# = 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 new file mode 100644 index 0000000..bab2857 --- /dev/null +++ b/files/configs/CentOS/defaults/contactgroups.cfg @@ -0,0 +1,16 @@ +############################################################################### +############################################################################### +# +# 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 new file mode 100644 index 0000000..310fd93 --- /dev/null +++ b/files/configs/CentOS/defaults/contacts.cfg @@ -0,0 +1,23 @@ +############################################################################### +############################################################################### +# +# 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 new file mode 100644 index 0000000..7606cb6 --- /dev/null +++ b/files/configs/CentOS/defaults/host_templates.cfg @@ -0,0 +1,40 @@ +############################################################################### +############################################################################### +# +# 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 new file mode 100644 index 0000000..728111c --- /dev/null +++ b/files/configs/CentOS/defaults/hostgroups.cfg @@ -0,0 +1,16 @@ +############################################################################### +############################################################################### +# +# 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 new file mode 100644 index 0000000..27dbb4b --- /dev/null +++ b/files/configs/CentOS/defaults/localhost.cfg @@ -0,0 +1,59 @@ +# 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 new file mode 100644 index 0000000..70eae7a --- /dev/null +++ b/files/configs/CentOS/defaults/service_templates.cfg @@ -0,0 +1,45 @@ +############################################################################### +############################################################################### +# +# 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 new file mode 100644 index 0000000..351d2f2 --- /dev/null +++ b/files/configs/CentOS/defaults/timeperiods.cfg @@ -0,0 +1,55 @@ +############################################################################### +############################################################################### +# +# 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/CentOS/nagios.cfg b/files/configs/CentOS/nagios.cfg index c3194c8..f72a344 100644 --- a/files/configs/CentOS/nagios.cfg +++ b/files/configs/CentOS/nagios.cfg @@ -44,12 +44,8 @@ cfg_file=/etc/nagios/nagios_serviceescalation.cfg cfg_file=/etc/nagios/nagios_serviceextinfo.cfg cfg_file=/etc/nagios/nagios_timeperdiod.cfg -# Command definitions -cfg_file=/etc/nagios/commands.cfg - -# Host and service definitions for monitoring this machine -cfg_file=/etc/nagios/localhost.cfg - +# Defaults for CentOS +cfg_dir=/etc/nagios/defaults # You can split other types of object definitions across several # config files if you wish (as done here), or keep them all in a -- cgit v1.2.3