Page 1 of 1

Macros

Posted: Thu Jun 05, 2014 2:14 am
by dreamboy_sivak
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.

Re: Macros

Posted: Thu Jun 05, 2014 5:38 am
by Stuart Watts
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?

Re: Macros

Posted: Thu Jun 05, 2014 9:45 am
by dreamboy_sivak
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.

Re: Macros

Posted: Thu Jun 05, 2014 9:52 am
by Stuart Watts
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.

Re: Macros

Posted: Thu Jun 05, 2014 2:46 pm
by sreinhardt
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.

Re: Macros

Posted: Fri Jun 06, 2014 6:51 am
by dreamboy_sivak
Hi,


Any option in nagios to get those Macros current values.

How many macros can we create in nagios ?

Re: Macros

Posted: Fri Jun 06, 2014 11:47 am
by sreinhardt
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.