Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
Your review has been submitted and is pending approval.
Checks for new error reports using a shell script.
Current Version
Last Release Date
June 15, 2009
Owner
Nagios Exchange
Download URL
https://exchange.nagios.org/wp-content/uploads/project-files/2009/06/check_errpt
the script
This script checks for new error reports since last time run and can be "triggered" by nagios. (wrap it in a ssh shell for security)
I use the following command definition: $USER1$/check_by_ssh -t 25 -H $HOSTADDRESS$ -l admin -C '$USER1$/check_errpt'
For the service definition you don't want to configure any retry's since it check for new reports since last time run. Max. Check Attempts=1
I had to make some changes, to make this work - if you try this modified version, please remember to delete the tmp files created previously by the script. #!/bin/bash # script that checks for new errpt # errptlast=/tmp/errptlast errpttmp=/tmp/errpttmp admin=root@localhost # # check if first run errpt | egrep -v '^IDENTIFIER' > $errpttmp if [ ! -f $errptlast ] ; then # first run generate a timestamp - 1 hour to fake last run #phour=$((`date +%H` - 2)) phour=$((`date +%k` - 2)) #date +%m%d$phour%M%y > $errptlast date +%m%d%H%M%y > $errptlast fi lastts=`cat $errptlast` count=`errpt -s "$lastts" | egrep -v '^IDENTIFIER' | wc -l` exit1=$? count=`echo $count` countcrit=`errpt -s "$lastts" | egrep -v '^IDENTIFIER' | sed -n 's!.* (P) .*!1!p' | wc -l` exit2=$? countcrit=`echo $countcrit` if [ "$count" -ge 1 ] ; then # determine level errpt -A -D -s "$lastts" | mail -s "$count new error reports of which $countcrit critical on `hostname` since $lastts" $admin #date +%m%d%H%M%y > $errptlast date +%m%d%H%M%y > $errptlast if [ "$countcrit" -ge 1 ] ; then echo "$count new error reports of which $countcrit critical generated since $lastts" exit 2 else echo "$count New error reports generated since $lastts" exit 1 fi fi if [ "$count" == 0 ] && [ "$countcrit" == 0 ] && [ "$exit1" == 0 ] && [ "$exit2" == 0 ] ; then echo "No new Error Reports since $lastts" exit 0 fi echo "Errpt Check failed" exit 3
You must be logged in to submit a review.
To:
From: