foxure.com
>>
MRTG Howtos
>>Uptime monitoring

Uptime monitoring

Monitor uptime trought a perl script. This is just one way, there's many others and better way to do this

/usr/local/bin/uptime.pl

#!/usr/bin/perl

$uptime = `uptime`;

$uptime =~ /up (.*?) day/;
$up = int($1);

print "$up\n";
print "$up\n";
#print "0\n";

/etc/mrtg.conf

Title[localuptime]: Uptime
PageTop[localuptime]: <H1>Uptime</H1>
Target[localuptime]: `/usr/local/bin/uptime.pl`
MaxBytes[localuptime]: 2000
Options[localuptime]: growright,unknaszero,nopercent,gauge,noinfo
LegendI[localuptime]: Uptime:
LegendO[localuptime]:
YLegend[localuptime]: Days
XSize[localuptime]: 600
YSize[localuptime]: 150

Result:

mrtg pic