ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/generic/statgrab.pl
(Generate patch)

Comparing projects/cms/source/host/generic/statgrab.pl (file contents):
Revision 1.6 by pjm2, Mon Jan 22 10:03:30 2001 UTC vs.
Revision 1.7 by pjm2, Mon Jan 22 16:28:57 2001 UTC

# Line 68 | Line 68 | sub print_pair($$) {
68   sub include_disk() {
69      
70      # Run the df program.
71 <    my(@df) = `df -a`;
71 >    my(@df) = `df -ak`;
72  
73    # Only look for these partitions at the moment.
74    my(@partition_list) = qw{ / /home /var /tmp };
75
73      # Go through each line of the program, looking for each thing we want.
77    my($scan_for) = '('.join('|', @partition_list).')';
74      my($partition_no) = 0;
75      for (my($i) = 0; $i < $#df; $i++) {
76          my($line) = $df[$i];
77 <        $line =~ /^$scan_for\s*\(([^\s]*)\s*\):\s*([0-9]*)\s*blocks\s*([0-9]*)\s*files/;
77 >        $line =~ /^(\/[^\s]*)\s*([0-9]*)\s*([0-9]*)\s*([0-9]*)\s*[^\s]*\s*(\/[^\s]*)\s*/;
78          # $4 will not match unless everything before it does...
79 <        if (defined $4) {
80 <            my ($partition, $mounted, $blocks, $files) = ($1, $2, $3, $4);
81 <            &print_pair("packet.disk.p$partition_no.attributes.name", $partition);
82 <            &print_pair("packet.disk.p$partition_no.mounted", $mounted);
83 <            &print_pair("packet.disk.p$partition_no.blocks", $blocks);
84 <            &print_pair("packet.disk.p$partition_no.name", $files);
79 >        if (defined $5) {
80 >            my ($filesystem, $kbytes, $used, $avail, $mount) = ($1, $2, $3, $4, $5);
81 >            &print_pair("packet.disk.p$partition_no.attributes.name", $filesystem);
82 >            &print_pair("packet.disk.p$partition_no.attributes.kbytes", $kbytes);
83 >            &print_pair("packet.disk.p$partition_no.attributes.used", $used);
84 >            &print_pair("packet.disk.p$partition_no.attributes.avail", $avail);
85 >            &print_pair("packet.disk.p$partition_no.attributes.mount", $mount);
86              ++$partition_no;
87          }
88      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines