Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories


How to monitor SNMP devices with MRTG

Ástþór IPÁstþór IP

Multi Router Traffic Grapher (MRTG)The Multi Router Traffic Grapher (MRTG) is free software for monitoring and measuring the traffic load on network links. It allows the user to see traffic load on a network over time in graphical form.

1. Install MRTG

apt-get install mrtg

2. Create a config file with the cfgmaker tool by connecting to a SNMP device. cfgmaker will automatically detect the interfaces that can be monitored.

cfgmaker {community}@{ip_address} > /etc/mrtg-{device}.cfg

Set the config values:

{community} = The SNMP community, usually it’s “public” by default.
{ip_address} = host name or IP address of the device being monitored.
{device} = Some name describing the device being monitored, ex. firewall, router etc.

3. Create the working directory. If you open the config file with a text editor you can see the working directory. MRTG will store log files, html and graphs here. This should be a directory that is readable by a web server. In this example I’ll use the default, /var/www/mrtg.

mkdir /var/www/mrtg

4. Make MRTG collect data and create graphs every 5 minutes by adding a job to crontab. (crontab -e)

*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg-{device}.cfg

Replace {device} with the name used when you created the config file.

5. Create index file showing graphs for all interfaces of the device being monitored.

indexmaker /etc/mrtg-{device}.cfg > /var/www/mrtg/index.html

Replace {device} with the name used when you created the config file. If you changed the working directory you also need to modify it here.

6. Open the working directory in a browser, http://{ip_address}/mrtg

Replace {ip_address} with the host name or IP address of the web server. If you changed the working directory, this location may be different.

Comments 2
  • Koray Günel
    Posted on

    Koray Günel Koray Günel

    Author

    How can i add a device with SNMPv3 credentials?


  • Łukasz
    Posted on

    Łukasz Łukasz

    Author

    Thank you man 🙂