[mrtg] Re: MRTG and timeticks - NT/2000 solution

lindsay.hunt at power.alstom.com lindsay.hunt at power.alstom.com
Mon Jan 14 22:57:01 MET 2002


Here is a solution when dealing with timeticks for Windows NT 4 or Windows
2000 using snmputil.exe.  The snmputil.exe file can be found in the NT4
Resource Kit or at the following url:

     http://www.wtcs.org/snmp4tpc/testing.htm#snmputil

The script I have written works like the apc_ups.pl script found in the
contrib directory.  It will convert milliseconds to minutes as snmputil
will report the estimated time left on a UPS battery in milliseconds.  I
have found that different SNMP utilities report time in different ways
(00:15:00, milliseconds, minutes etc).


$IP = $ARGV[0];
$Community = $ARGV[1];
chomp $ip;
chomp $Community;


@a=`/snmputil.exe get $IP $Community .1.3.6.1.4.1.318.1.1.1.2.2.3.0`;
chomp @a;
@b=split(/Value    = TimeTicks /, at a[1]);
print eval($b[1] / 6000),"\n";
@c=`/snmputil.exe get $IP $Community .1.3.6.1.4.1.318.1.1.1.2.2.3.0`;
chomp @c;
@d=split(/Value    = TimeTicks /, at c[1]);
print eval($d[1] / 6000),"\n";


Here is the MRTG config that calls the above script:

#Denver UPS
# Denver UPS Estimated Minutes Remaining
Target[denvermin]: `perl c:\mrtg\mrtg-2.9.17\bin\ups_time2.pl <ipaddress>
public`
MaxBytes[denvermin]: 120
Title[denvermin]: Denver UPS Estimated Minutes Remaining
PageTop[denvermin]: <H1>Denver UPS Estimated Minutes Remaining</H1>
Unscaled[denvermin]: ymwd
ShortLegend[denvermin]: minutes
XSize[denvermin]: 380
YSize[denvermin]: 100
YLegend[denvermin]: Estimated Minutes Remaining
Legend1[denvermin]: Estimated Minutes Remaining
Legend2[denvermin]: Estimated Minutes Remaining
Legend3[denvermin]:
Legend4[denvermin]:
LegendI[denvermin]:
LegendO[denvermin]: &nbsp
Options[denvermin]: gauge, integer, nopercent

I have seen other examples (like ups_time.pl and apc_ups.pl) but had
difficulty getting these scripts to work.  I am not suggesting that these
other scripts don't work; I just had problems. The ups_time.pl script uses
snmpget for Windows and I have not been able to find this executable so I
created a script that uses snmputil.exe.  If you have any questions or
suggestions (I am a Perl novice) please let me know.  Maybe all of the math
could be accomplished in the MRTG script.

Lindsay Hunt
Network Engineer
Alstom Power
phone 804-763-7239
mobile 804-334-1682
fax 804-763-7107

CONFIDENTIALITY : This e-mail and any attachments are confidential and may
be privileged. If you are not a named recipient, please notify the sender
immediately and do not disclose the contents to another person, use it for
any purpose or store or copy the information in any medium.


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list