Reputation: 8680
I have configured MRTG to monitor network traffic, CPU load and memory. Network traffic statistics are ok but CPU load statistics show that CPU is 100% used while actually it is as I check with top
command. Following is the MRTG configuration for CPU (mrtg.cfg).
# 10.12.2.1 CPU configuration
Target[CPU]: .1.3.6.1.4.1.2021.10.1.5.1&.1.3.6.1.4.1.2021.10.1.5.2:[email protected]
MaxBytes[CPU]: 100
Unscaled[CPU]: dwmy
Options[CPU]: gauge, growright, nopercent
YLegend[CPU]: Load Average
ShortLegend[CPU]: (%)
LegendI[CPU]: Load Average 1 min
LegendO[CPU]: Load Average 5 min
Legend1[CPU]: Load Average 1 min
Legend2[CPU]: Load Average 5 min
Title[CPU]: CPU Load Average
PageTop[CPU]: <h1>10.12.2.1 CPU Load Average</h1>
Where is the problem in configuration ? Here is snapshot of CPU statistics output.
Upvotes: 0
Views: 1011
Reputation: 4062
This is the problem with using SNMP to collect CPU and Load Avg statistics. Depending on your OS and SNMP implementation, and the number of CPUs you have, you may find that the SNMP query erroneously returns a high value because, at the point in time when you check, one CPU is in use by the SNMP daemon.
If you can, it is better to use an OID which returns the average use over the last 5min rather than the point in time usage, as this prevents the problem. Usually, you can find a LoadAvg5min OID, but some SNMP implementations do not have this, though.
Another alternative is to use an external plugin. You can have MRTG use mrtg-nrpe
to call the Nagios NRPE agent on the remote host, which then calls the Nagios check-cpu
and check-load
plugins to get the real CPU usage. This is a bit complex to set up, though, and in some cases can suffer from the same issue.
Upvotes: 0