sending notification email on check=ok

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jmluce
Posts: 2
Joined: Mon Nov 27, 2017 5:48 am

sending notification email on check=ok

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: sending notification email on check=ok

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jmluce
Posts: 2
Joined: Mon Nov 27, 2017 5:48 am

Re: sending notification email on check=ok

Post 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!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: sending notification email on check=ok

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked