MRTG is a graphing tool that can be used to monitor network services and draw graphs showing traffic trends. It can easily be integrated with Stingray to allow monitoring of traffic to a site.
SNMP support needs to be enabled on each Stingray machine that you wish to monitor. To turn on support, go to the Administration Server for each machine, and enable it on the System -> SNMP page. You can select port and community string, but for this example we will assume you use '161' and 'private' as the port and community string respectively.
Once SNMP is enabled, you should be able to request snmp values from a Stingray using 'snmpget':
$ snmpget -M /usr/share/snmp/mibs:$ZEUSHOME/zxtm/etc -mALL -v1 -c public stingrayhost totalBytesInLo.0
ZXTM-MIB::totalBytesInLo.0 = Counter32: 140113170
If this works, then SNMP is working correctly. For more information on installing SNMP, check out Installing the Stingray SNMP MIBs.
For this demonstration, we will use MRTG and RRDtool. Using RRDtool has the advantage that the images are generated on the fly when they are viewed rather than every 5 minutes when the data is collected. MRTG and RRDtool do not need to be located on the Stingray machine or virtual appliance, they can be any machine that has the ability to communicate with Stingray via SNMP.
The method of installation of MRTG and RRDtool will depend on your operating system, e.g. on Debian Linux you can use the apt tool to install them.
Before you configure MRTG you need to decide where the docroot of the website (that will display the graphs) will be, and where to store the raw data. For this demonstration we will use /data/mrtg/data and /data/mrtg/docroot respectively.
Create a MRTG configuration file called /data/mrtg/docroot/14all.cfg :
Title[stingray_traffic]: Stingray - Traffic
PageTop[stingray_traffic]: <H1>Total traffic through Stingray</H1>
Target[stingray_traffic]: totalBytesInLo.0&totalBytesOutLo.0[email protected]
Title[stingray_conns]: Stingray - Current Connections
PageTop[stingray_conns]: <H1>Number of current connections to Stingray</H1>
Target[stingray_conns]: totalCurrentConn.0&totalCurrentConn.0[email protected]stingrayhost
Options[stingray_conns]: gauge, noo, nopercent
YLegend[stingray_conns]: Current conns
Legend1[stingray_conns]: Current Connections
You will also need the Stingray MIB, which you can download through the Admin Interface on the Security -> SNMP page. The MIB should be saved into /data/mrtg/mibs.
To check that mrtg is working correctly, run:
$ mrtg /data/mrtg/docroot/14all.cfg
If nothing is printed on stdout, then mrtg is configured correctly, and you should now have some data stored in /data/mrtg/data
Now add a cron job to call mrtg every 5 minutes:
0-55/5 * * * * root /usr/bin/mrtg /data/mrtg/data/14all.cfg
One last step is to create a website that can show the MRTG graphs. You configure the docroot to /data/mrtg/docroot and to run cgi scripts from anywhere.
Once the site is created, download the 14all.cgi script from http://my14all.sourceforge.net/ and save it in the docroot. You should now be able view the mrtg graphs by going to http://youwebsite/14all.cgi:
This article originally written by Crispin Flowerday, July 2005