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.13 by tdb, Mon Jan 22 23:21:34 2001 UTC vs.
Revision 1.19 by tdb, Thu Feb 1 03:14:35 2001 UTC

# Line 21 | Line 21 | $| = 1;
21   # You'd be silly not to use this ;)
22   use strict;
23  
24 < # Path's
24 > # Paths
25   my($topbin) = "/usr/local/sbin/top";
26   my($dfbin) = "/usr/bin/df";
27   my($usersbin) = "/usr/ucb/users";
28   my($unamebin) = "/usr/bin/uname";
29 + my($uptimebin) = "/usr/bin/uptime";
30  
31   # Run the following components: -
32   &print_ident();
33   &include_osver();
34 + &include_uptime();
35   &include_users();
36   &include_top();
37   &include_disk();
# Line 107 | Line 109 | sub include_users() {
109  
110      # Find out all users on this machine.
111      my($users) = `$usersbin`;
112 <    my(@users) = split(/\s+/, $users);
112 >    $users = "\n" unless defined $users;
113 >    chop $users;
114 >    my($users_count) = 0;
115 >    $users_count++ while $users =~ /\w+/g;
116 >    my($users_list) = $users." ";
117  
112    my($users_count) = $#users + 1;
113    my($users_list) = $users;
114
118      &print_pair(1, "packet.users.count", $users_count);
119      &print_pair(0, "packet.users.list", $users_list);
120   }
# Line 184 | Line 187 | sub include_osver() {
187      &print_pair(0, "packet.os.platform", $os_platform);
188      &print_pair(0, "packet.os.sysname", $os_sysname);
189      &print_pair(0, "packet.os.version", $os_version);
190 +
191 + }
192 +
193 + # sub to get system uptime.
194 + sub include_uptime() {
195 +
196 +    my($uptime) = `$uptimebin`;
197 +    $uptime =~ /up ([0-9]+) .*, ([0-9]+:[0-9]+)/;
198 +    $uptime = "$1:$2";
199 +
200 +    &print_pair(0, "packet.os.uptime", $uptime);
201  
202   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines