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/Debian/defaults/commands.cfg | 52 +++++++++++++++++++ files/configs/Debian/defaults/contactgroups.cfg | 16 ++++++ files/configs/Debian/defaults/contacts.cfg | 21 ++++++++ files/configs/Debian/defaults/extinfo.cfg | 13 +++++ files/configs/Debian/defaults/host_templates.cfg | 19 +++++++ files/configs/Debian/defaults/hostgroups.cfg | 38 ++++++++++++++ files/configs/Debian/defaults/localhost.cfg | 59 ++++++++++++++++++++++ .../configs/Debian/defaults/service_templates.cfg | 26 ++++++++++ files/configs/Debian/defaults/timeperiods.cfg | 50 ++++++++++++++++++ 9 files changed, 294 insertions(+) create mode 100644 files/configs/Debian/defaults/commands.cfg create mode 100644 files/configs/Debian/defaults/contactgroups.cfg create mode 100644 files/configs/Debian/defaults/contacts.cfg create mode 100644 files/configs/Debian/defaults/extinfo.cfg create mode 100644 files/configs/Debian/defaults/host_templates.cfg create mode 100644 files/configs/Debian/defaults/hostgroups.cfg create mode 100644 files/configs/Debian/defaults/localhost.cfg create mode 100644 files/configs/Debian/defaults/service_templates.cfg create mode 100644 files/configs/Debian/defaults/timeperiods.cfg (limited to 'files/configs/Debian/defaults') diff --git a/files/configs/Debian/defaults/commands.cfg b/files/configs/Debian/defaults/commands.cfg new file mode 100644 index 0000000..4698058 --- /dev/null +++ b/files/configs/Debian/defaults/commands.cfg @@ -0,0 +1,52 @@ +############################################################################### +# 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 new file mode 100644 index 0000000..6327c06 --- /dev/null +++ b/files/configs/Debian/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 root + } diff --git a/files/configs/Debian/defaults/contacts.cfg b/files/configs/Debian/defaults/contacts.cfg new file mode 100644 index 0000000..d062143 --- /dev/null +++ b/files/configs/Debian/defaults/contacts.cfg @@ -0,0 +1,21 @@ +############################################################################### +############################################################################### +# +# 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 new file mode 100644 index 0000000..07bd594 --- /dev/null +++ b/files/configs/Debian/defaults/extinfo.cfg @@ -0,0 +1,13 @@ +## +## 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 new file mode 100644 index 0000000..e6d96ac --- /dev/null +++ b/files/configs/Debian/defaults/host_templates.cfg @@ -0,0 +1,19 @@ +# 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 new file mode 100644 index 0000000..e711755 --- /dev/null +++ b/files/configs/Debian/defaults/hostgroups.cfg @@ -0,0 +1,38 @@ +# 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 new file mode 100644 index 0000000..27dbb4b --- /dev/null +++ b/files/configs/Debian/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/Debian/defaults/service_templates.cfg b/files/configs/Debian/defaults/service_templates.cfg new file mode 100644 index 0000000..4d60c79 --- /dev/null +++ b/files/configs/Debian/defaults/service_templates.cfg @@ -0,0 +1,26 @@ +# 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 new file mode 100644 index 0000000..55ecf9d --- /dev/null +++ b/files/configs/Debian/defaults/timeperiods.cfg @@ -0,0 +1,50 @@ +############################################################################### +# 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 -- cgit v1.2.3