Hi @jimmlegs,
Yes, you can pass any of the standard Macros available in Nagios Core to your event handler. Those are listed on the following page with descriptions.
Standard Macros in Nagios
Take a look at $SERVICEOUTPUT$ and $LONGSERVICEOUTPUT$ on the page. That should contain the stopped service data.
--Benjamin
Passing Failed Service Name To Event Handler
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Passing Failed Service Name To Event Handler
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!
Re: Passing Failed Service Name To Event Handler
I've got the MACROS in the event handler but do not know how to pass the failed service name dynamically to the remote host. So if I am monitoring 80 services in one check I would like the event handler to attempt to restart any one of them that crashes. The free variables do not appear to parse MACRO data or I cannot find the information on how this is achieved. Even providing a static list somehow could potentially do the trick.
Perhaps XI this is the wrong solution for this.
Perhaps XI this is the wrong solution for this.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Passing Failed Service Name To Event Handler
Hi @jimmlegs,
The example in the guide is very simple with just one service to re-start, it may be easier to break this up into single checks for simplicity. The other approach I can think of would be to write a wrapper script for the service check that does the heavy lifting, parsing the output from the plugin, and returning the proper exit code. However, this is getting into more complex custom programming which is outside the scope of technical support.
Here are the guidelines for plugin development.
Nagios Plugins Development Guidelines
--Benjamin
The example in the guide is very simple with just one service to re-start, it may be easier to break this up into single checks for simplicity. The other approach I can think of would be to write a wrapper script for the service check that does the heavy lifting, parsing the output from the plugin, and returning the proper exit code. However, this is getting into more complex custom programming which is outside the scope of technical support.
Here are the guidelines for plugin development.
Nagios Plugins Development Guidelines
--Benjamin
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!
Re: Passing Failed Service Name To Event Handler
Thanks. You can close, I will consider alternative solutions for this issue and will keep future handlers simple.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Passing Failed Service Name To Event Handler
Locking threadjimmlegs wrote:Thanks. You can close, I will consider alternative solutions for this issue and will keep future handlers simple.