check snmp logic
Ben Sykes
ben.sykes at transpire.com.au
Thu Aug 29 04:02:32 CEST 2013
Do you mean you want to check the result of one OID and make that treat
another OID's values differently?
Personally if I faced that problem - I would probably code a custom check
in Bash using snmpget from snmputils that did some nested If statements, or
use Net::SNMP from Perl and check it that way. Quite simple to write a
Nagios plugin - it's all about the exit values - 0 is OK, 1 is Warning, 2
is Critical, 3 is Unknown.
You may be able to use warning states generated by the first to define a
dependency on the second but it will be complicated to change the
thresholds dynamically via that method, at best you'd be able to suppress a
warning or other state from the 2nd but you couldn't have differential
thresholds between the two states of the first service without some work or
hackery (e.g. having an event trigger fire off that changes the
configuration file and reloads nagios)
I would just code it into a plugin (assuming you or someone on your team
can code)
Something like this perl pseudo code...
use Net::SNMP;
$snmp = Net::SNMP->session(-hostname => $ipaddress, -community => "public",
-version => 'snmpv2c');
@oids = qw/1.2.3.4 1.2.3.5/;
$res = $snmp->get_request(-varbindlist => \@oids);
unless(defined($res))
{
print "UNKNOWN - no response\n";
exit(3);
}
$firstoidval = $res->{$oids[0]};
$secondoidval = $res->{$oids[1]};
if ($firstoidval == 1) #running?
{
if ($secondoidval > 50) { print "CRITICAL - running and temp above
critical threshold"; exit(2); }
if ($secondoidval > 45) { print "WARNING"; exit(1); }
else { print "OK"; exit(0): }
}
elsif ($firstoidval == 0) #notrunning?
{
if ($secondoidval > 40) { print "CRITICAL"; exit(2); }
if ($secondoidval > 35) { print "WARNING"; exit(1); }
else { print "OK"; exit(0): }
}
Logic probably differs a bit, but you get the gist...
Cheers
Ben
ben sykes
consultant
m. +61 404 308 201
e. ben.sykes at transpire.com.auimage:
On Thu, Aug 29, 2013 at 11:27 AM, Mark Campbell <mcc171 at 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?
>
> 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=58040911&iu=/4140/ostg.clktrk
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at 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
>
legal disclaimer:
This email, including any attachments, may be confidential or privileged, and is sent for the personal attention of the intended recipient. If you have received this email in error, please delete it immediately. The views expressed are not necessarily those of Transpire Pty Ltd. Transpire is not liable for the effects of any virus which may be contained in this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20130829/4ef9fc7b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RSImage.png
Type: image/png
Size: 8044 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20130829/4ef9fc7b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RSImage.png
Type: image/png
Size: 2554 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20130829/4ef9fc7b/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RSImage.png
Type: image/png
Size: 6690 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20130829/4ef9fc7b/attachment-0002.png>
-------------- next part --------------
------------------------------------------------------------------------------
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=58040911&iu=/4140/ostg.clktrk
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at 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
More information about the Users
mailing list