BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: {bb} SNMP - a little off-topic



> This is a little off-topic....I'm not sure how to get started 
> handling SNMP traps without something like OpenView or some 
> other high-dollar management suite.  I know that on my linux box, 
> I can run snmptrapd and get traps displayed on the screen when 
> they are sent their from a machine that's set up to sent traps there.
> 
> Now what do I do?  There has got to be something out there that 
> will capture these traps and do something inteligent with them.  
> I'm sure it just takes a script or some little daemon or something 
> stupid but I can't get started.

Keeping in the spirit of bb, what I would do is write a script
(probably in PERL because that's what I know best -- sorry folks) 
that takes as its input the output of your "snmptrapd" and 
mashes it up a bit and then runs the "bb" command to send this info 
to your BBDISPLAY system.

Assuming your log message are roughly of the format:
(I pulled this from the man page for the CMU SNMP package)

Sep 17 22:39:52 suffern snmptrapd: 128.2.13.41: Cold Start Trap (0) Uptime:
8 days, 0:35:46

Then this would just about do the trick:

#!/usr/bin/perl
die "BB not defined in env" unless defined $ENV{'BB'};
die "BBDISP not defined in env" unless defined $ENV{'BBDISP'};
while(defined($line=<STDIN>)) {
    ( $loginfo, $node, $msg ) = split /:/, $line, 3;
    system "$ENV{'BB'} $ENV{'BBDISP'} \"status $node.snmp red $msg\"";
}

I'm sure you could do the same in a sh script quite easily
if you prefer sh over perl.  I just use perl because it's
easier for me.

-- Travis 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Please send mail for the mailing list to: bb@taex001.tamu.edu
  To [un]subscribe to this list, send e-mail to majordomo@taex001.tamu.edu
     with [un]subscribe bb in the BODY of the message.
  Please contact the mailing-list-owner as: bb-owner@taex001.tamu.edu


Home | Main Index | Thread Index