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.39 by tdb, Mon Mar 19 22:38:20 2001 UTC vs.
Revision 1.40 by tdb, Mon Mar 19 23:05:55 2001 UTC

# Line 153 | Line 153 | sub include_top() {
153      $top =~ s/\n//g;
154  
155      if($ostype eq "SunOS") {
156 <        &print_pair(0, "packet.processes.total", $top =~ /([^\s]+?) processes:/);
157 <        &print_pair(0, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/);
158 <        &print_pair(0, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/);
159 <        &print_pair(0, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/);
160 <        &print_pair(0, "packet.processes.cpu", $top =~ /([^\s]+?)\s*on cpu/);
156 >        &print_pair(0, "packet.processes.total", $top =~ /([0-9]+?) processes:/);
157 >        &print_pair(0, "packet.processes.sleeping", $top =~ /([0-9]+?) sleeping/);
158 >        &print_pair(0, "packet.processes.zombie", $top =~ /([0-9]+?) zombie/);
159 >        &print_pair(0, "packet.processes.stopped", $top =~ /([0-9]+?) stopped/);
160 >        &print_pair(0, "packet.processes.cpu", $top =~ /([0-9]+?)\s*on cpu/);
161          &print_pair(0, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/);
162          &print_pair(0, "packet.cpu.user", $top =~ /([^\s]+?)% user/);
163          &print_pair(0, "packet.cpu.kernel", $top =~ /([^\s]+?)% kernel/);
# Line 167 | Line 167 | sub include_top() {
167          # The following need to be specified in megabytes.
168          # If they are preceeded by a G, then multiply by 1024.  
169          
170 <        $top =~ /([^\s]+?)([KMG]) real/;
170 >        $top =~ /([0-9]+?)([KMG]) real/;
171          my($real) = $1;
172          $real*=1024 if $2 eq "G";
173          $real/=1024 if $2 eq "K";
174          &print_pair(0, "packet.memory.total", $real);
175          
176 <        $top =~ /([^\s]+?)([KMG]) free/;
176 >        $top =~ /([0-9]+?)([KMG]) free/;
177          my($free) = $1;
178          $free*=1024 if $2 eq "G";
179          $free/=1024 if $2 eq "K";
180          &print_pair(0, "packet.memory.free", $free);
181          
182 <        $top =~ /([^\s]+?)([KMG]) swap in use/;
182 >        $top =~ /([0-9]+?)([KMG]) swap in use/;
183          my($swap_in_use) = $1;
184          $swap_in_use*=1024 if $2 eq "G";
185          $swap_in_use/=1024 if $2 eq "K";
186          # DO NOT print this one out... save it for in a moment...
187          
188 <        $top =~ /([^\s]+?)([KMG]) swap free/;
188 >        $top =~ /([0-9]+?)([KMG]) swap free/;
189          my($swap_free) = $1;
190          $swap_free*=1024 if $2 eq "G";
191          $swap_free/=1024 if $2 eq "K";
# Line 195 | Line 195 | sub include_top() {
195          &print_pair(0, "packet.swap.total", $swap_free + $swap_in_use);
196      }
197      elsif ($ostype eq "FreeBSD") {
198 <        &print_pair(0, "packet.processes.total", $top =~ /([^\s]+?) processes:/);
199 <        &print_pair(0, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/);
200 <        &print_pair(0, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/);
201 <        &print_pair(0, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/);
202 <        &print_pair(0, "packet.processes.cpu", $top =~ /([^\s]+?)\s*running/);
198 >        &print_pair(0, "packet.processes.total", $top =~ /([0-9]+?) processes:/);
199 >        &print_pair(0, "packet.processes.sleeping", $top =~ /([0-9]+?) sleeping/);
200 >        &print_pair(0, "packet.processes.zombie", $top =~ /([0-9]+?) zombie/);
201 >        &print_pair(0, "packet.processes.stopped", $top =~ /([0-9]+?) stopped/);
202 >        &print_pair(0, "packet.processes.cpu", $top =~ /([0-9]+?)\s*running/);
203          &print_pair(0, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/);
204          &print_pair(0, "packet.cpu.kernel", $top =~ /([^\s]+?)% system/);
205          &print_pair(0, "packet.cpu.iowait", $top =~ /([^\s]+?)% interrupt/);
# Line 225 | Line 225 | sub include_top() {
225          &print_pair(0, "packet.memory.total", $real);
226          &print_pair(0, "packet.memory.free", $free);
227          
228 <        $top =~ /Swap: ([^\s]+?)([KMG]) Total/;
228 >        $top =~ /Swap: ([0-9]+?)([KMG]) Total/;
229          my($swap_total) = $1;
230          $swap_total*=1024 if $2 eq "G";
231          $swap_total/=1024 if $2 eq "K";
232          &print_pair(0, "packet.swap.total", $swap_total);
233          
234 <        $top =~ /Swap:.*, ([^\s]+?)([KMG]) Free/;
234 >        $top =~ /Swap:.*, ([0-9]+?)([KMG]) Free/;
235          my($swap_free) = $1;
236          $swap_free*=1024 if $2 eq "G";
237          $swap_free/=1024 if $2 eq "K";
# Line 244 | Line 244 | sub include_top() {
244          &print_pair(0, "packet.load.load15", $3);
245      }
246      elsif ($ostype eq "Linux") {
247 <        &print_pair(0, "packet.processes.total", $top =~ /([^\s]+?) processes:/);
248 <        &print_pair(0, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/);
249 <        &print_pair(0, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/);
250 <        &print_pair(0, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/);
251 <        &print_pair(0, "packet.processes.cpu", $top =~ /([^\s]+?)\s*running/);
247 >        &print_pair(0, "packet.processes.total", $top =~ /([0-9]+?) processes:/);
248 >        &print_pair(0, "packet.processes.sleeping", $top =~ /([0-9]+?) sleeping/);
249 >        &print_pair(0, "packet.processes.zombie", $top =~ /([0-9]+?) zombie/);
250 >        &print_pair(0, "packet.processes.stopped", $top =~ /([0-9]+?) stopped/);
251 >        &print_pair(0, "packet.processes.cpu", $top =~ /([0-9]+?)\s*running/);
252          &print_pair(0, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/);
253          &print_pair(0, "packet.cpu.user", $top =~ /([^\s]+?)% user/);
254          &print_pair(0, "packet.cpu.kernel", $top =~ /([^\s]+?)% system/);
# Line 258 | Line 258 | sub include_top() {
258          # The following need to be specified in megabytes.
259          # If they are preceeded by a G, then multiply by 1024.  
260          
261 <        $top =~ / ([^\s]+?)([KMG]) av/;
261 >        $top =~ / ([0-9]+?)([KMG]) av/;
262          my($real) = $1;
263          $real*=1024 if $2 eq "G";
264          $real/=1024 if $2 eq "K";
265          &print_pair(0, "packet.memory.total", int($real));
266          
267 <        $top =~ / ([^\s]+?)([KMG]) free/;
267 >        $top =~ / ([0-9]+?)([KMG]) free/;
268          my($free) = $1;
269          $free*=1024 if $2 eq "G";
270          $free/=1024 if $2 eq "K";
271          &print_pair(0, "packet.memory.free", int($free));
272          
273 <        $top =~ /Swap:\s+([^\s]+?)([KMG]) av/;
273 >        $top =~ /Swap:\s+([0-9]]+?)([KMG]) av/;
274          my($swap_total) = $1;
275          $swap_total*=1024 if $2 eq "G";
276          $swap_total/=1024 if $2 eq "K";
277          &print_pair(0, "packet.swap.total", int($swap_total));
278          
279 <        $top =~ /Swap:.*, ([^\s]+?)([KMG]) free/;
279 >        $top =~ /Swap:.*, ([0-9]+?)([KMG]) free/;
280          my($swap_free) = $1;
281          $swap_free*=1024 if $2 eq "G";
282          $swap_free/=1024 if $2 eq "K";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines