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.20 by tdb, Sun Feb 4 22:38:41 2001 UTC vs.
Revision 1.23 by pjm2, Mon Feb 5 08:27:38 2001 UTC

# Line 131 | Line 131 | sub include_top() {
131  
132      &print_pair(1, "packet.load.load1", $top =~ /load averages:\s*([^\s]+?),/);
133      &print_pair(1, "packet.load.load5", $top =~ /load averages:\s*.+?,\s*([^\s]+?),/);
134 <    &print_pair(1, "packet.load.load15", $top =~ /load averages:\s*.+?,\s*.+?,\s*([^\s]+?)\s.*/);
134 >    &print_pair(1, "packet.load.load15", $top =~ /load averages:\s*.+?,\s*.+?,\s*([^\s]+?)\s+/);
135      &print_pair(1, "packet.processes.total", $top =~ /([^\s]+?) processes:/);
136      &print_pair(1, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/);
137      &print_pair(1, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/);
# Line 193 | Line 193 | sub include_osver() {
193   # sub to get system uptime.
194   sub include_uptime() {
195  
196 +    # grab the uptime
197      my($uptime) = `$uptimebin`;
198 <    $uptime =~ /up ([0-9]+) .*, ([0-9]+:[0-9]+)/;
199 <    $uptime = "$1:$2";
198 >
199 >    # work out the days, hours, and minutes
200 >    if ($uptime =~ /hr/) {
201 >      # 0 minutes
202 >        $uptime =~ s/up ([0-9]+) .*, ([0-9]+) .*,/$1:$2:0/;
203 >    }
204 >    elsif ($uptime =~ /min/) {
205 >      # 0 hours
206 >        $uptime =~ s/up ([0-9]+) .*, ([0-9]+) .*,/$1:0:$2/;
207 >    }
208 >    elsif ($uptime =~ /day/) {
209 >      # normal
210 >        $uptime =~ s/up ([0-9]+) .*, ([0-9]+):([0-9]+)/$1:$2:$3/;
211 >    }
212 >    else {
213 >      # 0 days
214 >        $uptime =~ s/up ([0-9]+):([0-9]+)/0:$1:$2/;
215 >    }
216 >
217 >    # turn into minutes
218 >
219 >    $uptime =~ /([0-9]+):([0-9]+):([0-9]+)/;
220 >    $uptime = $3 + ($2 + $1*24)*60;
221  
222      &print_pair(0, "packet.os.uptime", $uptime);
223  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines