Monitor Linux routers and firewalls with MRTG

Daily Newsletters

Sign up to ZDNet UK's daily newsletter.

ANALYSIS
MRTG, or Multi Router Traffic Grapher, is a popular monitoring and statistics tool for use on Linux platforms. It was designed to monitor the traffic load on network links, but it's highly extensible and configurable. Not only can you watch interfaces on routers and switches, but you can also analyze Linux system variables. Although this is usually done with the Simple Network Management Protocol (SNMP), MRTG also supports the use of local scripts to feed it data. The data is then converted into HTML with graphs in PNG format for a visual representation of your network. Overview of SNMP Before we delve too deeply into the installation and configuration of MRTG, it is important to understand how MRTG and SNMP work together. By default, MRTG will take an SNMP community string and a device hostname or IP address and discover what it needs to know. This is done by polling Management Information Base (MIB) objects predefined for all SNMP-ready devices. A MIB is basically a database of variables that corresponds to a system value. Basic examples include information such as system name, interface type, and uptime. Most vendors will have MIBs for their line of products, and these will conform to SNMP standards. On the device, SNMP then needs to be enabled and a community string set. Such configurations will vary from vendor to vendor and sometimes from device to device. On Cisco products, for instance, the configuration command snmp-server is used as follows: snmp-server community c1sc0 RO
This informs the Cisco IOS to provide read-only access to a querying SNMP tool that provides the community string c1sc0. It is best that you treat SNMP strings like passwords and configure them appropriately. SNMP is probably already configured and running if you currently use other network and system monitoring tools, such as HP OpenView, Cisco Works, or OpenNMS. Linux will also need to be configured to provide real-time data to MRTG. This can be done with SNMP or through the use of local scripts. To listen for incoming SNMP requests, you will need to install and configure snmpd. Configuration is done through the snmpd.conf file and requires you to set your community string. For a standard UCD SNMP implementation, the line in snmpd.conf will look something like this: com2sec readonly  default       liNuX42
Notice that once again, we are giving only read-only access to SNMP agents. Read-write access is also configurable, but if you don't need it, don't configure it. With read-only, you will be able to view only statistics and configuration options. Although this is something that should be monitored closely for security reasons, it is not nearly as dangerous as allowing remote commands to be executed via SNMP. Installing and configuring MRTG MRTG, like more and more packages these days, should be available through your favorite automated installer. So whether it is APT or up2date, that is usually the quickest way to get it onto your system. Alternatively, source and RPM distributions are available from the maintainer's site at MRTG.org. MRTG has a number of dependencies as well, the most important being Perl, gd, libpng, and zlib. Keep this in mind during installation if you encounter problems. Source code installation follows the standard scheme with: tar xpfz mrtg-2.9.18.tar.gz ./configure make make install Installing with RPM is also easy. The package name may vary, but you simply use the command:
rpm --ivh mrtg-2.9.18.rpm Once MRTG is installed on your system, you may need to configure a Web directory where it will place its HTML and PNGs for viewing. Use mkdir to create a directory called mrtg under your main HTTP path and modify your permissions. For example: mkdir /var/www/mrtg chmod 755 /var/www/mrtg The next step is to create a configuration for MRTG to use. The quickest way to do this is by running cfgmaker and passing it the SNMP community string and device and outputting it to a text file, like this:
cfgmaker  c1sc0@192.168.66.72 > /etc/mrtg.cfg Then, edit the new mrtg.cfg file and add a line listing the path to your working directory (where your MRTG-related files will be stored), like this: WorkDir: /var/www/mrtg Note that the device can be represented as either an IP address or a hostname. Also, cfgmaker can support a variety of options and settings at the command line, depending on the version. The best way to get started, though, is to use the default options. You can always make changes directly to the configuration file later.

Talkback

ur concept is good.
please give examples with ur concepts
thank u

via Facebook 23 December, 2005 10:27
Reply

Post your comment

In order to post a comment you need to be registered and logged in.

You can also log in with Facebook. Log in or create your ZDNet UK account below

  • Login

Will not be displayed with your comment

By signing up for this service, you indicate that you agree to our Terms and Conditions and have read and understood our Privacy Policy. Questions about membership? Find the answers in the Community FAQ

Get ZDNet UK's daily newsletter

Enter your email address to sign up

ZDNet UK Live

apexwm

All of the feedback regarding using a touch monitor for a desktop PC is right on. Several months ago, we installed a "demo" multitouch all-in-one...

2 hours ago by apexwm on Windows 8 could speed multi-monitor uptake
191706

anyone wanting to triple boot *their* own Mac

3 hours ago by 191706 on xTreme Triple Booting: Linux, Mac & Windows
SoapyTablet

Cont.. Biggest Bugbear: Win7's stop-animate-go approach to work, you develop a staggered (not in the above alchohol sense of the word) approach to...

3 hours ago by SoapyTablet on Windows 8 could speed multi-monitor uptake
SoapyTablet

Ah the joys of Windows 8 Consumer Preview... If Windows 7 was 'Vista with Lipstick', whats Windows 8? Vista with Lipstick, the morning after?...

3 hours ago by SoapyTablet on Windows 8 could speed multi-monitor uptake
daveveej

Though the metro look is quite cool on the windows mobile platform I think that think that microsoft ARE MESSING THINGS UP because what has they...

4 hours ago by daveveej on Windows 8 could speed multi-monitor uptake
Custonian

I agree, we have a few touch screen monitors in work but as Windows7 and the applications we use are not touch screen friendly (the size of the...

4 hours ago by Custonian on Windows 8 could speed multi-monitor uptake
archerthom

I find it amusing that Microsoft added the mouse, which was deemed awkward, but people were forced to use it so it stuck, and now they're saying,...

7 hours ago by archerthom on Windows 8 could speed multi-monitor uptake
BrownieBoy

Agree with other comments. Nobody's going to start reaching out to start tapping their desktop monitors with their fingers. Their arms would tire...

15 hours ago by BrownieBoy on Windows 8 could speed multi-monitor uptake
Random_Error

The only way a touch monitor would be any good is if it were horizontal on the desk, with a virtual keyboard so you could do away with that as well...

21 hours ago by Random_Error on Windows 8 could speed multi-monitor uptake
JBDragon

This is just dumb! Forget that I think Windows 8 will bomb, but really, people are going to go out and buy touch Monitors now??? Just pretend...

23 hours ago by JBDragon on Windows 8 could speed multi-monitor uptake
Jake Rayson

@Andy Bolstridge > Unfortunately, we need the majority to work 9-5 And therein lies the lie. I work very hard indeed for my idleness, early starts...

24 hours ago by Jake Rayson on The Idle Self-employed
Burn-IT

What happens when one hosting platform "acquires data" from another? If I forced the first one to remove it, who is responsible for chasing the...

1 day ago by Burn-IT on Google picks holes in EU's 'right to be forgotten'
JohnTalich

iSpring Pro is a nice tool, that allows PowerPoint to SCORM conversion. They also have free tool, that also generates SCORM compliant courses.

1 day ago by JohnTalich on How To Convert PowerPoint To SCORM Compliant Course
aaron.sloman

I think the answer to the question requires a deeper analysis of where the income can come from who else is now competing for it, who else will be...

2 days ago by aaron.sloman on The three big questions about Facebook's IPO
Brent Pieczynski

Your correctness about Government websites not being compliant with their own websites is correct. Most criticism of other people takes so many...

2 days ago by Brent Pieczynski on Privacy watchdog to chase big companies over cookie law
Kelvyn Taylor

802.11ac does promise some tricks to improve range & reliability, but not sure how these will work in practice until I get real products to play...

2 days ago by Kelvyn Taylor via Facebook on Next-generation 802.11ac routers
mrudang009

My wife and I love our new Kindle Fire. It's lightweight, easy to use and has a great interface. The first thing I recommend anyone with a new...

2 days ago by mrudang009 on Waterstones to sell Kindles with in-store offers
mrudang009

It basically unlocks all the Android marketplace apps and unlocks the device. I am one very happy Kindle owner!

2 days ago by mrudang009 on Waterstones to sell Kindles with in-store offers
Burn-IT

Skittles with tapes and coffee cups. Old tapes so we didn't have to rewind them afterwards.

2 days ago by Burn-IT on Ten IT jobs to save up for those rare lulls
Fraud_fighter

What is mildly amusing to me is when someone thinks a strong password is as strong as one may need, when the truth is usernames and passwords are...

2 days ago by Fraud_fighter on Passwords are here to stay: get used to it