package VAdmind::Plugins::System::Hardware; use strict; use warnings; =head2 getCPU Retrieve the current hardware CPU information. =cut sub getCPU { my $self = shift; my $out = $self->{'out'}; my $file = '/proc/cpuinfo'; my %data = ( 'vendor_id' => 1, 'model name' => 1, 'cpu MHz' => 1, 'cache size' => 1, 'bogomips' => 1, 'flags' => 1, 'cpu family' => 1 ); my $fo = open (FH, $file); if (!$fo) { $out->{'error'} = 'Can\'t open file '.$file.': '.$!; } else { while () { chomp; if (! $_ =~ /^$/) { $_ =~ s/\t//g; $_ =~ s/ */ /g; my ($name, $value) = split (/:/, $_); if (defined $data{$name}) { $name =~ s/ /_/g; $out->{'xml'}->{$name}->[0] = $value; } } } close (FH); } } 1;