OSSP CVS Repository

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

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

--- hwFan.pm     2003/09/09 13:44:04     1.2
+++ hwFan.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 @hwFanInfoENTRY = undef; #N/A
+        my @hwFanENTRY = undef; #N/A
     }
     elsif ($self->{-ctx}->{-platform}->id() =~ m/Linux/i) {
-        my @hwFanInfoENTRY = undef; #N/A
+        my @hwFanENTRY = undef; #N/A
     }
     elsif($self->{-ctx}->{-platform}->id() =~ m/SunOS/i) {
-        my @hwFanInfoENTRY = undef;
+        my @hwFanENTRY = 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();
 
-        #   hwFanInfoENTRY
+        #   hwFanENTRY
         $out = $self->{-ctx}->{-sys}->run("/usr/platform/$arch/sbin/prtdiag -v", "1m");
         $raw = $out->{-stdout};
         if ($raw =~ m/\n=+ Environmental Status =+\n.*\nFan Bank.:[^\n]*\n(.*?)\n=+/s) {
@@ -59,7 +60,8 @@
             foreach $line (split "\n", $raw) {
                 if ($line =~ m/([A-Z]+)\s+(\d+)\s+(OK|ERROR)/) {
                     my $new = {};
-                    $new->{hwFanId} = "$1";
+                    $new->{hwFanIndex} = $n;
+                    $new->{hwFanId}    = "Fan_$1";
                     $new->{hwFanSpeed} = "$2";
                     if ($3 =~ m/^OK$/) {
                         $new->{hwFanStatus} = 1;
@@ -67,16 +69,16 @@
                     else {
                         $new->{hwFanStatus} = 0;
                     }
-                    push(@hwFanInfoENTRY, $new);
+                    $hwFanENTRY[$n++] = $new;
                 }
             }
         }
 
-        if ($obj->{-name} =~ m/\.hwFanInfoENTRY\.([^.]+)\.(\d+)$/) {
+        if ($obj->{-name} =~ m/\.hwFanENTRY\.([^.]+)\.(\d+)$/) {
             my $col = $1;
             my $row = ($2 > 0 ? $2 - 1 : 0);
             $self->{-ctx}->{-log}->printf(4, "col=%s row=%s", $col, $row);
-            $obj->{-value} = @hwFanInfoENTRY[$row]->{$col} if (defined @hwFanInfoENTRY[$row] and defined @hwFanInfoENTRY[$row]->{$col});
+            $obj->{-value} = $hwFanENTRY[$row]->{$col} if (defined $hwFanENTRY[$row] and defined $hwFanENTRY[$row]->{$col});
         }
     }
     return;

CVSTrac 2.0.1