Hi
Nagios is Providing number of Macros.
Like $HOSTSTATETYPE$,$HOSTATTEMPT$,$HOSTSTATE$ and $SERVICESTATETYPE$,$SERVICEATTEMPT$,$SERVICESTATE$.
My Question is can we change the values manually. which means if the current value of $SERVICESTATETYPE$ is HARD means then run an Event Handler and regarding the output i need to change the $SERVICESTATETYPE$ to SOFT.
is it possible in nagios?
if yes then let me know.
Macros
-
- Posts: 40
- Joined: Wed Sep 25, 2013 7:01 am
Re: Macros
Short answer is "no". Nagios has to take decisions on things like send alerts, tripping event handlers etc. based on these parameters.
You can of course test the value of these in event handler or notification scripts so that the output appears differently (changing "DOWN" to "CRITICAL", for example).
What's your use case for changing HARD to SOFT, just out of interest?
You can of course test the value of these in event handler or notification scripts so that the output appears differently (changing "DOWN" to "CRITICAL", for example).
What's your use case for changing HARD to SOFT, just out of interest?
-
- Posts: 18
- Joined: Tue Mar 25, 2014 2:13 am
Re: Macros
Hi Stuart Watts
My case is getting fake alerts from nagios.
Actually using nagios monitoring the webserver which is located in remote server. some times the web-server taking more time to response nagios http plugin request.
At this time nagios changing the state type from HARD to SOFT, and starts checking.
[But at these time web-server is running]
when nagios reaches it's maximum service attempt,it starts sending alerts CRITICAL and OK
Now, i wrote a event handler it triggers and get the time taken by the service.But i can't avoid the email notification.
My need is when the service took a more time to response i don't want any email like CRITICAL or OK
Forgive me if i am not clear in my explanation.
My case is getting fake alerts from nagios.
Actually using nagios monitoring the webserver which is located in remote server. some times the web-server taking more time to response nagios http plugin request.
At this time nagios changing the state type from HARD to SOFT, and starts checking.
[But at these time web-server is running]
when nagios reaches it's maximum service attempt,it starts sending alerts CRITICAL and OK
Now, i wrote a event handler it triggers and get the time taken by the service.But i can't avoid the email notification.
My need is when the service took a more time to response i don't want any email like CRITICAL or OK
Forgive me if i am not clear in my explanation.
-
- Posts: 40
- Joined: Wed Sep 25, 2013 7:01 am
Re: Macros
Sorry if I've misunderstood, but it sounds to me like you just need to increase max_check_attempts, or retry_interval, in order to prevent these false positives.
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Macros
I agree with stuart here as well. You can increase one or more of several different values to help correct this.
Plugin timeout - This is an ideal case where if it is just a matter of your server taking a bit too long plugin timeout or warning\critical threshold increases would likely resolve the issue alone.
Max check attempts - Along with plugin timeout, allowing nagios to check more times over an extended period of time will lower what you consider false postives potentially, as it will give the remote system a longer window to lower the response time.
Retry interval - Much like max check attempts, this would allow the same number of checks presently, to be extended over a longer period of time as they would be more infrequent when in a soft error state, again allowing the remote system to recover.
I would honestly start by re-evaluating the plugin timeout, warning and critical values, as that is where your issue really is. If you fully expect the server to respond slower at peak times, you should modify your command syntax so that your plugin can properly understand that it is not really in a error state.
Plugin timeout - This is an ideal case where if it is just a matter of your server taking a bit too long plugin timeout or warning\critical threshold increases would likely resolve the issue alone.
Max check attempts - Along with plugin timeout, allowing nagios to check more times over an extended period of time will lower what you consider false postives potentially, as it will give the remote system a longer window to lower the response time.
Retry interval - Much like max check attempts, this would allow the same number of checks presently, to be extended over a longer period of time as they would be more infrequent when in a soft error state, again allowing the remote system to recover.
I would honestly start by re-evaluating the plugin timeout, warning and critical values, as that is where your issue really is. If you fully expect the server to respond slower at peak times, you should modify your command syntax so that your plugin can properly understand that it is not really in a error state.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
- Posts: 18
- Joined: Tue Mar 25, 2014 2:13 am
Re: Macros
Hi,
Any option in nagios to get those Macros current values.
How many macros can we create in nagios ?
Any option in nagios to get those Macros current values.
How many macros can we create in nagios ?
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Macros
Ah these would be defined in your service templates or service configurations. Timeout and warning\critical thresholds could also be configured in the command definition. You can have up to 255 $ARG#$ for host and service definitions, however you would almost never, if it's even possible, use these in notification definitions.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.