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

[OSSTEST PATCH 3/7] pdu-snmp: Centralise base OIDs



Do not hardcoode .3 and .4 in the main logic.

No functional change.

Signed-off-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 pdu-snmp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pdu-snmp b/pdu-snmp
index 581a60b0..a4918f53 100755
--- a/pdu-snmp
+++ b/pdu-snmp
@@ -27,8 +27,11 @@ use Net::SNMP;
 use Data::Dumper;
 
 my $community= 'private';
+
 my $baseoid= '.1.3.6.1.4.1.318.1.1.4.4.2.1';
 my $baseoid_write= "$baseoid.3";
+my $baseoid_name= "$baseoid.4";
+my $baseoid_read= "$baseoid.3";
 
 while (@ARGV && $ARGV[0] =~ m/^-/) {
     $_ = shift @ARGV;
@@ -52,7 +55,7 @@ die "SNMP error $error " unless defined $session;
 
 sub getname ($) {
     my ($port) = @_;
-    my $oid= "$baseoid.4.$port";
+    my $oid= "$baseoid_name.$port";
     my $res= $session->get_request($oid);
     if ($res) {
         my $name= $res->{$oid};
@@ -96,7 +99,7 @@ if ($outlet =~ m/^\d+$/) {
     ($useport,$usename)= @{ $found[0] };
 }
 
-my $read_oid= "$baseoid.3.$useport";
+my $read_oid= "$baseoid_read.$useport";
 my $write_oid= "$baseoid_write.$useport";
 
 my @map= (undef, qw(
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.