I'm currently working on a little script to go out and query our switches for IP thoughput, broadcast throughput, and basic utilization, and everyhting seems to be going well but for one small thing.. My system uptime that my managers want to see is being returned to me in 'ticks'. I am fairly sure there is an easy way to convert this value to a human readable stamp, but have hit the proverbial brickwall. Does anyone here know how that stamp is formatted so I can write a subroutine to convert it to 'managerese'? I'm assuming it looks something like Hours:Min:Sec:Millisec or somesuch, but I am probably wrong as usual.. I would appreciate any help you can offer! Thanks!
Here is a little snippet to fetch the system uptime for those that may not know what I referring to:
#!/usr/local/bin/perl -w
use strict;
use warnings;
use diagnostics;
use SNMP;
### Equipment Array ###
our @Equipment =
(
"10.190.16.200",
);
### Equipment Type Hash ###
our %EquipmentType =
(
"10.190.16.200" => "switch",
);
### Switch MIB Hash ###
our %SwitchMIBs =
(
"uptime" => "sysUpTime,0",
"description" => "sysDescr,0",
);
our $uptime;
our $snmp;
# Main
{
my $Equipment;
foreach $Equipment(@Equipment)
{
if ($EquipmentType{$Equipment} =~ "switch")
{
$snmp = new SNMP::Session(DestHost=> "$Equipment",
Community => 'emacs2000',
);
$uptime=$snmp->get("$SwitchMIBs{uptime}");
printf ("Uptime for $Equipment is $uptime\n");
}
}
exit;
}