Chapter 12. Graphing Data with MRTG

System administrators use scripts every day. Quite a lot of this activity involves using scripts to verify that systems continue to run properly, as well as to gather performance information.

MRTG, short for the Multi Router Traffic Grapher, was originally designed to monitor the network traffic from one or more routers. MRTG takes a very useful approach to network monitoring: It outputs web pages showing the network traffic data. The actual graphs are image files in PNG format. Thus, you need no special software to view the network statistics. In addition, you can view the data remotely if you have a web server running on the system on which MRTG runs.

One of the most useful aspects of MRTG is that the package can monitor just about anything. In addition, anything it can monitor, it can graph. Furthermore, MRTG uses a fixed amount of disk space for storing its statistics. (Older data get replaced by averages.) This means MRTG won't fill your hard disks with data files over time.

MRTG proves useful for all of the following purposes:

  • Monitoring network throughput, the purpose for which MRTG was originally designed

  • Monitoring CPU usage

  • Tracking disk usage

  • Watching for spikes in allocated memory

  • Ensuring that applications such as web servers, database managers, and network firewalls remain functioning

This chapter covers using MRTG to graph system, network, and application data. Using MRTG is fun, as you can get immediate visual feedback about your scripts. ...

Get Beginning Shell Scripting now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.