OSSP CVS Repository

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

ossp-pkg/snmpdx/snmpdx.d/hwDisk.pm 1.3 -> 1.4

--- hwDisk.pm    2003/09/09 13:44:04     1.3
+++ hwDisk.pm    2003/09/10 12:29:06     1.4
@@ -37,13 +37,14 @@
     my ($self, $obj) = @_;
 
     if ($self->{-ctx}->{-platform}->id() =~ m/FreeBSD/i) {
-        my @hwDiskInfoENTRY = undef; #N/A
+        my @hwDiskENTRY = undef; #N/A
     }
     elsif ($self->{-ctx}->{-platform}->id() =~ m/Linux/i) {
-        my @hwDiskInfoENTRY = undef; #N/A
+        my @hwDiskENTRY = undef; #N/A
     }
     elsif($self->{-ctx}->{-platform}->id() =~ m/SunOS/i) {
-        my @hwDiskInfoENTRY = undef;
+        my @hwDiskENTRY = 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();
 
-        #   hwDiskInfoENTRY
+        #   hwDiskENTRY
         $out = $self->{-ctx}->{-sys}->run("/usr/platform/$arch/sbin/prtdiag -v", "1m");
         $raw = $out->{-stdout};
         if ($raw =~ m/\n=+ Environmental Status =+\n.*\nDisk LED Status:[^\n]+\n(.*?)\n=+/s) {
@@ -61,23 +62,24 @@
             foreach $line (split "\n", $raw) {
                 if ($line =~ m/DISK\s+(\d+)\s+(OK|ERROR)/) {
                     my $new = {};
-                    $new->{hwDiskId} = "DISK$1";
+                    $new->{hwDiskIndex} = $n;
+                    $new->{hwDiskId}    = "Disk_$1";
                     if ($2 =~ m/^OK$/) {
                         $new->{hwDiskStatus} = 1;
                     }
                     else {
                         $new->{hwDiskStatus} = 0;
                     }
-                    push(@hwDiskInfoENTRY, $new);
+                    $hwDiskENTRY[$n++] = $new;
                 }
             }
         }
 
-        if ($obj->{-name} =~ m/\.hwDiskInfoENTRY\.([^.]+)\.(\d+)$/) {
+        if ($obj->{-name} =~ m/\.hwDiskENTRY\.([^.]+)\.(\d+)$/) {
             my $col = $1;
             my $row = ($2 > 0 ? $2 - 1 : 0);
             $self->{-ctx}->{-log}->printf(4, "col=%s row=%s", $col, $row);
-            $obj->{-value} = @hwDiskInfoENTRY[$row]->{$col} if (defined @hwDiskInfoENTRY[$row] and defined @hwDiskInfoENTRY[$row]->{$col});
+            $obj->{-value} = $hwDiskENTRY[$row]->{$col} if (defined $hwDiskENTRY[$row] and defined $hwDiskENTRY[$row]->{$col});
         }
     }
     return;

CVSTrac 2.0.1