mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-05 01:53:44 +01:00
check_nagios_ghostservices added
This commit is contained in:
parent
4c60683fd0
commit
581b2a77f3
28
misc/check_nagios_ghostservices
Normal file
28
misc/check_nagios_ghostservices
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
TMP=`mktemp`
|
||||
LAST_HOUR=`date "+%b %e %H:" -d "1 hour ago"`
|
||||
CURRENT_HOUR=`date "+%b %e %H:"`
|
||||
|
||||
tail -n 2000 /var/log/messages | \
|
||||
grep -E "$CURRENT_HOUR|$LAST_HOUR" | \
|
||||
grep "Passive check result was received" | \
|
||||
grep -i "could not be found" | \
|
||||
sed 's/.*Passive check result was received for service //' | \
|
||||
sed 's/, but the host could not be found.*//' | \
|
||||
sort | uniq > $TMP
|
||||
|
||||
|
||||
LINES=`cat $TMP | wc -l`
|
||||
PERFDATA="'ghost_clients'=$LINES"
|
||||
if [ $LINES -gt 0 ]; then
|
||||
echo "$LINES ghost clients found in Nagios log files | $PERFDATA"
|
||||
echo ""
|
||||
cat $TMP
|
||||
rm -f $TMP
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "No ghost clients found in Nagios log files | $PERFDATA"
|
||||
rm -f $TMP
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user