PC Bacchus PC Gemini PC Hermes PC Hydra PC Narvik PC Stamsund
Network NTP DVB Throughput     How-to

How to add these performance monitors

Once you have installed: SNMP Informant on each PC you wish to monitor, you can access the data directly from MRTG, as it has a specific SNMP object ID (OID), so the script fragments are as shown below. To keep the configuration file clean, I actually used include statements in the mrtg.cfg file, such as:

  Include: narvik-monitor.inc

As PC Narvik has two CPUs, there are two instances 48 and 49 listed in the [Target] line in the sample below.

Contents of narvik-monitor.inc

 
#---------------------------------------------------------------
# PC Narvik - Memory
#---------------------------------------------------------------

Target[Narvik-mem]: 1.3.6.1.4.1.9600.1.1.2.4.0&1.3.6.1.4.1.9600.1.1.2.1.0:public@narvik
MaxBytes[Narvik-mem]: 4000000000
Options[Narvik-mem]: integer, gauge, nopercent, growright, unknaszero
YLegend[Narvik-mem]: Memory
ShortLegend[Narvik-mem]: B
LegendI[Narvik-mem]: Used  
LegendO[Narvik-mem]: Avail  
Title[Narvik-mem]: Narvik Memory
PageTop[Narvik-mem]: <H2>PC Narvik - Memory</H2>

#---------------------------------------------------------------
# PC Narvik - CPU load, dual-core CPU
#---------------------------------------------------------------

Target[Narvik-CPU]: 1.3.6.1.4.1.9600.1.1.5.1.5.1.48&1.3.6.1.4.1.9600.1.1.5.1.5.1.49:public@narvik
MaxBytes[Narvik-CPU]: 100
YLegend[Narvik-CPU]: CPU %
ShortLegend[Narvik-CPU]: %
LegendI[Narvik-CPU]: CPU 1
LegendO[Narvik-CPU]: CPU 2
Options[Narvik-CPU]: integer, gauge, nopercent, growright, unknaszero
Title[Narvik-CPU]: Narvik CPU
PageTop[Narvik-CPU]: <H2>PC Narvik - CPU load</H2>
# If PC Narvik were a single-core CPU, use two instances of object 48, as MRTG requires that 
# you have two variables returned.  You may also want to prevent display of the second output
# line by adding the "no-ouput" option (noo) to the Options line:
Target[Narvik-CPU]: 1.3.6.1.4.1.9600.1.1.5.1.5.1.48&1.3.6.1.4.1.9600.1.1.5.1.5.1.48:public@narvik
Options[Narvik-CPU]: integer, gauge, nopercent, growright, noo
# I found that on a lower-spec PC (Bacchus), returning the CPU twice caused an artificially
# high value to be returned for the second call (presumably the CPU busy processing the first
# request?!), so I actually changed to using the SNMP value: Maximum Number of Process Contexts
# i.e.  .1.3.6.1.2.1.25.1.7.0 (check this on your system using GetIF), which returns integer 0.
Target[Bacchus-CPU]: 1.3.6.1.4.1.9600.1.1.5.1.5.1.48&1.3.6.1.2.1.25.1.7.0:public@192.168.0.4
 

As this is my first attempt, any suggestions for improvements are welcome.  The only thing noticeably different is using OIDs in the [Target] line, as described here, and I used the GetIF program and the MIBs from SNMP Informant to work out what to monitor.  There are a lot more parameters available from the free SNMP Informant.  I added the unknaszero option so that when the PC is offline, the zero CPU and memory usage are clearly visible.

All running under Windows, including Vista!

Acknowledgement: this was triggered by an e-mail exchange with Lonni J Friedman who asked how I got MRTG working under Vista (answer: Run As Administrator, having added SNMP and allowed it through the firewall), but who had the performance monitoring working under Windows XP!  Steve Catto first introduced me to MRTG - thanks Steve!

 
Copyright © David Taylor, Edinburgh Last modified: 2008 Jan 02 at 11:55