mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-12-26 19:13:52 +01:00
nrpe.d added for check_nagios
This commit is contained in:
parent
aaa9b2d55a
commit
1941f62f8f
38
check_nagios/check_nagios_configuration
Executable file
38
check_nagios/check_nagios_configuration
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
PERFDATA=""
|
||||
MESSAGE="Nagios configuration is valid"
|
||||
EXIT_CODE=3
|
||||
|
||||
TMPFILE=`mktemp`
|
||||
nagios -v /etc/nagios/nagios.cfg > $TMPFILE
|
||||
RESULT=$?
|
||||
|
||||
# grep -E '^\s+Checked'
|
||||
warnings=`grep -c -E "^Warning:" "$TMPFILE"`
|
||||
errors=`grep -c -E "^Error:" "$TMPFILE"`
|
||||
PERFDATA="warnings=$warnings errors=$errors"
|
||||
|
||||
|
||||
# If there are any warnings
|
||||
if [ $warnings -gt 0 ]; then
|
||||
MESSAGE="nagios.cfg has $warnings warnings"
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
|
||||
|
||||
# If nagios -v fails. Config is invalid
|
||||
if [ $RESULT -gt 0 ]; then
|
||||
MESSAGE="Could not validate Nagios configuration."
|
||||
EXIT_CODE=2
|
||||
fi
|
||||
|
||||
if [ $EXIT_CODE -eq "3" ]; then
|
||||
EXIT_CODE=0
|
||||
fi
|
||||
|
||||
echo "$MESSAGE | $PERFDATA"
|
||||
grep -E "^Error|^Warning" "$TMPFILE"
|
||||
rm -f TMPFILE
|
||||
exit $EXIT_CODE
|
6
misc/check_nagios_ghostservices → check_nagios/check_nagios_ghostservices
Normal file → Executable file
6
misc/check_nagios_ghostservices → check_nagios/check_nagios_ghostservices
Normal file → Executable file
@ -13,16 +13,16 @@ sort | uniq > $TMP
|
||||
|
||||
|
||||
LINES=`cat $TMP | wc -l`
|
||||
PERFDATA="'ghost_clients'=$LINES"
|
||||
PERFDATA="'ghost_services'=$LINES"
|
||||
if [ $LINES -gt 0 ]; then
|
||||
echo "$LINES ghost clients found in Nagios log files | $PERFDATA"
|
||||
echo "$LINES ghost services 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"
|
||||
echo "No ghost services found in Nagios log files | $PERFDATA"
|
||||
rm -f $TMP
|
||||
exit 0
|
||||
|
2
check_nagios/nrpe.d/check_nagios.cfg
Normal file
2
check_nagios/nrpe.d/check_nagios.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
command[check_nagios_configuration]=/usr/lib64/nagios/plugins/check_nagios_configuration
|
||||
command[check_nagios_ghostservices]=/usr/lib64/nagios/plugins/check_nagios_ghostservices
|
Loading…
Reference in New Issue
Block a user