Public domain
#!/bin/bash
HOST=$(hostname)
UPTIME=$(cat /proc/uptime | sed -e 's,\..*,,')
H=$(( $UPTIME / 3600 ))
M=$(( ($UPTIME - $H * 3600) / 60 ))
echo $H
echo $H
echo $H:$M
echo $HOST
workdir: /var/www/htdocs/uptime
Target[localuptime]: `/usr/local/mrtg-2/etc/localuptime.sh`
Options[localuptime]: gauge, nopercent, integer, unknaszero
Title[localuptime]: Localhost Uptime
PageTop[localuptime]: <H1>Localhost Uptime</H1>
YLegend[localuptime]: Hours
ShortLegend[localuptime]: hours
Colours[localuptime]: YELLOW#F9C000,RED#F90000,DARKGREEN#006600,VIOLET#FF00FF
Legend1[localuptime]:
Legend2[localuptime]: Uptime hours
LegendI[localuptime]:
LegendO[localuptime]: Uptime
MaxBytes[localuptime]: 100000
mkdir -p /var/www/htdocs/uptime
chmod +x /usr/local/mrtg-2/etc/localuptime.sh
/usr/local/mrtg-2/bin/indexmaker /usr/local/mrtg-2/etc/localuptime.cfg > /var/www/htdocs/uptime/index.html
/usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/localuptime.cfg
/usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/localuptime.cfg
/usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/localuptime.cfg
*/5 * * * * /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/localuptime.cfg &> /dev/null
BY: Pejman Moghadam
TAG: mrtg, uptime
DATE: 2010-09-09 10:52:27