Multi Router Traffic Grapher (MRTG)¶
MRTG generates traffic graphs for your SNMP-enabled router. If your router does not support SNMP, take a look at MikroTik devices, which offer enterprise-grade routers at consumer prices.
MRTG is pre-installed in NEMS Linux 1.6+ and is available in NEMS Linux 1.3.x-1.5.x by way of a NEMS Update.
To enable SNMP on MikroTik RouterOS devices:
- In WinBox, open a new terminal.
- Type /snmp
- Type set enabled yes
If desired, you can add your contact name and location to your SNMP Trap in the MikroTik WebFig / WinBox under IP → SNMP.
In time, MRTG configuration will become part of NEMS SST. For the time being, a command must be entered in your NEMS Linux terminal in order to connect MRTG to your router:
Simply enter your router’s IP address and your trap community name when prompted, and the script will generate your MRTG config, activate it, and provide you with all links for detected SNMP sources on your router.
Please Note: mrtgsetup only supports the default public trap community at this time.
NEMS Linux includes check_mrtgtraf_nems. This is a custom wrapper for check_mrtgtraf.py which is itself a reworking of check_mrtgtraf.
You must first run mrtgsetup, otherwise the check command will have no data to work with.
Beyond the standard graphs that MRTG provides, you may also add the check_mrtgtraf_nems check command to your SNMP-capable router/switch host(s) and monitor any or all of their ports. For example, to monitor the Internet bandwidth usage, you can add a check command to monitor your WAN port. Then, if you want to monitor the bandwidth usage for a specific Ethernet port (for example, an employee or server who is known to use a lot of bandwidth), you can do so by adding a second check command to that host which targets the Ethernet port that user is connected to. This can also be handy for zoned networks where, for example, you may want to monitor the bandwidth usage of specific departments by connecting their uplink to a specific port on your monitored device. You may also use this to monitor the amount of bandwidth being consumed by users on your guest WiFi, and then notify the admin if the set thresholds are exceeded.
Check Command Arguments¶
Add the check_mrtgtraf_nems check command to your router host in NEMS NConf, using the following arguments:
- Port - This is the number associated with the SNMP. This will not correspond with traditional conventions, but rather is generated by the SNMP OID. You can find the number on the corresponding MRTG page following the header “Traffic Analysis for”. The number corresponds to the port to use for check_mrtgtraf_nems. You can find the MRTG graphs at https://nems.local/mrtg/
- Multiplier - What measurement you’d like to use for your thresholds. Available options are gb, mb or kb.
- Warn Up / Warn Down / Critical Up / Critical Down - Set your thresholds. Can be a positive floating point number or integer.