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.32 by tdb, Tue Feb 13 11:57:48 2001 UTC vs.
Revision 1.35 by tdb, Wed Feb 28 12:26:36 2001 UTC

# Line 109 | Line 109 | sub include_disk() {
109      my($partition_no) = 0;
110      for (my($i) = 0; $i < $#df; $i++) {
111          my($line) = $df[$i];
112 <        $line =~ /^(\/[^\s]*)\s*([0-9]*)\s*([0-9]*)\s*([0-9]*)\s*[^\s]*\s*(\/[^\s]*)\s*/;
112 >        $line =~ /^([^\s]*)\s*([0-9]*)\s*([0-9]*)\s*([0-9]*)\s*[^\s]*\s*(\/[^\s]*)\s*/;
113          # $4 will not match unless everything before it does...
114          if (defined $5) {
115              my ($filesystem, $kbytes, $used, $avail, $mount) = ($1, $2, $3, $4, $5);
# Line 225 | Line 225 | sub include_top() {
225          $swap_free*=1024 if $2 eq "G";
226          &print_pair(0, "packet.swap.free", $swap_free);
227      }
228 +    elsif ($ostype eq "Linux") {
229 +        &print_pair(0, "packet.processes.total", $top =~ /([^\s]+?) processes:/);
230 +        &print_pair(0, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/);
231 +        &print_pair(0, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/);
232 +        &print_pair(0, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/);
233 +        &print_pair(0, "packet.processes.cpu", $top =~ /([^\s]+?)\s*running/);
234 +        &print_pair(0, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/);
235 +        &print_pair(0, "packet.cpu.user", $top =~ /([^\s]+?)% user/);
236 +        &print_pair(0, "packet.cpu.kernel", $top =~ /([^\s]+?)% system/);
237 +        &print_pair(0, "packet.cpu.iowait", $top =~ /([^\s]+?)% interrupt/);
238 +        &print_pair(0, "packet.cpu.swap", $top =~ /([^\s]+?)% swap/);
239 +        
240 +        # The following need to be specified in megabytes.
241 +        # If they are preceeded by a G, then multiply by 1024.  
242 +        
243 +        $top =~ / ([^\s]+?)([KMG]) av/;
244 +        my($real) = $1;
245 +        $real*=1024 if $2 eq "G";
246 +        $real/=1024 if $2 eq "K";
247 +        &print_pair(0, "packet.memory.total", int($real));
248 +        
249 +        $top =~ / ([^\s]+?)([KMG]) free/;
250 +        my($free) = $1;
251 +        $free*=1024 if $2 eq "G";
252 +        $free/=1024 if $2 eq "K";
253 +        &print_pair(0, "packet.memory.free", int($free));
254 +        
255 +        $top =~ /Swap:\s+([^\s]+?)([KMG]) av/;
256 +        my($swap_total) = $1;
257 +        $swap_total*=1024 if $2 eq "G";
258 +        $swap_total/=1024 if $2 eq "K";
259 +        &print_pair(0, "packet.swap.total", int($swap_total));
260 +        
261 +        $top =~ /Swap:.*, ([^\s]+?)([KMG]) free/;
262 +        my($swap_free) = $1;
263 +        $swap_free*=1024 if $2 eq "G";
264 +        $swap_free/=1024 if $2 eq "K";
265 +        &print_pair(0, "packet.swap.free", int($swap_free));
266 +    }
267      else {
268          # we could have some catchall here
269 +        # but as it stands this means we'll just skip top stuff
270 +        # for unknown systems
271      }
272   }
273  
# Line 281 | Line 322 | sub include_uptime() {
322  
323      if ($uptime =~ /day.*,\s+([0-9]+):([0-9]+)/) {
324        # normal
325 <        $uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+):([0-9]+)/;
325 >        $uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+):([0-9]+)/;
326          $uptime = "$1:$2:$3";
327      }
328      else {
329          if ($uptime =~ /day/) {
330              if ($uptime =~ /hr/) {
331                # 0 minutes
332 <                $uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+)\s+.*,/;
332 >                $uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+)\s+[^\s]+,/;
333                  $uptime = "$1:$2:0";
334              }
335              elsif ($uptime =~ /min/) {
336                # 0 hours
337 <                $uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+)\s+.*,/;
337 >                $uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+)\s+[^\s]+,/;
338                  $uptime = "$1:0:$2";
339              }
340              else {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines