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.
cbeattie wrote:If it bugs you enough, there are two things I can think of. First, enable your e-mail contact to receive unknown (u) notifications and r, but not w or c. I get far, far fewer unknown states than w or c, and maybe you'll still get all the r.
cesar.garza wrote:Thanks for your help and i tried with notification option ""u"" only but it didn't work.
Did you try with "u" AND "r" like he suggested?
Or have you tried cbeattie's previous suggestion of a custom notification command?
I havent tried cbeattie's suggestion yet because i am not fully understand. I tried just ""u"" with r option and it didn't work. On some website,i read that if there is no option (w and c) then you wont get the r too.
cesar.garza wrote:
I haven't completely understand this one. should i have only one templates without/with ""r"" ? and then add above command to command.cfg file.
The contact needs to have the w, c, and r. The idea is that Nagios is satisfied the contact will receive everything. Then the notification command (not Nagios) filters out the w and c, and only forwards the r. The way I wrote it won't work, though, since "if" is built-in to bash.
What sreinhardt suggested is to replace the printf call in the notification command, and have the command call a shell script instead (and pass it the necessary parameters). The script then checks if it's being called for a recovery notification, and if so, then it sends out the e-mail notification. The script just ignores warnings and criticals, and doesn't send e-mail for them.
I was actually stating that I would wrap the entire notification command in a script, or as much as possible as nothing is evaluated other than variables being expanded. If you just handle the "if" logic in a bash script, we're both right! What are you confused on cesar?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
cbeattie wrote:I had another idea which (if it works) is certainly easier and better than changing the source code. It might be possible to use a custom notification command instead. Something along these lines:
cesar.garza wrote:
I haven't completely understand this one. should i have only one templates without/with ""r"" ? and then add above command to command.cfg file.
The contact needs to have the w, c, and r. The idea is that Nagios is satisfied the contact will receive everything. Then the notification command (not Nagios) filters out the w and c, and only forwards the r. The way I wrote it won't work, though, since "if" is built-in to bash.
What sreinhardt suggested is to replace the printf call in the notification command, and have the command call a shell script instead (and pass it the necessary parameters). The script then checks if it's being called for a recovery notification, and if so, then it sends out the e-mail notification. The script just ignores warnings and criticals, and doesn't send e-mail for them.
It sounds good to me but so far what i understand is that make the shell script with this
I think you're on the right track. You have to pass the Nagios macros as parameters to the script. So, I think you'll end up with something along the lines of:
I tried the cbeattie suggest and it didn't work. what i did is make a script and put the command in the command.cfg like this and also edited the template file for notification option. I got the call but not recovery email.