OSSP CVS Repository

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

ossp-pkg/snmpdx/snmpdx.d/hwCpu.pm 1.6 -> 1.7

--- hwCpu.pm     2003/09/09 13:44:04     1.6
+++ hwCpu.pm     2003/09/10 12:29:06     1.7
@@ -37,8 +37,8 @@
     my ($self, $obj) = @_;
 
     if ($self->{-ctx}->{-platform}->id() =~ m/FreeBSD/i) {
-        my $hwCpuNum       = undef;
-        my @hwCpuInfoENTRY = undef; #N/A
+        my $hwCpuNum   = undef;
+        my @hwCpuENTRY = undef; #N/A
 
         #   local workspace
         my $out; my $raw;
@@ -53,8 +53,8 @@
         $obj->{-value} = $hwCpuNum if ($obj->{-name} =~ m/\.hwCpuNum$/);
     }
     elsif ($self->{-ctx}->{-platform}->id() =~ m/Linux/i) {
-        my $hwCpuNum       = undef;
-        my @hwCpuInfoENTRY = undef; #N/A
+        my $hwCpuNum   = undef;
+        my @hwCpuENTRY = undef; #N/A
 
         #   local workspace
         my $out; my $raw;
@@ -71,8 +71,8 @@
         $obj->{-value} = $hwCpuNum if ($obj->{-name} =~ m/\.hwCpuNum$/);
     }
     elsif($self->{-ctx}->{-platform}->id() =~ m/SunOS/i) {
-        my $hwCpuNum       = undef;
-        my @hwCpuInfoENTRY = undef;
+        my $hwCpuNum   = undef;
+        my @hwCpuENTRY = undef;
 
         #   local workspace
         my $out; my $raw; my $arch;
@@ -88,8 +88,10 @@
             foreach $line (split "\n", $raw) {
                 my ($brd,$cpu,$module,$mhz,$mb,$impl,$mask) = split(" ", $line);
                 if ($cpu =~ m/^\d+$/) {
-                    @hwCpuInfoENTRY[$cpu] = {} if (not defined @hwCpuInfoENTRY[$cpu]);
-                    @hwCpuInfoENTRY[$cpu]->{hwCpuSpeed} = $mhz;
+                    $hwCpuENTRY[$cpu] = {} if (not defined $hwCpuENTRY[$cpu]);
+                    $hwCpuENTRY[$cpu]->{hwCpuIndex} = $cpu;
+                    $hwCpuENTRY[$cpu]->{hwCpuId}    = "Cpu_$cpu";
+                    $hwCpuENTRY[$cpu]->{hwCpuSpeed} = $mhz;
                 }
             }
         }
@@ -103,21 +105,24 @@
                 my ($cpu,$temp) = split(" ", $line);
                 if ($cpu =~ m/CPU(\d+)/) {
                     $cpu = $1;
-                    @hwCpuInfoENTRY[$cpu] = {} if (not defined @hwCpuInfoENTRY[$cpu]);
-                    @hwCpuInfoENTRY[$cpu]->{hwCpuTemp} = $temp;
+                    $new->{$cpu} = $cpu;
+                    $hwCpuENTRY[$cpu] = {} if (not defined $hwCpuENTRY[$cpu]);
+                    $hwCpuENTRY[$cpu]->{hwCpuIndex} = $cpu;
+                    $hwCpuENTRY[$cpu]->{hwCpuId}    = "Cpu_$cpu";
+                    $hwCpuENTRY[$cpu]->{hwCpuTemp}  = $temp;
                 }
             }
         }
 
         #   hwCpuNum
-        $hwCpuNum = $#{@hwCpuInfoENTRY} + 1;
+        $hwCpuNum = $#{@hwCpuENTRY} + 1;
         
         $obj->{-value} = $hwCpuNum   if ($obj->{-name} =~ m/\.hwCpuNum$/);
-        if ($obj->{-name} =~ m/\.hwCpuInfoENTRY\.([^.]+)\.(\d+)$/) {
+        if ($obj->{-name} =~ m/\.hwCpuENTRY\.([^.]+)\.(\d+)$/) {
             my $col = $1;
             my $row = ($2 > 0 ? $2 - 1 : 0);
             $self->{-ctx}->{-log}->printf(4, "col=%s row=%s", $col, $row);
-            $obj->{-value} = @hwCpuInfoENTRY[$row]->{$col} if (defined @hwCpuInfoENTRY[$row] and defined @hwCpuInfoENTRY[$row]->{$col});
+            $obj->{-value} = $hwCpuENTRY[$row]->{$col} if (defined $hwCpuENTRY[$row] and defined $hwCpuENTRY[$row]->{$col});
         }
     }
     return;

CVSTrac 2.0.1