1.1Installing MRTG in Debian
Install mrtg by typing ‘apt-get install mrtg’ and install apache by typing ‘apt-get install apache or apache2’ which ever you prefer.
Create a directory to store the configuration files in /etc called mrtg.d.
Change directory to mrtg.d and run cfgmaker with the snmp community name and the address of what you want to monitor piped to a config file of that devices name: e.g. cfgmaker public@192.168.1.2 > switch.cfg
You will have to modify the .cfg file you made for what we will be doing in apache. Vi your .cfg file and in the uncommented working dir make sure for debian it is “/var/www/mrtg/switch do not append the .cfg suffix as you will be making a directory called “switch”.
Change to “/var/www” and make a directory called mrtg and in that make a directory called “switch”. As a note this is where all the directories for every device that you wish to monitor will be.
Inside of the switch directory you created run mrtg three times to collect data and clear the warnings. The command would be “/usr/bin/mrtg /etc/mrtg.d/switch.cfg”. It doesn’t matter where you type this because we gave absolute paths but it is the most convenient.
Run indexmaker with arguments as “ /etc/mrtg.d/switch.cfg > index.html. What we are doing is for each device you are monitoring it has its own folder and inside that folder it has it’s own index page so in the server you would be looking for
http://www.yourwebsite.com/mrtg/switch/index.html
Now all that is left for the web server is to make a default index.html with links to the devices.
Last step is to check out your cron because you want the info on the website to update every so often right? Well in debian you go to /etc/cron.d. If there is an mrtg entry you just vi that and copy the default entry and where every you see a mrtg.cfg or mrtg.log change it to the your switch or device your monitoring. In our case I would change it to switch.cfg and switch.log
There you go have fun with it