also, when running as a daemon, MRTG itself is responsible for timing the measurement intervals; therefore, we need to add the Interval line option and assign it a value – in this example 5. This means that every five minutes MRTG will poll the SNMP service in your gateway\router and update its graphs
Speaking of graphs, by default MRTG graphs grow to the left, so by adding the option “growright” the direction of the traffic visible in MRTG’s graphs flips causing the current time to be at the right edge of the graph and the history values to the left. We’ve also chosen the “bits” option, which means that the monitored traffic values obtained from your gateway\router are multiplied by 8 and displayed bits per second instead of bytes per second.
2013-02-23 13:20:16: WARNING: Problem with External get '/usr/sbin/eth.sh': Expected a Number for 'in' but got ''2013-02-23 13:20:16: WARNING: Problem with External get '/usr/sbin/eth.sh': Expected a Number for 'out' but got ''2013-02-23 13:20:16: ERROR: Target[eth0][_IN_] ' $target->[0]{$mode} ' did not eval into defined data2013-02-23 13:20:16: ERROR: Target[eth0][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data
#!/bin/sh# Get transmit and receive bytes.#INFO=`grep venet0 /proc/net/dev | tr -s ' ' ' ' | cut -d: -f2`RECEIVE=`echo $INFO | cut -d" " -f1`TRANSMIT=`echo $INFO | cut -d" " -f9`# Get uptime.#UPTIME=`uptime | tr -s ' ' ' ' | cut -d" " -f4-`# Final output to MRTG#echo $RECEIVEecho $TRANSMITecho $UPTIMEecho "localhost"
#!/bin/sh# Get transmit and receive bytes.#INFO=`grep venet0 /proc/net/dev | tr -s ' ' ' ' | cut -d: -f2` RECEIVE=`echo $INFO | cut -d" " -f1` TRANSMIT=`echo $INFO | cut -d" " -f9`# Get uptime.#UPTIME=`uptime | tr -s ' ' ' ' | cut -d" " -f4-`# Final output to MRTG#echo $RECEIVEecho $TRANSMITecho $UPTIMEecho "localhost"
WorkDir: /var/www/mrtgEnableIPv6: noLanguage: czechBodyTag[eth0]:Target[eth0]: `/usr/sbin/eth.sh`Options[eth0]: bits,growrightTitle[eth0]: Traffic and Load AnalysisPageTop[eth0]: Traffic and Load AnalysisMaxBytes[eth0]: 1250000
WorkDir: /var/www/mrtgTarget[eth0]: `/usr/sbin/eth.sh`SetEnv[eth0]: MRTG_INT_IP="127.0.0.1"MRTG_INT_DESCR="localhost"MaxBytes[eth0]: 25000000Title[eth0]: PageTop[eth0]:
ERROR: Line 7 (MRTG_INT_DESCR="localhost") in CFG file (/etc/mrtg.cfg) does not make sense
CHYBA: Riadok 7 (MRTG_INT_DESCR="localhost") v CFG súbore (/etc/mrtg.cfg) nemá zmysel
WorkDir: /var/www/mrtgTarget[eth0]: `/usr/sbin/eth.sh`SetEnv[eth0]: MRTG_INT_IP="xxx.xxx.xxx.xxx"MRTG_INT_DESCR="eth0"MaxBytes[eth0]: 25000000Title[eth0]: PageTop[eth0]:
WorkDir: /var/www/mrtgTarget[eth0]: `/usr/sbin/eth.sh`SetEnv[eth0]: MRTG_INT_IP="xxx.xxx.xxx.xxx"MRTG_INT_DESCR="eth0"MaxBytes[eth0]: 25000000Title[eth0]: PageTop[eth0]: System: tvoja.domena.comMaintainer: Shaggy <shg@84675.com>Description: eth0ifType: Other (1)ifName: Max Speed: 1250.0 kBytes/s
Uistite sa, že máte riadne nakonfigurovaný SNMP server. Potom spustite MRTG ako zvyčajne.
System: tvoja.domend.com
SetEnv[eth0]: MRTG_INT_IP="127.0.0.1"
System: tvoja adresa na vps?
2013-02-23 20:45:48: ERROR: Target[memory_usage][_IN_] ' $target->[0]{$mode} ' did not eval into defined data2013-02-23 20:45:48: ERROR: Target[memory_usage][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data
Navyše budete musieť vytvoriť pracovný adresár vo webserver Root napr. / usr/nekoware/apache2/htdocs/_mrtg.