Subversion Repositories camp_sysinfo_client_3

Rev

Rev 69 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 69 Rev 153
Line 29... Line 29...
29
                  'uname' => ''
29
                  'uname' => ''
30
               );
30
               );
31
               
31
               
32
# The files/directories the script will use
32
# The files/directories the script will use
33
my %directory = (
33
my %directory = (
34
                  '/proc/cpuinfo' => 0,
34
#                  '/proc/cpuinfo' => 0,
35
                  '/proc/uptime' => 0,
35
                  '/proc/uptime' => 0,
36
                  '/tmp/rodolico' => 0
36
#                  '/tmp/rodolico' => 0
37
                );
37
                );
38
 
38
 
39
# check the commands for validity
39
# check the commands for validity
40
foreach my $command ( keys %commands ) {
40
foreach my $command ( keys %commands ) {
41
   $commands{$command} = &validCommandOnSystem( $command );
41
   $commands{$command} = &validCommandOnSystem( $command );
Line 48... Line 48...
48
 
48
 
49
# category we will use for all values found
49
# category we will use for all values found
50
# see sysinfo for a list of valid categories
50
# see sysinfo for a list of valid categories
51
my $CATEGORY = 'system';
51
my $CATEGORY = 'system';
52
 
52
 
-
 
53
 
-
 
54
# this is now done via dmidecode module
53
# make sure the commands will work before we run them.
55
# make sure the commands will work before we run them.
54
if ( $commands{'awk'} && $commands{'grep'} ) { # we need grep and awk for all these
56
#if ( $commands{'awk'} && $commands{'grep'} ) { # we need grep and awk for all these
55
   print "$CATEGORY\tmemory\t" . &cleanUp('', qx(free | grep Mem | awk '{print \$2}')) . "\n" if $commands{'free'};
57
#   print "$CATEGORY\tmemory\t" . &cleanUp('', qx(free | grep Mem | awk '{print \$2}')) . "\n" if $commands{'free'};
56
   if ( $directory{'/proc/cpuinfo'} ) { # and we need /proc/cpuinfo file for these
58
#   if ( $directory{'/proc/cpuinfo'} ) { # and we need /proc/cpuinfo file for these
57
      print "$CATEGORY\tnum_cpu\t" . &cleanUp('', qx(cat /proc/cpuinfo | grep processor | wc -l | awk '{print \$1}')) . "\n";
59
#      print "$CATEGORY\tnum_cpu\t" . &cleanUp('', qx(cat /proc/cpuinfo | grep processor | wc -l | awk '{print \$1}')) . "\n";
58
      print "$CATEGORY\tcpu_speed\t" . &cleanUp('', qx(cat /proc/cpuinfo | grep MHz | tail -n1 | awk '{print \$4}')) . "\n";
60
#      print "$CATEGORY\tcpu_speed\t" . &cleanUp('', qx(cat /proc/cpuinfo | grep MHz | tail -n1 | awk '{print \$4}')) . "\n";
59
      print "$CATEGORY\tcpu_type\t" . &cleanUp('', qx(cat /proc/cpuinfo | grep vendor_id | tail -n 1 | awk '{print \$3}')) . "\n";
61
#      print "$CATEGORY\tcpu_type\t" . &cleanUp('', qx(cat /proc/cpuinfo | grep vendor_id | tail -n 1 | awk '{print \$3}')) . "\n";
60
   }
62
#   }
61
}
63
#}
62
# all this needs is uname
64
# all this needs is uname
63
print "$CATEGORY\tcpu_sub\t" . &cleanUp('', qx(uname -m)) . "\n" if $commands{'uname'};
65
#print "$CATEGORY\tcpu_sub\t" . &cleanUp('', qx(uname -m)) . "\n" if $commands{'uname'};
64
 
66
 
65
# need /proc/uptime to get the uptime
67
# need /proc/uptime to get the uptime
66
if ( $directory{'/proc/uptime'} ) {
68
if ( $directory{'/proc/uptime'} ) {
67
   my $uptime = qx(cat /proc/uptime);
69
   my $uptime = qx(cat /proc/uptime);
68
   $uptime =~ m/(\d+)/;
70
   $uptime =~ m/(\d+)/;