MIB for Nagios

Don Badrak dbadrak at tco.census.gov
Fri Jun 13 16:01:46 CEST 2003


Stanley, Subhendu,

On Fri, 13 Jun 2003, Stanley Hopcroft wrote:

> Dear Sir,
>
> I am writing to thank you for your lhetter and ask, please for the
> benefit of the less literate SNMP folks around (such as YT),
>
> On Thu, Jun 12, 2003 at 01:32:07PM -0400, Subhendu Ghosh wrote:
> > On Thu, 12 Jun 2003, Don Badrak wrote:
> >
> > > What I've been asked to do now is find a way to put Nagios notifications
> > > into OVO.  I can do it through snmp traps.  My plan is to use a global
> > > event handler in perl which uses the Net::SNMP modules to send an SNMP
> > > trap.
> >
> >
> > There is no official MIB for nagios. Rather than writing a complete mib
> > consider just writing a trap definition.  VarBinds you want to pass should
> > be the ones that are visible for event handlers (specially if you enable
> > state tracking).
> >
>
> would you care to elabourate (amplify) on your answer ?

Yeah, my sentiments exactly.  I partly understand, but this hit above my
level of SNMP knowledge.

> How would Open View understand the trap without a MIB ?

You have to have some kind of OID to pass it.  You can either make them up
(not quite a good idea), or get an official Enterprise OID from IANA.
That's why I asked about an official Nagios MIB.

> Will Open View accept _any_ trap and act on it - if configured to do so
> ?

It seems so, from my testing.  I don't know OVO, but our people here
configured it to accept the OID I sent, and mapped it to something.  They
got the event.  I guess then one configures it to do something.

I used this simple example to send to our OVO machine:

===
#!/usr/local/bin/perl

use Net::SNMP;

my $localaddress="192.168.100.1";
my $manager="managerhost";

($session,$error) = Net::SNMP->session
(
   -hostname    => $manager,
   -community   => $community || 'public',
   -port        => 162
);

if (!defined($session))
{
   printf("ERROR creating session: %s.\n", $error);
   exit 1;
}

my $census="1.3.6.1.4.1.7112.1.6";
my $http="$census.1.1.3.80";

$result=$session->trap
(
   -enterprise          => $http,
   -agentaddr           => $localaddress,
   -specifictrap        => 1,
   -varbindlist         => [$http,INTEGER,5]
);

if (!defined($result))
{
   printf("ERROR sending trap: %s.\n", $session->error);
   $session->close;
   exit 1;
}
===

This resulted in the trap on OVO:

- Normal Thu Jun 05 17:38:33  192.168.100.1 EnterpriseDefault
(Ref #55) Received event .1.3.6.1.4.1.7112.1.6.1.1.3.80.0.1
(enterprise:.1.3.6.1.4.1.7112.1.6.1.1.3.80 generic:6 specific:1), no format
in trapd.conf. 1 args: [1] private.enterprises.7112.1.6.1.1.3.80 (Integer): 5

> > If considering the MIB, use tables for hosts, services, comment and
> > downtime (all things that have log entries and state).

So, something like:

	1.3.6.1.4.1.X (where X is a Nagios Enterprise number, or your own
Enterprise number):

	hostTable
	   hostEntry
 	      hostName
	      hostAlias
	      hostAddress
	      hostParents
	      hostStateType		( SOFT | HARD )
	      hostState		 	( OK | WARNING | UP | DOWN | UNREACHABLE | RECOVERY )

	serviceTable
	   serviceEntry
              hostName
	      serviceDescription
	      serviceStateType		( SOFT | HARD )
	      serviceState		( OK | WARNING | CRITICAL | UNKNOWN )

	commentTable
	   commentEntry
	      commentType		( HOST | SERVICE )
	      hostName
	      serviceDescription
	      entryTime
	      author
	      commentText
	      commentId
	      persistent		( NO | YES )

	downtimeTable
	   downtimeEntry
	      downtimeType		( HOST | SERVICE )
	      hostName
	      serviceDescription
	      entryTime
	      author
	      commentText
	      startTime
	      endTime
	      fixed			( NO | YES )
	      duration

This is just a quick stab at it.  I'd have to read up some more on properly defining
MIBS and such.

> Perhaps the general question is that if you have an 'Enterprise
> Management System' such as Tivoli, Open View and friends, how does one
> notify it - given that all of these things only understand _one_ IPC
> method, namely SNMP traps, of a problem that Nagios detects ?

It looks like I'll be doing just this.  I know nearly nothing about the
large-scale EMS stuff, but I could pass along config options for OVO and how to
make Nagios integrate.  It does some things better than OVO (and it's easier
to get working).

Don
-- 
Don Badrak <dbadrak at census.gov>              301.763.5534 work
Telecommunications Office                    301.457.4438 fax
U.S. Bureau of the Census
Suitland MD, USA




-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
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