Macros

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
dreamboy_sivak
Posts: 18
Joined: Tue Mar 25, 2014 2:13 am

Macros

Post 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.
Stuart Watts
Posts: 40
Joined: Wed Sep 25, 2013 7:01 am

Re: Macros

Post 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?
dreamboy_sivak
Posts: 18
Joined: Tue Mar 25, 2014 2:13 am

Re: Macros

Post 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.
Stuart Watts
Posts: 40
Joined: Wed Sep 25, 2013 7:01 am

Re: Macros

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Macros

Post 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.
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.
dreamboy_sivak
Posts: 18
Joined: Tue Mar 25, 2014 2:13 am

Re: Macros

Post by dreamboy_sivak »

Hi,


Any option in nagios to get those Macros current values.

How many macros can we create in nagios ?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Macros

Post 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.
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.
Locked