Hello,
I've been using Powershell to disable/enable event handlers globally across our Nagios XI instance using the External Core Commands. Is there a Core Command or a way to disable/enable event handlers for a particular host/service group? Below is what I'm using to disable event handlers globally via Powershell, any examples of doing something similar but just for a specified host/service group would be greatly appreciated.
Invoke-RestMethod -Method Post -Uri "http://**********/nagiosxi/api/v1/system/corecommand?apikey=***********" -Body "cmd=DISABLE_EVENT_HANDLERS"
Nagios Core External Commands - Event Handlers
-
FrontlineIT
- Posts: 94
- Joined: Tue Jul 26, 2016 8:46 am
Re: Nagios Core External Commands - Event Handlers
I don't specifically know of a way to disable it for a host/service, but you could write your event handler(s) to look for a local lock file on the Nagios system. If lock file exists, then exit handler. Then you could make a quick PHP/Perl/Python/Bash/whatever web script that takes service, host, and maybe an API key, verifies you, and then creates/deletes the lock file through the Apache web server.
This way, a CURL request would create/delete the lock file, and the event handler would exit/proceed accordingly.
This way, a CURL request would create/delete the lock file, and the event handler would exit/proceed accordingly.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Nagios Core External Commands - Event Handlers
Thanks for jumping in, Eric!
FrontlineIT, would Eric's solution work for your setup?
FrontlineIT, would Eric's solution work for your setup?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
FrontlineIT
- Posts: 94
- Joined: Tue Jul 26, 2016 8:46 am
Re: Nagios Core External Commands - Event Handlers
Thanks for the idea but we have a bunch of different event handlers scattered across thousands of servers so that would be tough. Was hoping there would be an external core command similar to "DISABLE_HOSTGROUP_SVC_NOTIFICATIONS". The end goal is to be able to disable alerts and event handlers for a particular group of servers serving an application. The alerts portion is covered already with the command pointed out above. It would be nice, for example, if there was a command named something like "DISABLE_HOSTGROUP_SVC_EVENT_HANDLERS".
Re: Nagios Core External Commands - Event Handlers
Event handlers run on the Nagios server. Do you have thousands of Nagios servers?
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
-
FrontlineIT
- Posts: 94
- Joined: Tue Jul 26, 2016 8:46 am
Re: Nagios Core External Commands - Event Handlers
Sorry, I may have misunderstood. I was thinking of the custom plugins/scripts the event handlers reach out to execute on the target hosts.
-
FrontlineIT
- Posts: 94
- Joined: Tue Jul 26, 2016 8:46 am
Re: Nagios Core External Commands - Event Handlers
The lock file route may be tough because we have generic event handlers that are used by multiple apps/servers which is why I was hoping to use host groups/service groups.
Re: Nagios Core External Commands - Event Handlers
Take a look at this site with a list of the Nagios External Commands.
https://assets.nagios.com/downloads/nag ... ernalcmds/
There are commands for enabling or disabling Event Handlers for Host and Services but there is not one for Hostgroups.
https://assets.nagios.com/downloads/nag ... ernalcmds/
There are commands for enabling or disabling Event Handlers for Host and Services but there is not one for Hostgroups.
Bad news is that there is not a way to do that by groups so you have to write a script to get the services and then run the external command for each service.ENABLE_SVC_EVENT_HANDLER
DISABLE_SVC_EVENT_HANDLER
ENABLE_HOST_EVENT_HANDLER
DISABLE_HOST_EVENT_HANDLER
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
FrontlineIT
- Posts: 94
- Joined: Tue Jul 26, 2016 8:46 am
Re: Nagios Core External Commands - Event Handlers
Thank you. I will take a stab at that. This forum can be closed.