Slackware 12.2 - MRTG localhost uptime ====================================== Public domain ******************************************************************************** ### /usr/local/mrtg-2/etc/localuptime.sh #!/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 ******************************************************************************** ### /usr/local/mrtg-2/etc/localuptime.cfg 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]:

Localhost Uptime

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 ******************************************************************************** ### Commands 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 ******************************************************************************** ### crontab -e */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_