Re: [Nagios-users] check snmp logic

2013-08-29 Thread Jim Avery
On 29 Aug 2013 02:46, Mark Campbell mcc...@psu.edu wrote:

 So I need to utilize some logic in my service checks.

 I have a chiller that if it is not running the discharge temp is not of
 concern.  However if it is running the discharge temp needs to be lower
 than 50 degrees.

 Is there a way to have the check snmp utilize some logic that says if
 running = 0 then ignore discharge temp.  If running = 1 then discharge
 temp must be 50 degrees?

Yes, I did something similar recently where I wanted to check for existence
of an orphaned file only if ftp failed on another server.

The command definition looked like this:

define command {
  command_name check-for-orphan
  command_line   if $USER1$/check_ftp -H $ARG1$ $ARG2$ $USER10$ then
$USER1$/check_multi -s $HOSTADDRESS$ $ARG3$ $USER10$ else exit 0 $USER10$ fi
  register 1
}

Obviously you won't be using check_ftp and check_multi (probably check_snmp
or your own custom plugins instead) but hopefully you can see now how you
can do something similar to run the second check only if the first returns
an ok state (I'm presuming your first check will return an ok state if
running=1 and the second returns ok if temperature  50 degrees).

Where you see $USER10$ here, that refers to a macro in your
/usr/local/nagios/etc/resource.cfg file that gives you a semi-colon like so:

$USER10$=;

It's a bit of a kludge to allow you to have a multi-line command in a
Nagios command definition.

Note that during the time that the first check returns a non-ok state, the
service check will be in an OK state (the exit 0) but will have null
output.  I guess you could put another line with echo something in there
if you want it to say something meaningful.

I hope that makes some sense...

By the way, please don't blame me if this method breaks in some future
version of Nagios - I'm using 3.3.1 on this one.

Cheers,

Jim
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

[Nagios-users] check snmp logic

2013-08-28 Thread Mark Campbell
So I need to utilize some logic in my service checks.

I have a chiller that if it is not running the discharge temp is not of 
concern.  However if it is running the discharge temp needs to be lower 
than 50 degrees.

Is there a way to have the check snmp utilize some logic that says if 
running = 0 then ignore discharge temp.  If running = 1 then discharge 
temp must be 50 degrees?

THe other option I thought of was using dependencies.  Anyone have 
suggestions on that?



--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null