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

Comparing projects/cms/source/host/ihost-perl/plugins/perl/i-scream_disk.pl (file contents):
Revision 1.1 by tdb, Mon Nov 19 21:42:11 2001 UTC vs.
Revision 1.3 by tdb, Mon Dec 3 15:14:11 2001 UTC

# Line 15 | Line 15 | $| = 1;
15   # You'd be silly not to use this ;)
16   use strict;
17  
18 + # Exclude list
19 + my($exclude_list) = "^/nfs/;^/cdrom/";
20 + my(@exclude_array) = split(';', $exclude_list);
21 +
22   # Have to hope this will work really.
23   my($ostype) = `uname -s`; chomp($ostype);
24  
# Line 83 | Line 87 | sub include_disk() {
87      
88      # Go through each line of the program, looking for each thing we want.
89      my($partition_no) = 0;
90 <    for (my($i) = 0; $i < $#df; $i++) {
90 >    for (my($i) = 0; $i <= $#df; ++$i) {
91          my($line) = $df[$i];
92 <        $line =~ /^([^\s]*)\s*([0-9]*)\s*([0-9]*)\s*([0-9]*)\s*[^\s]*\s*(\/[^\s]*)\s*/;
93 <        # $4 will not match unless everything before it does...
94 <        if (defined $5) {
92 >        if ($line =~ /^[^\s]+\s*$/) {
93 >            ++$i;
94 >            $line .= $df[$i] if defined $df[$i];
95 >        }
96 >        if ($line =~ /^([^\s]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+[^\s]+\s+(\/[^\s]*)\s*/) {
97              my ($filesystem, $kbytes, $used, $avail, $mount) = ($1, $2, $3, $4, $5);
98 <            &print_pair("unknown", "packet.disk.p$partition_no.attributes.name", $filesystem);
99 <            &print_pair(0, "packet.disk.p$partition_no.attributes.kbytes", $kbytes);
100 <            &print_pair(0, "packet.disk.p$partition_no.attributes.used", $used);
101 <            &print_pair(0, "packet.disk.p$partition_no.attributes.avail", $avail);
102 <            &print_pair("unknown", "packet.disk.p$partition_no.attributes.mount", $mount);
103 <            ++$partition_no;
98 >            my($do_disk) = 1;
99 >            foreach my $exclusion (@exclude_array) {
100 >                if ($mount =~ /$exclusion/) {
101 >                    $do_disk = 0;
102 >                    last;
103 >                }
104 >            }
105 >            if($do_disk) {
106 >                &print_pair("unknown", "packet.disk.p$partition_no.attributes.name", $filesystem);
107 >                &print_pair(0, "packet.disk.p$partition_no.attributes.kbytes", $kbytes);
108 >                &print_pair(0, "packet.disk.p$partition_no.attributes.used", $used);
109 >                &print_pair(0, "packet.disk.p$partition_no.attributes.avail", $avail);
110 >                &print_pair("unknown", "packet.disk.p$partition_no.attributes.mount", $mount);
111 >                ++$partition_no;
112 >            }
113          }
114      }
115      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines