Page 1 of 1

writing a plugin, looking for advice on capability or other

Posted: Mon Aug 12, 2019 2:55 pm
by gmills
I am looking at writing a plugin. what I would like to do. reason I'm asking if the Nagios team if it is feasible. thank you
or if there is already a mechanism for doing something like this?

I am thinking to ping the server, access its health.

primary | failover |
------------------------------------
up | up | |do nothing
up | down | |start environments on primary - if primary previous state is up, do nothing
down | up | |start environments on failover
down | down | |wait until next health check

Re: writing a plugin, looking for advice on capability or ot

Posted: Tue Aug 13, 2019 9:07 am
by mbellerue
Hi gmills,

This sounds like it could be a challenging plugin to write. Here are a few Nagios features that may help you along the way.

Event Handlers
https://assets.nagios.com/downloads/nag ... dlers.html

Adaptive Monitoring
https://assets.nagios.com/downloads/nag ... ptive.html

Monitoring Service and Host Clusters
https://assets.nagios.com/downloads/nag ... sters.html

Re: writing a plugin, looking for advice on capability or ot

Posted: Tue Aug 13, 2019 2:49 pm
by mcapra
Really sounds like you're looking for a custom event handler rather than a traditional Nagios plugin.

But yeah, all of that sounds very doable on a basic level and even something very typical of what people generally do with event handlers.

Re: writing a plugin, looking for advice on capability or ot

Posted: Tue Aug 13, 2019 3:19 pm
by mbellerue
Thanks, Matt! Yeah, this really does sound like a job for Event Handlers.

gmills, definitely let us know if there's anything else we can do to help.

Re: writing a plugin, looking for advice on capability or ot

Posted: Tue Aug 13, 2019 6:09 pm
by gmills
thanks everyone, yeah, I do think nagios Core could be used this way, I will play around with event handlers and utilize your suggestions, thank you very much. It does sound like a very kewl project/initiative, but, the more I think about it and investigate, I think I am going to ( sense it is intention is for failover of monitored servers) implement a failover solution on Linux with Linux Virtual Server or Heartbeat/Pacemaker,Corosync. I only have a 2 node cluster. But, I'm intriged by using Nagios/HA monitoring health, then issue logic.

Re: writing a plugin, looking for advice on capability or ot

Posted: Tue Aug 13, 2019 6:27 pm
by gmills
Hey, which leads me to another Nagios Core question, :) lol, thanks

is there a way with Nagios Core to automagically switch groups of services from inactive to active, say I have around 200 services monitoring the primary server, and these are all activly monitored by Nagios Core, then a nightmare occurs and the system crashes( primary ). The failover mechanism will switch the servers services to the secondary or failover box, for however long it takes, then now I have to manually inactivate and activate the correct services monitored for the secondary host.

thanks for all your insight and suggestions,

Re: writing a plugin, looking for advice on capability or ot

Posted: Wed Aug 14, 2019 7:58 am
by scottwilkerson
gmills wrote:is there a way with Nagios Core to automagically switch groups of services from inactive to active
Not automagically, but it can be done programmatically
https://assets.nagios.com/downloads/nag ... ernalcmds/

Code: Select all

DISABLE_HOSTGROUP_HOST_CHECKS
ENABLE_HOSTGROUP_HOST_CHECKS
DISABLE_HOSTGROUP_SVC_CHECKS
ENABLE_HOSTGROUP_SVC_CHECKS
There are options for SERVICEGROUPS as well