First cut at moving over nrpe client scripts.
This commit is contained in:
parent
e43cd8a91c
commit
7ef93ded5d
9 changed files with 120 additions and 2 deletions
1
files/nagios/client/check_cron.cfg
Normal file
1
files/nagios/client/check_cron.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
command[check_cron]=/usr/lib64/nagios/plugins/check_procs -c 1:10 -C 'crond' -u root
|
1
files/nagios/client/check_disk.cfg
Normal file
1
files/nagios/client/check_disk.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
command[check_disk_/]=/usr/lib64/nagios/plugins/check_disk -w 15% -c 10% -p /
|
1
files/nagios/client/check_mirrorlist_cache.cfg
Normal file
1
files/nagios/client/check_mirrorlist_cache.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
command[check_mirrorlist_cache]=/usr/lib64/nagios/plugins/check_file_age -w 86400 -c 129600 -f /var/lib/mirrormanager/mirrorlist_cache.pkl
|
1
files/nagios/client/check_postfix_queue.cfg
Normal file
1
files/nagios/client/check_postfix_queue.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
command[check_postfix_queue]=/usr/lib64/nagios/plugins/check_postfix_queue -w 2 -c 5
|
1
files/nagios/client/check_raid.cfg
Normal file
1
files/nagios/client/check_raid.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
command[check_raid]=/usr/lib64/nagios/plugins/check_raid.py
|
1
files/nagios/client/check_swap.cfg
Normal file
1
files/nagios/client/check_swap.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 15% -c 10%
|
49
files/nagios/client/scripts/check_postfix_queue
Executable file
49
files/nagios/client/scripts/check_postfix_queue
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# 19-07-2010
|
||||||
|
# Author: Cherwin Nooitmeer <cherwin@gmail.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
# exit codes
|
||||||
|
e_ok=0
|
||||||
|
e_warning=1
|
||||||
|
e_critical=2
|
||||||
|
e_unknown=3
|
||||||
|
|
||||||
|
# regular expression that matches queue IDs (e.g. D71EF7AC80F8)
|
||||||
|
queue_id='^[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]'
|
||||||
|
|
||||||
|
usage="Invalid command line usage"
|
||||||
|
|
||||||
|
if [ -z $1 ]; then
|
||||||
|
echo $usage
|
||||||
|
exit $e_unknown
|
||||||
|
fi
|
||||||
|
|
||||||
|
while getopts ":w:c:" options
|
||||||
|
do
|
||||||
|
case $options in
|
||||||
|
w ) warning=$OPTARG ;;
|
||||||
|
c ) critical=$OPTARG ;;
|
||||||
|
* ) echo $usage
|
||||||
|
exit $e_unknown ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# determine queue size
|
||||||
|
qsize=$(mailq | egrep -c $queue_id)
|
||||||
|
if [ -z $qsize ]
|
||||||
|
then
|
||||||
|
exit $e_unknown
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $qsize -ge $critical ]; then
|
||||||
|
retval=$e_critical
|
||||||
|
elif [ $qsize -ge $warning ]; then
|
||||||
|
retval=$e_warning
|
||||||
|
elif [ $qsize -lt $warning ]; then
|
||||||
|
retval=$e_ok
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$qsize mail(s) in queue | mail_queue=$qsize"
|
||||||
|
exit $retval
|
45
files/nagios/client/scripts/check_raid.py
Executable file
45
files/nagios/client/scripts/check_raid.py
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# very simple python script to parse out /proc/mdstat
|
||||||
|
# and give results for nagios to monitor
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import string
|
||||||
|
|
||||||
|
devices = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
mdstat = string.split(open('/proc/mdstat').read(), '\n')
|
||||||
|
except IOError:
|
||||||
|
# seems we have no software raid on this machines
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
error = ""
|
||||||
|
i = 0
|
||||||
|
for line in mdstat:
|
||||||
|
if line[0:2] == 'md':
|
||||||
|
device = string.split(line)[0]
|
||||||
|
devices.append(device)
|
||||||
|
status = string.split(mdstat[i+1])[3]
|
||||||
|
if string.count(status, "_"):
|
||||||
|
# see if we can figure out what's going on
|
||||||
|
err = string.split(mdstat[i+2])
|
||||||
|
msg = "device=%s status=%s" % (device, status)
|
||||||
|
if len(err) > 0:
|
||||||
|
msg = msg + " rebuild=%s" % err[0]
|
||||||
|
|
||||||
|
if not error:
|
||||||
|
error = msg
|
||||||
|
else:
|
||||||
|
error = error + ", " + msg
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
if not error:
|
||||||
|
print "DEVICES %s OK" % " ".join(devices)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print error
|
||||||
|
sys.exit(2)
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
tags:
|
tags:
|
||||||
- packages
|
- packages
|
||||||
|
|
||||||
|
- name: install local nrpe check scripts that are not packaged
|
||||||
|
copy: src=$files/nagios/client/scripts/$item dest=/usr/lib64/nagios/plugins/$item
|
||||||
|
with_items:
|
||||||
|
- check_postfix_queue
|
||||||
|
- check_raid.py
|
||||||
|
|
||||||
# create dirs
|
# create dirs
|
||||||
# puppet used to make /var/spool/nagios (owned by nagios.nagios) mode 750
|
# puppet used to make /var/spool/nagios (owned by nagios.nagios) mode 750
|
||||||
# and /usr/lib/nagios/plugins (owned by root) mode 755 - but we don't know WHY
|
# and /usr/lib/nagios/plugins (owned by root) mode 755 - but we don't know WHY
|
||||||
|
@ -35,9 +41,21 @@
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
|
|
||||||
|
- name: install nrpe client configs
|
||||||
|
copy: src=$files/nagios/client/$item dest=/etc/nrpe.d/$item
|
||||||
|
with_items:
|
||||||
|
- check_mirrorlist_cache.cfg
|
||||||
|
- check_raid.cfg
|
||||||
|
- check_cron.cfg
|
||||||
|
- check_disk.cfg
|
||||||
|
- check_swap.cfg
|
||||||
|
- check_postfix_queue.cfg
|
||||||
|
notify:
|
||||||
|
- restart nrpe
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
|
||||||
- name: nrpe service start
|
- name: nrpe service start
|
||||||
service: name=nrpe state=running enabled=true
|
service: name=nrpe state=running enabled=true
|
||||||
tags:
|
tags:
|
||||||
- service
|
- service
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue