Install and Configure MRTG Graphs Linux / Network Graphs / Open Source
Article Submitted by Mr. Vishal Girish Joshi. I want to Thank him for his contribution for All Linux User’s Blog.
Ever wondered how you can easily graph your traffic load on network links through a simple grapher called MRTG.
Follow the below steps to configure mrtg to monitor your network usage and for misc troubleshooting in adverse times.
1) We just need a mrtg source / rpm file into our machine.
# yum install mrtg
2) Ensure snmp is enabled on the devices/servers we want to monitor
3) Create a directory of your wish in your www root folder (generally, /var/www/html)
In my scenario, i am monitoring my router/switches, so we need to enable snmp in that too. Also make sure that you have set the same community name (generally, `public`) on both sides.
After installing mrtg, we need to create configuration files using an in-built utility. So for that, go to your directory, created previously, and run the below commands.
# cfgmaker –global ’WorkDir: /var/www/html/Cisco-MRTG’ email@example.com > mrtg.cfg ( You can give any name to the config file)
This will create the cfg file, have a look into it. this file will have the mrtg configuration pulled from the respective remote end (via snmp).
4) After this, we need to create the index files using the utility, indexmaker, this will display the output of mrtg.cfg file in the html format.
# indexmaker mrtg.cfg > index.html ( Be sure you are in your respective newly created directory )
5) Now, sometimes you can directly run the mrtg command to start the mrtg. But sometimes, it fails. So here is the workaround.
# env LANG=C /usr/bin/mrtg /var/www/html/Cisco-MRTG/mrtg.cfg (This will build up your first mrtg graphs and webpage)
If still errors, then run the above command for 2-3 times. Error will be gone automatically.
6) Also put the below code into your crontab
*/5 * * * * env LANG=C /usr/bin/mrtg /var/www/html/Cisco-MRTG/mrtg.cfg
7) Open the browser and type-in your url
For eg: 126.96.36.199/mrtg
If you are not able to access the url, go to /etc/httpd/conf.d/mrtg.conf. Here you can set different directives of apache, like,
Alias, Location, Authentication, etc according to your needs.
I generally prefer as setting Alias directive as ` Alias /mrtg /var/www/html/Cisco-MRTG ` and then allow the ip addresses you want to allow to view the mrtg graphs. You can also set the authentication parameters as per your requirement over htaccess, ldap, etc.
Hope this guide successfully helps you to set up mrtg for your organization.
Have a nice day and enjoy Linux.
Thanks to Mr. Vishal Joshi for the article.
You can also Submit Article by Visiting http://www.tejasbarot.com/submit-an-article/
Hope this will helps you all, If you face any issue regarding the same or its not working for you some how then please raise your questions / issues at http://linuxforums.tejasbarot.com
If you like this then Please Click Google +1 Button and Show Your Support. Your Support will encourage me to write more articles.
Ask for Linux Commercial Support :- http://www.tejasbarot.com/linux-commercial-support/
All Linux User’s Blog Mobile Applications :- http://www.tejasbarot.com/download-mobile-apps/
Please Keep in Touch with Social Networking :-
Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Enjoy MRTG Enjoy Network Graphing Enjoy Linux Enjoy Open Source