Page 1 of 1
My Nagios Users Are Forgetful
Posted: Mon Feb 19, 2018 12:08 pm
by Master_Chief_Jon
What if...
one of my Nagios users disables the notifications on one (or a few) service checks, and forgets to re-enable those notifications? Is there a command that I can run from a script to re-enable all host and service check notifications? Note that I am not talking about the global enable/disable notifications setting. I already know how to do that. I'm asking about a way to re-enable every individual host/svc check in a single command. I would like to run a script that runs this command every night (or maybe every other night) in cron, so our On-Call person actually receives notifications that something is wrong.
Re: My Nagios Users Are Forgetful
Posted: Mon Feb 19, 2018 12:16 pm
by mcapra
The workflow I'd use:
This only works for users who physically went to the Nagios GUI and "disabled notifications" that way. Or they submit an external command to disable the notifications. This doesn't bear any weight on the object's configurations. If an object's config file explicitly has the
notifications_enabled directive set to 0, this won't automagically change the config file. It just updates the "status" of the object.
Re: My Nagios Users Are Forgetful
Posted: Mon Feb 19, 2018 1:04 pm
by tmcdonald
Thanks for the assist,
@mcapra! That's essentially what I would suggest, although we do not have a ready-made script to do specifically that.
Re: My Nagios Users Are Forgetful
Posted: Mon Feb 19, 2018 4:00 pm
by Master_Chief_Jon
While I was waiting on a reply, I was "googling" for anyone else who had done this, and came across this URL:
https://exchange.nagios.org/directory/A ... er/details It is a bash file that uses awk to parse status.dat and list any disabled host or service notifications. I tweaked that a bit and added code to re-enable each disabled notification. That's working now.
I think I like the grep idea better than using awk. I'll dig into that and see if it results in a neater script.
Re: My Nagios Users Are Forgetful
Posted: Mon Feb 19, 2018 5:10 pm
by npolovenko
@Master_Chief_Jon, Sounds good. Thanks for sharing your solution with us!
Do you have any other questions for us so far?
Re: My Nagios Users Are Forgetful
Posted: Tue Feb 20, 2018 9:53 am
by Master_Chief_Jon
OK, I used the grep method to gather a list of host and service checks that have their notifications disabled. Then parsed that list to run the external command to re-enable each disabled host and service check. I'm good now. Thanks for your help.
Re: My Nagios Users Are Forgetful
Posted: Tue Feb 20, 2018 4:40 pm
by tmcdonald
Glad to hear it! I'll be closing this up now, but feel free to open another thread if you need anything in the future!