Nagios Core External Commands - Event Handlers

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
FrontlineIT
Posts: 94
Joined: Tue Jul 26, 2016 8:46 am

Nagios Core External Commands - Event Handlers

Post by FrontlineIT »

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"
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios Core External Commands - Event Handlers

Post by eloyd »

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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Nagios Core External Commands - Event Handlers

Post by mbellerue »

Thanks for jumping in, Eric!

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!
FrontlineIT
Posts: 94
Joined: Tue Jul 26, 2016 8:46 am

Re: Nagios Core External Commands - Event Handlers

Post by FrontlineIT »

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".
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios Core External Commands - Event Handlers

Post by eloyd »

Event handlers run on the Nagios server. Do you have thousands of Nagios servers?
Image
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

Post by FrontlineIT »

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

Post by FrontlineIT »

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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios Core External Commands - Event Handlers

Post by tgriep »

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.
ENABLE_SVC_EVENT_HANDLER
DISABLE_SVC_EVENT_HANDLER
ENABLE_HOST_EVENT_HANDLER
DISABLE_HOST_EVENT_HANDLER
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.
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

Post by FrontlineIT »

Thank you. I will take a stab at that. This forum can be closed.
Locked