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

 

     [snips-users] snmpgeneric not showing variable name

I've seen several messages from others having this problem, but no
talk about the solution.  I wrestled with it for a day, and I think it's
a PERL issue more subtle than I can follow.  That said. this clumsy
patch works for me:

*** snmpgeneric Mon Jul 9 00:33:21 2001
--- /usr/local/snips/bin/snmpgeneric Mon Jan 21 09:52:37 2002
***************
*** 1,6 ****
! #!/usr/local/bin/perl
##
# $Header: /home/vikas/src/snips/perl-monitors/RCS/snmpgeneric,v 1.0 2001/07/09 04:33:20 vikas Exp $
#
# snmpgeneric - perl monitor for generic SNMP variables.
# Directly monitors SNMP variables from the hosts listed.
--- 1,7 ----
! #!/usr/bin/perl
##
# $Header: /home/vikas/src/snips/perl-monitors/RCS/snmpgeneric,v 1.0 2001/07/09 04:33:20 vikas Exp $
+ # ERM variation: 1.0-1 21-Jan-2002
#
# snmpgeneric - perl monitor for generic SNMP variables.
# Directly monitors SNMP variables from the hosts listed.
***************
*** 40,46 ****
);


  BEGIN {
!   $snipsroot = "/usr/local/snips"  unless $snipsroot; # SET_THIS
    push (@INC, "$snipsroot/etc"); push (@INC, "$snipsroot/bin");
    require "snipsperl.conf" ;          # local customizations
  }
--- 41,47 ----
            );

  BEGIN {
!   $snipsroot =  "/usr/local/snips"   unless $snipsroot;       # SET_THIS
    push (@INC, "$snipsroot/etc"); push (@INC, "$snipsroot/bin");
    require "snipsperl.conf" ;          # local customizations
  }
***************
*** 61,66 ****
--- 62,68 ----

  $numtries = 2;   # number of times to try and connect before failing
  $debug = 0;                           # set to 1 for debugging output
+ $libdebug = 0;
  $varunits="snmp" ;                    # the var.units field in EVENT
struct
  $s_pollinterval= 60*5;                # Seconds to sleep between tries.

***************
*** 75,80 ****
--- 77,83 ----
    my $lineno = 0;
    my $count = 0;
    my $event = new_event();
+   my $buffer = "BOGUS";

    if ($debug == 0 && $libdebug > 0) {
      ++$debug ; --$libdebug;
***************
*** 83,89 ****

open(CONFIG,"<$s_configfile")||die("Couldn't find $s_configfile, exiting");
my $datafd = open_datafile($s_datafile, "w");
! alter_event($event, $s_sender, undef, undef, undef, undef, $varunits);
undef @deviceip; undef @oid; undef @comp ;
undef @wlevel; undef @elevel; undef @clevel;


--- 86,92 ----

open(CONFIG,"<$s_configfile")||die("Couldn't find $s_configfile, exiting");
my $datafd = open_datafile($s_datafile, "w");
! #alter_event($event, $s_sender, undef, undef, undef, undef,
$varunits);
undef @deviceip; undef @oid; undef @comp ;
undef @wlevel; undef @elevel; undef @clevel;


***************
*** 108,114 ****
my ($ip, $port) = split(/:/, $2, 2);
($deviceip[$count] , $oid[$count] , $community[$count]) = ($ip, $3, $5);
($wlevel[$count] , $elevel[$count] , $clevel[$count]) = ($6, $7,
$8);
! alter_event($event, undef, $1, $ip, undef, $4, undef);
write_event($datafd, $event);
next;
}
--- 111,119 ----
my ($ip, $port) = split(/:/, $2, 2);
($deviceip[$count] , $oid[$count] , $community[$count]) = ($ip, $3, $5);
($wlevel[$count] , $elevel[$count] , $clevel[$count]) = ($6, $7,
$8);
! #alter_event($event, undef, $1, $ip, undef, $4, undef);
! $buffer = $4;
! alter_event($event, $s_sender, $1, $ip, undef, $buffer,
$varunits);
write_event($datafd, $event);
next;
}
***************
*** 120,126 ****
($deviceip[$count] , $oid[$count] , $community[$count]) = ($ip, $3, $5);
($wlevel[$count] , $elevel[$count] , $clevel[$count]) = ($6, $7,
$8);
$comp[$count] = $9; # comparison regex
! alter_event($event, undef, $1, $ip, undef, $4, undef);
write_event($datafd, $event);
next;
}
--- 125,133 ----
($deviceip[$count] , $oid[$count] , $community[$count]) = ($ip, $3, $5);
($wlevel[$count] , $elevel[$count] , $clevel[$count]) = ($6, $7,
$8);
$comp[$count] = $9; # comparison regex
! #alter_event($event, undef, $1, $ip, undef, $4, undef);
! $buffer = $4;
! alter_event($event, $s_sender, $1, $ip, undef, $buffer,
$varunits);
write_event($datafd, $event);
next;
}


Hope this helps others out in the world. I may soon adjust snmpgeneric so units can
be listed in the configuration file, and will send that along if I do.


Evan R. Moore
IniNet, Inc.
emoore at ininet com

Zyrion Traverse Network Monitoring & Network Management Software