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.2 by tdb, Sun Nov 25 20:33:18 2001 UTC vs.
Revision 1.4 by tdb, Tue Dec 18 04:07:17 2001 UTC

# Line 15 | Line 15 | $| = 1;
15   # You'd be silly not to use this ;)
16   use strict;
17  
18 < # Have to hope this will work really.
19 < my($ostype) = `uname -s`; chomp($ostype);
18 > # Exclude list
19 > my($exclude_list) = "^/nfs/;^/cdrom/";
20 > my(@exclude_array) = split(';', $exclude_list);
21  
22 + # Get the OS type from the args, or try towork it out
23 + my($ostype) = $ARGV[0];
24 + $ostype = `uname -s` if not defined $ostype;
25 + chomp($ostype);
26 +
27   # Decide which paths we should use.
28   my($dfbin);
29   if ($ostype eq "SunOS") {
# Line 40 | Line 46 | else {
46   }
47  
48   # Run the following components: -
43 &print_ident();
49   &include_disk();
50  
51   # End the program normally.
# Line 49 | Line 54 | exit(0);
54  
55  
56  
52 # prints out an identifier for this version of the script
53 # this could be used in checks further downstream
54 sub print_ident() {
55    print 'packet.plugins.ident.i-scream_disk i-scream_disk.pl $Revision$';
56    print "\n";
57 }
58
57   # sub to print pairs of data, separated by a single space character.
58   # If the second argument is undefined, then the pair is still printed,
59   # however, the value shall be displayed as the the 'default' value
# Line 91 | Line 89 | sub include_disk() {
89          }
90          if ($line =~ /^([^\s]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+[^\s]+\s+(\/[^\s]*)\s*/) {
91              my ($filesystem, $kbytes, $used, $avail, $mount) = ($1, $2, $3, $4, $5);
92 <            &print_pair("unknown", "packet.disk.p$partition_no.attributes.name", $filesystem);
93 <            &print_pair(0, "packet.disk.p$partition_no.attributes.kbytes", $kbytes);
94 <            &print_pair(0, "packet.disk.p$partition_no.attributes.used", $used);
95 <            &print_pair(0, "packet.disk.p$partition_no.attributes.avail", $avail);
96 <            &print_pair("unknown", "packet.disk.p$partition_no.attributes.mount", $mount);
97 <            ++$partition_no;
92 >            my($do_disk) = 1;
93 >            foreach my $exclusion (@exclude_array) {
94 >                if ($mount =~ /$exclusion/) {
95 >                    $do_disk = 0;
96 >                    last;
97 >                }
98 >            }
99 >            if($do_disk) {
100 >                &print_pair("unknown", "packet.disk.p$partition_no.attributes.name", $filesystem);
101 >                &print_pair(0, "packet.disk.p$partition_no.attributes.kbytes", $kbytes);
102 >                &print_pair(0, "packet.disk.p$partition_no.attributes.used", $used);
103 >                &print_pair(0, "packet.disk.p$partition_no.attributes.avail", $avail);
104 >                &print_pair("unknown", "packet.disk.p$partition_no.attributes.mount", $mount);
105 >                ++$partition_no;
106 >            }
107          }
108      }
109      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines