| 56 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 57 |  | # sub to print pairs of data, separated by a single space character. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 58 |  | # If the second argument is undefined, then the pair is still printed, | 
 
 
 
 
 
 
 
 
 
 
 | 59 | < | # however, the value shall be displayed as the string "unknown". | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 60 | < | # If $type is non-zero, then "0" is printed instead of "unknown". | 
 
 
 
 
 
 
 
 
 | 59 | > | # however, the value shall be displayed as the the 'default' value | 
 
 
 
 
 | 60 | > | # if the passed value was undefined. | 
 
 
 
 
 
 
 
 
 
 
 | 61 |  | sub print_pair($$$) { | 
 
 
 
 
 
 
 
 
 
 
 | 62 | < | my($type, $name, $value) = @_; | 
 
 
 
 
 
 
 
 
 | 62 | > | my($default, $name, $value) = @_; | 
 
 
 
 
 
 
 
 
 
 
 | 63 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 64 |  | if (!defined $value) { | 
 
 
 
 
 
 
 
 
 
 
 | 65 | < | if ($type) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | < | $value = "0.00"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 | < | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 | < | else { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 | < | $value = "unknown"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 | < | } | 
 
 
 
 
 
 
 
 
 | 65 | > | $value = $default; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 |  | # Remove the trailing linefeed if we've not already done so. | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 87 |  | # $4 will not match unless everything before it does... | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 88 |  | if (defined $5) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 89 |  | my ($filesystem, $kbytes, $used, $avail, $mount) = ($1, $2, $3, $4, $5); | 
 
 
 
 
 
 
 
 
 
 
 | 90 | < | &print_pair(0, "packet.disk.p$partition_no.attributes.name", $filesystem); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 91 | < | &print_pair(1, "packet.disk.p$partition_no.attributes.kbytes", $kbytes); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 92 | < | &print_pair(1, "packet.disk.p$partition_no.attributes.used", $used); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 93 | < | &print_pair(1, "packet.disk.p$partition_no.attributes.avail", $avail); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 94 | < | &print_pair(0, "packet.disk.p$partition_no.attributes.mount", $mount); | 
 
 
 
 
 
 
 
 
 | 90 | > | &print_pair("unknown", "packet.disk.p$partition_no.attributes.name", $filesystem); | 
 
 
 
 
 | 91 | > | &print_pair(0, "packet.disk.p$partition_no.attributes.kbytes", $kbytes); | 
 
 
 
 
 | 92 | > | &print_pair(0, "packet.disk.p$partition_no.attributes.used", $used); | 
 
 
 
 
 | 93 | > | &print_pair(0, "packet.disk.p$partition_no.attributes.avail", $avail); | 
 
 
 
 
 | 94 | > | &print_pair("unknown", "packet.disk.p$partition_no.attributes.mount", $mount); | 
 
 
 
 
 
 
 
 
 
 
 | 95 |  | ++$partition_no; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 96 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 97 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 110 |  | $users_count++ while $users =~ /\w+/g; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 111 |  | my($users_list) = $users." "; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 112 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 113 | < | &print_pair(1, "packet.users.count", $users_count); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 114 | < | &print_pair(0, "packet.users.list", $users_list); | 
 
 
 
 
 
 
 
 
 | 113 | > | &print_pair(0, "packet.users.count", $users_count); | 
 
 
 
 
 | 114 | > | &print_pair("unknown", "packet.users.list", $users_list); | 
 
 
 
 
 
 
 
 
 
 
 | 115 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 116 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 117 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 124 |  | my($top) = join(" ", @top); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 125 |  | $top =~ s/\n//g; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 126 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 127 | < | &print_pair(1, "packet.load.load1", $top =~ /load averages:\s*([^\s]+?),/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 128 | < | &print_pair(1, "packet.load.load5", $top =~ /load averages:\s*.+?,\s*([^\s]+?),/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 129 | < | &print_pair(1, "packet.load.load15", $top =~ /load averages:\s*.+?,\s*.+?,\s*([^\s]+?)\s*/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 130 | < | &print_pair(1, "packet.processes.total", $top =~ /([^\s]+?) processes:/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 131 | < | &print_pair(1, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 132 | < | &print_pair(1, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 133 | < | &print_pair(1, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 134 | < | &print_pair(1, "packet.processes.cpu", $top =~ /([^\s]+?)\s*on cpu/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 135 | < | &print_pair(1, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 136 | < | &print_pair(1, "packet.cpu.user", $top =~ /([^\s]+?)% user/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 142 | < | &print_pair(1, "packet.cpu.kernel", $top =~ /([^\s]+?)% kernel/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 143 | < | &print_pair(1, "packet.cpu.iowait", $top =~ /([^\s]+?)% iowait/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 144 | < | &print_pair(1, "packet.cpu.swap", $top =~ /([^\s]+?)% swap/); | 
 
 
 
 
 
 
 
 
 | 127 | > | &print_pair(0, "packet.processes.total", $top =~ /([^\s]+?) processes:/); | 
 
 
 
 
 | 128 | > | &print_pair(0, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/); | 
 
 
 
 
 | 129 | > | &print_pair(0, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/); | 
 
 
 
 
 | 130 | > | &print_pair(0, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/); | 
 
 
 
 
 | 131 | > | &print_pair(0, "packet.processes.cpu", $top =~ /([^\s]+?)\s*on cpu/); | 
 
 
 
 
 | 132 | > | &print_pair(0, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/); | 
 
 
 
 
 | 133 | > | &print_pair(0, "packet.cpu.user", $top =~ /([^\s]+?)% user/); | 
 
 
 
 
 | 134 | > | &print_pair(0, "packet.cpu.kernel", $top =~ /([^\s]+?)% kernel/); | 
 
 
 
 
 | 135 | > | &print_pair(0, "packet.cpu.iowait", $top =~ /([^\s]+?)% iowait/); | 
 
 
 
 
 | 136 | > | &print_pair(0, "packet.cpu.swap", $top =~ /([^\s]+?)% swap/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 137 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 138 |  | # The following need to be specified in megabytes. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 139 |  | # If they are preceeded by a G, then multiply by 1024. | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 141 |  | $top =~ /([^\s]+?)([MG]) real/; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 142 |  | my($real) = $1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 143 |  | $real*=1024 if $2 eq "G"; | 
 
 
 
 
 
 
 
 
 
 
 | 144 | < | &print_pair(1, "packet.memory.real", $real); | 
 
 
 
 
 
 
 
 
 | 144 | > | &print_pair(0, "packet.memory.total", $real); | 
 
 
 
 
 
 
 
 
 
 
 | 145 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 146 |  | $top =~ /([^\s]+?)([MG]) free/; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 147 |  | my($free) = $1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 148 |  | $free*=1024 if $2 eq "G"; | 
 
 
 
 
 
 
 
 
 
 
 | 149 | < | &print_pair(1, "packet.memory.free", $free); | 
 
 
 
 
 
 
 
 
 | 149 | > | &print_pair(0, "packet.memory.free", $free); | 
 
 
 
 
 
 
 
 
 
 
 | 150 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 |  | $top =~ /([^\s]+?)([MG]) swap in use/; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 152 |  | my($swap_in_use) = $1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 156 |  | $top =~ /([^\s]+?)([MG]) swap free/; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 157 |  | my($swap_free) = $1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 158 |  | $swap_free*=1024 if $2 eq "G"; | 
 
 
 
 
 
 
 
 
 
 
 | 159 | < | &print_pair(1, "packet.memory.swap_free", $swap_free); | 
 
 
 
 
 
 
 
 
 | 159 | > | &print_pair(0, "packet.swap.free", $swap_free); | 
 
 
 
 
 
 
 
 
 
 
 | 160 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 161 |  | # AJ requested total swap instead of swap_in_use, so here we go! | 
 
 
 
 
 
 
 
 
 
 
 | 162 | < | &print_pair(1, "packet.memory.swap_total", $swap_free + $swap_in_use); | 
 
 
 
 
 
 
 
 
 | 162 | > | &print_pair(0, "packet.swap.total", $swap_free + $swap_in_use); | 
 
 
 
 
 
 
 
 
 
 
 | 163 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 164 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 165 |  | # sub to get details of the machine's operating system. | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 174 |  | my($os_sysname) = `$unamebin -n`; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 175 |  | my($os_version) = `$unamebin -v`; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 176 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 177 | < | &print_pair(0, "packet.os.name", $os_name); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 178 | < | &print_pair(0, "packet.os.release", $os_release); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 179 | < | &print_pair(0, "packet.os.platform", $os_platform); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 180 | < | &print_pair(0, "packet.os.sysname", $os_sysname); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 181 | < | &print_pair(0, "packet.os.version", $os_version); | 
 
 
 
 
 
 
 
 
 | 177 | > | &print_pair("unknown", "packet.os.name", $os_name); | 
 
 
 
 
 | 178 | > | &print_pair("unknown", "packet.os.release", $os_release); | 
 
 
 
 
 | 179 | > | &print_pair("unknown", "packet.os.platform", $os_platform); | 
 
 
 
 
 | 180 | > | &print_pair("unknown", "packet.os.sysname", $os_sysname); | 
 
 
 
 
 | 181 | > | &print_pair("unknown", "packet.os.version", $os_version); | 
 
 
 
 
 
 
 
 
 
 
 | 182 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 183 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 184 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 185 | < | # sub to get system uptime. | 
 
 
 
 
 
 
 
 
 | 185 | > | # sub to get system uptime in seconds. | 
 
 
 
 
 
 
 
 
 
 
 | 186 |  | sub include_uptime() { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 187 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 188 | < | # Need a regexp guru to strip the junk on this line | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 188 | > | # debug stuff, all the different cases | 
 
 
 
 
 | 189 | > |  | 
 
 
 
 
 | 190 | > | # normal | 
 
 
 
 
 | 191 | > | #my($uptime) = "  4:48pm  up 49 day(s),  6:30,  201 users,  load average: 0.33, 0.35, 0.38\n"; | 
 
 
 
 
 | 192 | > | # 0 days | 
 
 
 
 
 | 193 | > | #my($uptime) = "  4:48pm  up 6:30,  201 users,  load average: 0.33, 0.35, 0.38\n"; | 
 
 
 
 
 | 194 | > | # 0 hours | 
 
 
 
 
 | 195 | > | #my($uptime) = "  4:48pm  up 49 day(s),  30 min(s),  201 users,  load average: 0.33, 0.35, 0.38\n"; | 
 
 
 
 
 | 196 | > | # 0 mins | 
 
 
 
 
 | 197 | > | #my($uptime) = "  4:48pm  up 49 day(s),  6 hr(s),  201 users,  load average: 0.33, 0.35, 0.38\n"; | 
 
 
 
 
 | 198 | > | # 0 days and 0 mins | 
 
 
 
 
 | 199 | > | #my($uptime) = "  4:48pm  up 6 hr(s),  201 users,  load average: 0.33, 0.35, 0.38\n"; | 
 
 
 
 
 | 200 | > | # 0 days and 0 hours | 
 
 
 
 
 | 201 | > | #my($uptime) = "  4:48pm  up 30 min(s),  201 users,  load average: 0.33, 0.35, 0.38\n"; | 
 
 
 
 
 | 202 | > | # 0 hours and 0 mins | 
 
 
 
 
 | 203 | > | #my($uptime) = "  4:48pm  up 49 day(s), 201 users,  load average: 0.33, 0.35, 0.38\n"; | 
 
 
 
 
 | 204 | > |  | 
 
 
 
 
 | 205 | > | # grab the uptime | 
 
 
 
 
 
 
 
 
 
 
 | 206 |  | my($uptime) = `$uptimebin`; | 
 
 
 
 
 
 
 
 | 207 | + |  | 
 
 
 
 
 
 
 
 | 208 | + | &print_pair(0, "packet.load.load1", $uptime =~ /load average.?:\s*([^\s]+?),/); | 
 
 
 
 
 
 
 
 | 209 | + | &print_pair(0, "packet.load.load5", $uptime =~ /load average.?:\s*.+?,\s*([^\s]+?),/); | 
 
 
 
 
 
 
 
 | 210 | + | &print_pair(0, "packet.load.load15", $uptime =~ /load average.?:\s*.+?,\s*.+?,\s*([^\s]+)/); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 211 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 212 | < | &print_pair(0, "packet.os.uptime", $uptime); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 212 | > | # work out the days, hours, and minutes | 
 
 
 
 
 | 213 | > |  | 
 
 
 
 
 | 214 | > | if ($uptime =~ /day.*,\s+([0-9]+):([0-9]+)/) { | 
 
 
 
 
 | 215 | > | # normal | 
 
 
 
 
 | 216 | > | $uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+):([0-9]+)/; | 
 
 
 
 
 | 217 | > | $uptime = "$1:$2:$3"; | 
 
 
 
 
 | 218 | > | } | 
 
 
 
 
 | 219 | > | else { | 
 
 
 
 
 | 220 | > | if ($uptime =~ /day/) { | 
 
 
 
 
 | 221 | > | if ($uptime =~ /hr/) { | 
 
 
 
 
 | 222 | > | # 0 minutes | 
 
 
 
 
 | 223 | > | $uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+)\s+.*,/; | 
 
 
 
 
 | 224 | > | $uptime = "$1:$2:0"; | 
 
 
 
 
 | 225 | > | } | 
 
 
 
 
 | 226 | > | elsif ($uptime =~ /min/) { | 
 
 
 
 
 | 227 | > | # 0 hours | 
 
 
 
 
 | 228 | > | $uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+)\s+.*,/; | 
 
 
 
 
 | 229 | > | $uptime = "$1:0:$2"; | 
 
 
 
 
 | 230 | > | } | 
 
 
 
 
 | 231 | > | else { | 
 
 
 
 
 | 232 | > | # 0 hours and 0 mins | 
 
 
 
 
 | 233 | > | $uptime =~ /up\s+([0-9]+)/; | 
 
 
 
 
 | 234 | > | $uptime = "$1:0:0"; | 
 
 
 
 
 | 235 | > | } | 
 
 
 
 
 | 236 | > | } | 
 
 
 
 
 | 237 | > | elsif ($uptime =~ /hr/) { | 
 
 
 
 
 | 238 | > | # 0 days and 0 minutes | 
 
 
 
 
 | 239 | > | $uptime =~ /up\s+([0-9]+)\s+/; | 
 
 
 
 
 | 240 | > | $uptime = "0:$1:0"; | 
 
 
 
 
 | 241 | > | } | 
 
 
 
 
 | 242 | > | elsif ($uptime =~ /min/) { | 
 
 
 
 
 | 243 | > | # 0 days and 0 hours | 
 
 
 
 
 | 244 | > | $uptime =~ /up\s+([0-9]+)\s+/; | 
 
 
 
 
 | 245 | > | $uptime = "0:0:$1"; | 
 
 
 
 
 | 246 | > | } | 
 
 
 
 
 | 247 | > | else { | 
 
 
 
 
 | 248 | > | # 0 days | 
 
 
 
 
 | 249 | > | $uptime =~ /up\s+([0-9]+):([0-9]+)/; | 
 
 
 
 
 | 250 | > | $uptime = "0:$1:$2"; | 
 
 
 
 
 | 251 | > | } | 
 
 
 
 
 | 252 | > | } | 
 
 
 
 
 | 253 | > |  | 
 
 
 
 
 | 254 | > | # turn into seconds | 
 
 
 
 
 | 255 | > | $uptime =~ /([0-9]+):([0-9]+):([0-9]+)/; | 
 
 
 
 
 | 256 | > | $uptime = ($3+($2+($1*24))*60)*60; | 
 
 
 
 
 | 257 | > |  | 
 
 
 
 
 | 258 | > | # print the value out | 
 
 
 
 
 | 259 | > | &print_pair("unknown", "packet.os.uptime", $uptime); | 
 
 
 
 
 
 
 
 
 
 
 | 260 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 261 |  | } |