Graphing Other Objects

MRTG polls and graphs the MIB variables ifInOctets and ifOutOctets by default, but it is possible to poll and graph the values of other objects, in addition to polling different kinds of devices. Let’s first get MRTG collecting input and output octets from a server. To do this, run the following command:

[root][linuxserver] ~/mrtg-2.9.10> cfgmaker public@linuxserver >> \
            /mrtg2/run/mrtg.cfg

This is almost identical to the command we ran earlier in the chapter, except for the community string and target[69] (public@linuxserver). We appended the output to the mrtg.cfg file, as opposed to specifying an output file with the - -output option; this lets us add a new host to the existing configuration file, rather than starting a new file. Because the existing file already specifies a working directory, we also omitted the working directory option (- -global 'WorkDir: .. ' ). This cfgmaker command adds a number of lines like the following to the configuration file:

Target[linuxserver]: 2:public@localhost
MaxBytes[linuxserver]: 1250000
Title[linuxserver]: linuxserver(linuxserver): eth0
PageTop[linuxserver]: <H1>Traffic Analysis for eth0
 </H1>
 <TABLE>
   <TR><TD>System:</TD><TD>linuxserver</TD></TR>
   <TR><TD>Maintainer:</TD><TD></TD></TR>
   <TR><TD>Interface:</TD><TD>eth0 (2)</TD></TR>
   <TR><TD>IP:</TD><TD>linuxserver(  )</TD></TR>
   <TR><TD>Max Speed:</TD>
       <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
  </TABLE>

These lines tell MRTG how to poll the server’s Ethernet interface. ...

Get Essential SNMP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.