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.5 by tdb, Sat May 18 18:15:56 2002 UTC

# Line 1 | Line 1
1   #!/usr/bin/perl -w
2  
3 + #
4 + # i-scream central monitoring system
5 + # Copyright (C) 2000-2002 i-scream
6 + #
7 + # This program is free software; you can redistribute it and/or
8 + # modify it under the terms of the GNU General Public License
9 + # as published by the Free Software Foundation; either version 2
10 + # of the License, or (at your option) any later version.
11 + #
12 + # This program is distributed in the hope that it will be useful,
13 + # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 + # GNU General Public License for more details.
16 + #
17 + # You should have received a copy of the GNU General Public License
18 + # along with this program; if not, write to the Free Software
19 + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 + #
21 +
22   #-----------------------------------------------------------------
23   # i-scream host plugin - disk information
24   #     $Author$
# Line 15 | Line 34 | $| = 1;
34   # You'd be silly not to use this ;)
35   use strict;
36  
37 < # Have to hope this will work really.
38 < my($ostype) = `uname -s`; chomp($ostype);
37 > # Exclude list
38 > my($exclude_list) = "^/nfs/;^/cdrom/";
39 > my(@exclude_array) = split(';', $exclude_list);
40  
41 + # Get the OS type from the args, or try towork it out
42 + my($ostype) = $ARGV[0];
43 + $ostype = `uname -s` if not defined $ostype;
44 + chomp($ostype);
45 +
46   # Decide which paths we should use.
47   my($dfbin);
48   if ($ostype eq "SunOS") {
# Line 40 | Line 65 | else {
65   }
66  
67   # Run the following components: -
43 &print_ident();
68   &include_disk();
69  
70   # End the program normally.
# Line 49 | Line 73 | exit(0);
73  
74  
75  
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
76   # sub to print pairs of data, separated by a single space character.
77   # If the second argument is undefined, then the pair is still printed,
78   # however, the value shall be displayed as the the 'default' value
# Line 91 | Line 108 | sub include_disk() {
108          }
109          if ($line =~ /^([^\s]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+[^\s]+\s+(\/[^\s]*)\s*/) {
110              my ($filesystem, $kbytes, $used, $avail, $mount) = ($1, $2, $3, $4, $5);
111 <            &print_pair("unknown", "packet.disk.p$partition_no.attributes.name", $filesystem);
112 <            &print_pair(0, "packet.disk.p$partition_no.attributes.kbytes", $kbytes);
113 <            &print_pair(0, "packet.disk.p$partition_no.attributes.used", $used);
114 <            &print_pair(0, "packet.disk.p$partition_no.attributes.avail", $avail);
115 <            &print_pair("unknown", "packet.disk.p$partition_no.attributes.mount", $mount);
116 <            ++$partition_no;
111 >            my($do_disk) = 1;
112 >            foreach my $exclusion (@exclude_array) {
113 >                if ($mount =~ /$exclusion/) {
114 >                    $do_disk = 0;
115 >                    last;
116 >                }
117 >            }
118 >            if($do_disk) {
119 >                &print_pair("unknown", "packet.disk.p$partition_no.attributes.name", $filesystem);
120 >                &print_pair(0, "packet.disk.p$partition_no.attributes.kbytes", $kbytes);
121 >                &print_pair(0, "packet.disk.p$partition_no.attributes.used", $used);
122 >                &print_pair(0, "packet.disk.p$partition_no.attributes.avail", $avail);
123 >                &print_pair("unknown", "packet.disk.p$partition_no.attributes.mount", $mount);
124 >                ++$partition_no;
125 >            }
126          }
127      }
128      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines