This is an old revision of the document!
server# apt install mrtg
server# cfgmaker public@router > /etc/mrtg.cfg server# cat /etc/mrtg.cfg
... WorkDir: /var/www/html/mrtg/ ...
server# mkdir /var/www/html/mrtg/ server# indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html
root@server:~# cat /etc/cron.d/mrtg ...
server# cat /var/www/html/mrtg/*.log
# Target[router_1]: 3:public@router:::::2 # For Gigabit Interfaces ### Interface 1 >> Descr: 'FastEthernet0/1' | Name: 'Fa0/1' | Ip: '' | Eth: '00-0d-29-e7-7e-01' ###
Target[switch.cpu_load]: 1.3.6.1.4.1.9.2.1.56.0&1.3.6.1.4.1.9.2.1.57.0:public@switch: MaxBytes[switch.cpu_load]: 100 Title[switch.cpu_load]: switch (switch): CPU Options[switch.cpu_load]: gauge, nopercent PageTop[switch.cpu_load]: <H1>Analysis for switch CPU load </H1> <TABLE> <TR><TD>System:</TD><TD>switch in AIS lab., BMSTU</TD></TR> <TR><TD>Maintainer:</TD><TD>root@gate.corpX.un</TD></TR> <TR><TD>Interface:</TD><TD>CPU</TD></TR> <TR><TD>IP:</TD><TD>switch (switch)</TD></TR> <TR><TD>Max load:</TD> <TD>100%</TD></TR> </TABLE>
Target[195.19.32.193_temp]:1.3.6.1.4.1.9.9.13.1.3.1.3.1&.1.3.6.1.4.1.9.9.13.1.3.1.3.2:public@195.19.32.193 SetEnv[195.19.32.193_temp]: MRTG_INT_DESCR="Temperature" Title[195.19.32.193_temp]: Temperature -- 7206 #Directory[195.19.32.193_temp]: MaxBytes[195.19.32.193_temp]: 100 Options[195.19.32.193_temp]: nopercent,growright, gauge, absolute #Unscaled[195.19.32.193_temp]: dwmy YLegend[195.19.32.193_temp]: Temperature (Gr C) ShortLegend[195.19.32.193_temp]: Gr Legend1[195.19.32.193_temp]: Avg Temperature Inlet Legend2[195.19.32.193_temp]: Avg Temperature Outlet Legend3[195.19.32.193_temp]: Max Temperature Inlet Legend4[195.19.32.193_temp]: Max Temperature Outlet LegendI[195.19.32.193_temp]: Temperature Inlet LegendO[195.19.32.193_temp]: Temperature Outlet
# cat /etc/mrtg-dhcp-stat.sh
#!/bin/sh #CMD='rsh router show ip dhcp binding | grep 192.168 | wc -l' #MAX=9 #CUR=`eval $CMD` #CMD='/usr/bin/dhcpd-pools -l /var/lib/dhcp/dhcpd.leases -c /etc/dhcp/dhcpd.conf -f c | grep 192.168.X.' #CMD='/usr/local/bin/dhcpd-pools -l /var/db/dhcpd/dhcpd.leases -c /usr/local/etc/dhcpd.conf -f c | grep 192.168.X.' #MAX=`eval $CMD | cut -d'"' -f8` #CUR=`eval $CMD | cut -d'"' -f10` echo $MAX echo $CUR echo 0 echo 0
# cat mrtg.cfg
... Target[dhcp-stat]: `/etc/mrtg-dhcp-stat.sh` Title[dhcp-stat]: dhcp stat (ip) PageTop[dhcp-stat]: <H1>dhcp stat (ip)</H1> Options[dhcp-stat]: nobanner,gauge,noinfo,nopercent MaxBytes[dhcp-stat]: 10 Unscaled[dhcp-stat]: dwmy YLegend[dhcp-stat]: Hosts (ip) ShortLegend[dhcp-stat]: ip LegendI[dhcp-stat]: dhcp leased LegendO[dhcp-stat]: max ip in pool