Mar 19 2009

Graph Only One Value in MRTG

Published by at 12:02 am under Monitoring

MRTG needs at least 2 values to generate graphs. Thus, Most configurations contain the same OID twice in the target line.
This leads to 2 problems:
– The same data is collected twice which requires more bandwidth, especially when a large number of hosts is monitored

– The value may vary during this very short lap, producing 2 different lines in the graph. This is the case with AS400 cpus for instance.
To graph only one value such as CPU or memory usage, you can write a short script that collects the SNMP field once:

mrtg@snmp-server:~> cat /home/mrtg/
CPU_LOAD=`snmpget -c $COMMUNITY -v $SNMP_VERSION $IP . | awk '{print $(NF) }'`
echo $CPU_LOAD
echo $CPU_LOAD

Replace with your own OID, and call the script in your MRTG config file:

Target[cpu]:`/home/mrtg/ my_ip my_community 1`

Quick and easy!

One response so far

One Response to “Graph Only One Value in MRTG”

  1. shubhamon 13 Jul 2015 at 12:43 pm

    can you share your cfg file

Comments RSS

Leave a Reply