From 950c22b38bef72f68e9cf7ddb8927c1a3f82fe61 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Thu, 7 Jan 2010 19:55:23 +0000 Subject: * Collect software raid status from /proc/mdstat if it exist. * Generate Nagios checks for software raid, zombie processes, swap, dns, imaps, nfs and squid too. Rename Nagios services to use lower case characters. --- collect.d/system | 5 +++ debian/changelog | 9 ++++++ nagios-templates.cfg | 35 +++++++++++++++++++++ sitesummary-nodes | 87 ++++++++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 123 insertions(+), 13 deletions(-) diff --git a/collect.d/system b/collect.d/system index 2a43630..4ec5438 100644 --- a/collect.d/system +++ b/collect.d/system @@ -37,6 +37,11 @@ route -n > route-n cat /proc/cpuinfo > cpuinfo cat /proc/meminfo > meminfo +# Collect software RAID status +if [ -f /proc/mdstat ] ; then + cat /proc/mdstat > mdstat +fi + # Collect mount points, for nagios configuration cp /etc/fstab fstab cat /proc/mounts > procmounts diff --git a/debian/changelog b/debian/changelog index b614134..6ddedc5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +sitesummary (0.0.53) UNRELEASED; urgency=low + + * Collect software raid status from /proc/mdstat if it exist. + * Generate Nagios checks for software raid, zombie processes, swap, + dns, imaps, nfs and squid too. Rename Nagios services to use + lower case characters. + + -- Petter Reinholdtsen Thu, 07 Jan 2010 20:03:00 +0100 + sitesummary (0.0.52) unstable; urgency=low * Change cron job to only reload nagios when the sitesummary generated diff --git a/nagios-templates.cfg b/nagios-templates.cfg index eafcd74..9732e8e 100644 --- a/nagios-templates.cfg +++ b/nagios-templates.cfg @@ -117,6 +117,41 @@ define command{ command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p $ARG1$ } +define command{ + command_name check_dns + command_line /usr/lib/nagios/plugins/check_dns -H $HOSTADDRESS$ -s $HOSTADDRESS$ +} + +define command{ + command_name check_imaps + command_line /usr/lib/nagios/plugins/check_imap -p 993 -H $HOSTADDRESS$ -S +} + +define command{ + command_name check_nfs + command_line /usr/lib/nagios/plugins/check_rpc -H $HOSTADDRESS$ -C nfs -c2,3 +} + +define command{ + command_name check_squid + command_line /usr/lib/nagios/plugins/check_http -H $HOSTADDRESS$ -p $ARG1$ -u $ARG2$ -e 'HTTP/1.0 200 OK' +} + +define command{ + command_name check_swap + command_line /usr/lib/nagios/plugins/check_swap -w $ARG1 -c $ARG2$ +} + +define command{ + command_name check_procs_zombie + command_line /usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s Z +} + +define command{ + command_name check_linux_raid + command_line /usr/lib/nagios/plugins/check_linux_raid +} + define command{ command_name check-host-alive command_line /usr/lib/nagios/plugins/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1 diff --git a/sitesummary-nodes b/sitesummary-nodes index 64a8e36..0f1b5f3 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -123,9 +123,21 @@ define host { define service { use server-service host_name $hostname - service_description PING + service_description ping check_command check_ping!100.0,20%!500.0,60% } +define service { + use server-service + host_name $hostname + service_description swap + check_command check_swap!10%!5% +} +define service { + use server-service + host_name $hostname + service_description zombie procs + check_command check_procs_zombie!20!100 +} EOF # check disk free space @@ -158,7 +170,7 @@ EOF define service { use server-service host_name $hostname - service_description Disk $partition + service_description disk $partition check_command check_disk!$warn%!$crit%!$partition } EOF @@ -168,10 +180,11 @@ EOF my %tcpservices = ( 139 => { name => 'samba', package => 'samba' }, + 389 => { name => 'ldap', package => 'slapd' }, 631 => { name => 'CUPS', package => 'cupsys' }, 636 => { name => 'ldaps', package => 'slapd' }, - 3128 => { name => 'squid', package => 'squid' }, -# 10000 => { name => 'webmin', package => 'webmin' }, + 4949 => { name => 'munin', package => 'munin-node' }, + 7100 => { name => 'xfs', package => 'xfs' }, # check X font server ); for my $port (sort { $a <=> $b } keys %tcpservices) { @@ -188,19 +201,67 @@ define service { } EOF } + # check software raid status + if ( -e get_filepath_current($hostid, "/system/mdstat") ) { + print <