Download it or see what it does
For a more complete installation guide see this tutorial by Bjoern Weiland
To use MRTS you need to install and set up MRTG and RRDtool.
If you are a Debian GNU/Linux user just do a
apt-get install mrtg rrdtool librrds-perl
if you use another OS, you can probably figure it out youself (or you could change to Debian).
It can also be a good idea to have some standard snmp tools installed (in Debian the package is "snmp"), and if you want to log network traffic on a machine, then install a snmp server (Debian: "snmpd").
Set up the snmp server to allow read access from the machine that is running MRTG (in our example the same machine that we are logging therefore we allow access to 127.0.0.1). If you are using Debian and have installed the snmpd package, you should change a line or two in "/etc/snmp/snmpd.conf". From:
com2sec paranoid default public #com2sec readonly default public #com2sec readwrite default private
#com2sec paranoid default public com2sec readonly 127.0.0.1 public #com2sec readwrite default private
and then restart the snmp server:
Now you have to find out what device you want to log. You can find this out with this command:
$ snmpwalk 127.0.0.1 public interfaces.ifTable.ifEntry.ifDescr interfaces.ifTable.ifEntry.ifDescr.1 = lo interfaces.ifTable.ifEntry.ifDescr.2 = eth0
in this example, we want to log traffic on the eth0, so the number we must use is 2.
Set up the mrtg config file (Debian: "/etc/mrtg.cfg") with something like this:
# Global configuration WorkDir: /var/log/mrtg WriteExpires: Yes Logformat: rrdtool #For every machine Target[name-of-machine]: 2:firstname.lastname@example.org MaxBytes[name-of-machine]: 12500000 Title[name-of-machine]: PageTop[name-of-machine]:
In the "Target" line you see the number 2 we found before, and in "MaxBytes" we have set how many bytes the device maximum can transfer (100Mbit * 1000000bit/Mbit / 8byte/bit = 12500000byte).
Now all you have to do is put mrts.php in the web scope and browse into it. (maybe you have to change something in the top of mrts.php)
You can't run the script in "safe mode php", if you server does this as standard, you have to put something like this in your httpd.conf:
<Directory "/path/to/mrts"> php_admin_value safe_mode 0 </Directory>