Page 1 of 1

sending notification email on check=ok

Posted: Mon Nov 27, 2017 6:28 am
by jmluce
Hi All,
I check an as400 job queue each morning at 7. It has to have exactly 67 jobs, and the service returns either OK or CRITICAL.
This works perfectly well, but...
I would like to be notified by mail of the result, whatever it is, and not only on a not OK state (this part I know doing).
I have to add that the service is not flapping, and it doesn't recover either so I can't play with these statuses.
I perused https://assets.nagios.com/downloads/nag ... tions.html and understand that 'stable OK status = no one gets notified'. So my question is : how would you experts trick Nagios to work around this case ?
Thanks if ever :)
jm


--
Ubuntu 16.04 LTS / Nagios Core 4.3.4

Re: sending notification email on check=ok

Posted: Tue Nov 28, 2017 11:01 am
by npolovenko
Hello, @jmluce. I don't think there a way to make Nagios send notifications for OK state. It can be set to send an alert whenever the check is flapping(goes to critical and comes back up right away).
What you can do is swap an ok state with a warning state. And that will be triggering a warning alert. In the commands.cfg file edit the command to look like this:

Code: Select all

command_line    $USER1$/negate -o WARNING -s $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARGS3$
In this example, OK state for the check_disk plugin will be replaced with a warning state.

Re: sending notification email on check=ok

Posted: Thu Nov 30, 2017 10:33 am
by jmluce
Hi @npolovenko,
Thanks for your reply, I didn't know the 'negate' command wich may be helpful.
Eventually, I hardcoded an 'if return code OK then send mail' notification inside my script. Not that it is sustainable nor aesthetic...
But it does the job for now, as I want an OK status for my stats.
Thanks again, bye!

Re: sending notification email on check=ok

Posted: Fri Dec 01, 2017 11:33 am
by npolovenko
@jmluce, Well, I'm glad you found a solution. The negate option might do the work if you don't want to use a script. I will close this thread for now but feel free to open a new one if you'll have other questions.