OSSP CVS Repository

ossp - Difference in ossp-pkg/snmpdx/snmpdx.d/hwPs.pm versions 1.2 and 1.3
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/snmpdx/snmpdx.d/hwPs.pm 1.2 -> 1.3

--- hwPs.pm      2003/09/09 13:44:04     1.2
+++ hwPs.pm      2003/09/10 12:29:06     1.3
@@ -37,13 +37,14 @@
     my ($self, $obj) = @_;
 
     if ($self->{-ctx}->{-platform}->id() =~ m/FreeBSD/i) {
-        my @hwPsInfoENTRY = undef; #N/A
+        my @hwPsENTRY = undef; #N/A
     }
     elsif ($self->{-ctx}->{-platform}->id() =~ m/Linux/i) {
-        my @hwPsInfoENTRY = undef; #N/A
+        my @hwPsENTRY = undef; #N/A
     }
     elsif($self->{-ctx}->{-platform}->id() =~ m/SunOS/i) {
-        my @hwPsInfoENTRY = undef;
+        my @hwPsENTRY = undef;
+        my $n = 0;
 
         #   local workspace
         my $out; my $raw; my $arch; my $new;
@@ -51,7 +52,7 @@
         #   initialize arch
         $arch = $self->{-ctx}->{-platform}->arch();
 
-        #   hwPsInfoENTRY
+        #   hwPsENTRY
         $out = $self->{-ctx}->{-sys}->run("/usr/platform/$arch/sbin/prtdiag -v", "1m");
         $raw = $out->{-stdout};
         if ($raw =~ m/\n=+ Environmental Status =+\n.*\nPower Supplies:[^\n]*\n(.*?)\n=+/s) {
@@ -59,23 +60,24 @@
             foreach $line (split "\n", $raw) {
                 if ($line =~ m/(\d+)\s+(OK|ERROR)/) {
                     my $new = {};
-                    $new->{hwPsId} = "PS$1";
+                    $new->{hwPsIndex} = $n;
+                    $new->{hwPsId}    = "Powersupply_$1";
                     if ($2 =~ m/^OK$/) {
                         $new->{hwPsStatus} = 1;
                     }
                     else {
                         $new->{hwPsStatus} = 0;
                     }
-                    push(@hwPsInfoENTRY, $new);
+                    $hwPsENTRY[$n++] = $new;
                 }
             }
         }
 
-        if ($obj->{-name} =~ m/\.hwPsInfoENTRY\.([^.]+)\.(\d+)$/) {
+        if ($obj->{-name} =~ m/\.hwPsENTRY\.([^.]+)\.(\d+)$/) {
             my $col = $1;
             my $row = ($2 > 0 ? $2 - 1 : 0);
             $self->{-ctx}->{-log}->printf(4, "col=%s row=%s", $col, $row);
-            $obj->{-value} = @hwPsInfoENTRY[$row]->{$col} if (defined @hwPsInfoENTRY[$row] and defined @hwPsInfoENTRY[$row]->{$col});
+            $obj->{-value} = $hwPsENTRY[$row]->{$col} if (defined $hwPsENTRY[$row] and defined $hwPsENTRY[$row]->{$col});
         }
     }
     return;

CVSTrac 2.0.1