Change frequncy Nagios runs some plugins.

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
FaneMSM
Posts: 7
Joined: Wed Mar 07, 2012 3:35 pm

Change frequncy Nagios runs some plugins.

Post by FaneMSM »

Can somebody help me how to change the frequency Nagios runs some plugins. For example: I would like Nagios to run only the check_snmp plugin every one second.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Change frequncy Nagios runs some plugins.

Post by agriffin »

You will need to change interval_length from 60 to 1 in nagios.cfg. This will necessitate changing ALL check_interval values to be measured in seconds rather than minutes. You can then set the check_interval to 1 for your check_snmp service to check every second. Please note that this is probably a bad idea though, and you probably don't really need to be accurate to 1 second.
FaneMSM
Posts: 7
Joined: Wed Mar 07, 2012 3:35 pm

Re: Change frequncy Nagios runs some plugins.

Post by FaneMSM »

Thank you for your fast reply. You made my day1 :D
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Change frequncy Nagios runs some plugins.

Post by agriffin »

Glad I could help!
FaneMSM
Posts: 7
Joined: Wed Mar 07, 2012 3:35 pm

Re: Change frequncy Nagios runs some plugins.

Post by FaneMSM »

Hi,
Do you now if I can convert the result that check_snmp returns??

For example: My check_snmp returns a string "82000000.8" and I would like to convert it into a double because I would like to monitor the change of the result with nagiosgraph.

Thank you in advance,
Stefan
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Change frequncy Nagios runs some plugins.

Post by agriffin »

You could filter it with another program. For example:

Code: Select all

$USER1$/check_snmp opts | sed 's/.*/& | label=&/'
FaneMSM
Posts: 7
Joined: Wed Mar 07, 2012 3:35 pm

Re: Change frequncy Nagios runs some plugins.

Post by FaneMSM »

Please, could you be a little bit more specific ?

for example my command is:

define command{
command_name check_atr
command_line $USER1$/check_snmp -H $HOSTADDRESS -C public iso.3.6.1.4.1.xxxxx
}

and it returns a string like 82048243.7

The other command is:
define command{
command_name check_owd
command_line $USER1$/check_snmp -H $HOSTADDRESS -C public iso.3.6.1.4.1.xxxxx
}

and it returns a string like 0.000123.

And I would like the to return an integer or a double value so I can use nagiosgraph.

Please help me as soon as possible,
Stefan
FaneMSM
Posts: 7
Joined: Wed Mar 07, 2012 3:35 pm

Re: Change frequncy Nagios runs some plugins.

Post by FaneMSM »

Actually the result is:
SNMP OK - "82015315.6" |
SNMP OK - "0.000217" |
FaneMSM
Posts: 7
Joined: Wed Mar 07, 2012 3:35 pm

Re: Change frequncy Nagios runs some plugins.

Post by FaneMSM »

I am sorry for bothering you but I forgot to say that if you can I would like a full example because I am a little newbie with Nagios.
This is a part of my bachelor degree project and I have no idea what to do further and in 4 day I have to finish everything.

IF you want you can reply to my email: [email protected]

Thank you in advance,
Stefan
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Change frequncy Nagios runs some plugins.

Post by agriffin »

As far as I know, you can't "convert" an SNMP string to a double. Instead, I'm suggesting you post-process the check result to add performance data for Nagios to read.

Code: Select all

define command{
    command_name check_atr
    command_line $USER1$/check_snmp -H $HOSTADDRESS -C public iso.3.6.1.4.1.xxxxx | sed 's/.*"\([0-9.-]*\)" |/& | atr=\1/'
}


define command{
    command_name check_owd
    command_line $USER1$/check_snmp -H $HOSTADDRESS -C public iso.3.6.1.4.1.xxxxx | sed 's/.*"\([0-9.-]*\)" |/& | owd=\1/'
}
The sed command transforms the check results into something like this:
SNMP OK - "82015315.6" | atr=82015315.6
SNMP OK - "0.000217" | owd=0.000217
Locked