We have a few checks implemented using the Oracle Query plugin which return counts from Db tables e.g.
select count(*) from esjkeprd.ej_bulk_comm_send ebcs, esjkeprd.ej_bulk_communication ebc where ebc.id=ebcs.communication_id and (ebcs.is_sent!='y' and ebcs.is_sent!='f') and ebcs.is_ready!='f' and ebc.method_id=1328: 2604
The issue we have is that our customer has a bulk send function and can send out thousands of records in one batch, the fact there is a big number outstanding is not an issue as it will eventually clear.
Is there a way we can configure Nagios to alert if the number returned is the same more than once i.e. the queue is not clearing?
Alert when Value not changed
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Alert when Value not changed
By default Nagios plugins are without state. It can be pretty easy to add with a wrapper though:
wrapper.sh
wrapper.sh
Code: Select all
#!/bin/bash
tmpfile="/tmp/nagioscheckfoo.tmp"
nrpe="/usr/local/nagios/libexec/check_nrpe"
check="$1"
newrun="$($check | sed 's/[^0-9]*//')"
oldrun="$(head -1 $tmpfile)"
echo $newrun > $tmpfile
if [ "$newrun" -eq "$oldrun" ]; then
output=2
status="CRITICAL - Nothing has changed"
else
output=0
status="OK - The data seems to have changed"
fi
echo $status
exit $outputCode: Select all
[root@localhost libexec]# ./wrapper.sh '/usr/local/nagios/libexec/check_dummy 0 12345'
CRITICAL - Nothing has changed
[root@localhost libexec]# ./wrapper.sh '/usr/local/nagios/libexec/check_dummy 0 12345'
CRITICAL - Nothing has changed
[root@localhost libexec]# ./wrapper.sh '/usr/local/nagios/libexec/check_dummy 0 12346'
OK - The data seems to have changedRe: Alert when Value not changed
Excellent, thanks will give that a try
Re: Alert when Value not changed
Let us know if this works for you or if you have any follow up questions.
Former 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.
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Alert when Value not changed
Happy to help - that's the beauty of Nagios. If it doesn't already do what you want, it's usually pretty easy to change its behavior.
Let us know if this doesn't work out for you.
Let us know if this doesn't work out for you.