Alert when Value not changed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jstoddart
Posts: 46
Joined: Fri Apr 11, 2014 5:52 am

Alert when Value not changed

Post by jstoddart »

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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Alert when Value not changed

Post by jdalrymple »

By default Nagios plugins are without state. It can be pretty easy to add with a wrapper though:

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 $output

Code: 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 changed
jstoddart
Posts: 46
Joined: Fri Apr 11, 2014 5:52 am

Re: Alert when Value not changed

Post by jstoddart »

Excellent, thanks will give that a try
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Alert when Value not changed

Post by abrist »

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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Alert when Value not changed

Post by jdalrymple »

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.
Locked