salsa has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl -w use strict; use warnings; use diagnostics; use SNMP; ### Equipment Array ### our @Equipment = ( "10.190.16.200", ); ### Equipment Type Hash ### our %EquipmentType = ( "10.190.16.200" => "switch", ); ### Switch MIB Hash ### our %SwitchMIBs = ( "uptime" => "sysUpTime,0", "description" => "sysDescr,0", ); our $uptime; our $snmp; # Main { my $Equipment; foreach $Equipment(@Equipment) { if ($EquipmentType{$Equipment} =~ "switch") { $snmp = new SNMP::Session(DestHost=> "$Equipment", Community => 'emacs2000', ); $uptime=$snmp->get("$SwitchMIBs{uptime}"); printf ("Uptime for $Equipment is $uptime\n"); } } exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Conveting SNMP-returned ticks to
by DrManhattan (Chaplain) on Nov 26, 2001 at 23:53 UTC | |
by salsa (Acolyte) on Nov 27, 2001 at 01:03 UTC | |
by DrManhattan (Chaplain) on Nov 27, 2001 at 01:35 UTC | |
by salsa (Acolyte) on Nov 27, 2001 at 01:44 UTC |