Hi,
Here is my plugin to give errors on aix server. It works when i run it from Nagios Shell, but it does not send me the email alert
#!/bin/bash
# script that checks for new errpt
#
errptlast=/tmp/errptlast
#
# check if first run
if [ ! -f $errptlast ] ; then
# first run generate a timestamp - 1 hour to fake last run
phour=$((`date +%H` - 2))
date +%m%d$phour%M%y > $errptlast
fi
lastts=`cat $errptlast`
countcrit=`errpt -T PERM -k A924A5FC -D -s "$lastts" | egrep -v '^IDENTIFIER' | sed
-n 's!.* \(P\) .*!\1!p' | wc -l`
#exit2=$?
countcrit=`echo $countcrit`
if [ "$countcrit" -ge 1 ] ; then
date +%m%d%H%M%y > $errptlast
errpt -k A924A5FC -A -D -T PERM -s "$lastts" | egrep -v '^IDENTIFIER'
echo "$countcrit critical errors on `hostname` since $lastts"
exit 2
else
echo "No new critical Error Reports since $lastts"
exit 0
fi
echo "Errpt Check failed"
exit 3
Statetype shows hard
When i run this from nagios server shell it gives me this
[root@nagiosxi libexec]# ./check_nrpe -H 10.0.6.2 -c errors
---------------------------------------------------------------------------
LABEL: SCAN_ERROR_CHRP
Date/Time: Mon Jan 7 12:19:42 CST 2013
Type: PERM
Resource Name: sysplanar0
Description
UNDETERMINED ERROR
Detail Data
PROBLEM DATA
0644 00E0 0000 017C 9600 8E00 0000 0000 0000 0000 4942 4D00 5048 0030 0100 2700
2013 0107 1820 3503 2013 0107 1820 3503 4500 0105 0000 0000 0000 0000 0000 0000
500F BCFE 500F BCFE 5548 0018 0100 2700 6103 4400 0000 0000 0000 A004 0000 0000
5053 00A0 0101 2700 0201 0009 0000 0098 003C 0001 0000 1500 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 3131 3030 3135 3130 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 2020 C000 0014 4C2B 4814 5537 3841 412E 3030
312E 575A 5347 354E 5400 0000 4944 1CCD 5057 5253 504C 5900 0000 0000 0000 0000
0000 0000 0000 0000 5045 1800 3832 3032 2D45 3442 3036 3633 3042 5000 0000 0000
4548 0068 0100 3100 3832 3032 2D45 3442 3036 3633 3042 5000 0000 0000 414C 3732
305F 3038 3200 0000 0000 000
I am expecting same thing as email like any other plugin. I dont know the mistake i am doing
Can i get help please.
Plugin does not email me
Re: Plugin does not email me
You should run over the development guidelines as you plugin is not outputting correctly. The first line outputs "------------..." where that should be a status string , a pipe, and then perfdata. You can still keep the extra output on the following lines. Looking at the exit codes:
Do you ever exit on "1"? You are not receiving any of the exit errors, which means you are either exiting on "2" or on the nebulous "1".
Code: Select all
echo "$countcrit critical errors on `hostname` since $lastts"
exit 2
else
echo "No new critical Error Reports since $lastts"
exit 0
fi
echo "Errpt Check failed"
exit 3Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.