samedi, mars 15, 2008

Install MRTG on ubuntu : a tutorial

In this post, I show how to install and use MRTG, a graphical tool to monitor the traffic load on network-links.

The manipulations described here apply to linux Ubuntu 7.10 Gusty.

As prerequisite, perl and apache need to be installed.

To get MRTG and its database rrdtool, install the binary packages:

apt_get install mrtg
apt_get install rrdtool
apt-get install librrds-perl


To check the install, just type "mrtg" as root in a console. (tip: on Ubuntu, "type sudo -s" to keep a console logged as root and not to have to precede each line with "sudo")
You may get the following error occurred:

-----------------------------------------------------------------------
ERROR: Mrtg will most likely not work properly when the environment
variable LANG is set to UTF-8. Please run mrtg in an environment
where this is not the case. Try the following command to start:

env LANG=C /usr/bin/mrtg
-----------------------------------------------------------------------

Then just type:
export LANG=C

If you type "mrtg" again, you should have no output, because it waits for a config file in parameter.

MRTG gets its data from an SNMP server, so you need one.
If you decide to analyze a router, make sure SNMP is enable. If you monitor your local machine,
You may need to install "snmpd"

To install the server :
apt-get install snmpd
and the client :
apt-get install snmp

After snmpd install, you can check it is running
ps -A | grep snmpd

To configure SNMP, you can either edit /etc/snmp/snmpd.conf
or more simply run the following command:
snmpconf -g basic_setup

This utility prompts questions about the equipment to monitor with SNMP and generates the config file.

Restart snmpd :
/etc/init.d/snmpd restart

And type the following command to check if you to retrieve the SNMP values:
snmpwalk -v 1 -c public localhost system

Now we're ready to use MRTG. First generate the config file with the command:

cfgmaker 127.0.0.1 --output test.cfg

Edit the generated file "test.cfg" and check the WorkDir setting, it should be already set. If not, do it:
WorkDir: /var/www/mrtg

A few line later, it should contqin an entry for each network interface MRTG has found querying SNMP.

Then add the folowing settings:

Refresh: 300
Interval: 5
logformat: rrdtool
RunAsDaemon: Yes

Refresh is to tell the browser to refresh every 300 seconds.
Interval , in minutes, the interval to query
logformat :rrdtool tells mrtg to save data in rrdtool database
RunAsDaemon : so the process runs as a service

Then start mrtg, by typing as root

mrtg test.cfg

If everything is ok, you will get

Daemonizing MRTG ...


Check now in /var/www/mrtg, you should have a rrdtool database file. It is name with the IP address and the network interface. In my case:
127.0.0.1_3.rrd

type to see the content:
rrdtool info 127.0.0.1_3.rrd

It should display something like:

ds[ds0].type = "COUNTER"
ds[ds0].minimal_heartbeat = 600
ds[ds0].min = 0.0000000000e+00
ds[ds0].max = 1.2500000000e+06
ds[ds0].last_ds = "14331604"
ds[ds0].value = 1.2166000000e+03


At least, setup 14all to generate the graphics.
Download it from http://my14all.sourceforge.net/
Choose to download : 14all.cgi v1.1p25

Rename the file with an extension .cgi and place it in the Apache cgi-bin directory :
/var/www/cgi-bin together with the MRTG config file.

In your browser:
http://localhost/cgi-bin/14all.cgi?cfg=test.cfg

You should see a page with graphs showing the traffic analysis of your network interface.
Here I am surfing for one hour on internet:


As an alternative to 14all, you may also check router2cgi
It works exactly the same but it is richer.

Commentaires:
buy tramadol online ultram side effects itching - where to buy tramadol online forum
 
buy tramadol online overdose of tramadol side effects - buy tramadol without rx
 
xanax online generic xanax gg 249 - street value xanax 2mg bars
 
buy tramadol online buy tramadol for dogs usa - tramadol online no prescription cod
 
xanax depression xanax grapefruit juice effects - xanax withdrawal like
 
buy tramadol without rx information on tramadol 50mg tablets - buy tramadol online no prescription usa
 
generic xanax xanax effects length - xanax overdose many
 
carisoprodol online carisoprodol vs skelaxin - carisoprodol 350 mg addictive
 
buy tramadol hcl long does tramadol overdose last - buy tramadol online in florida
 
generic xanax effects 1.5 mg xanax - xanax withdrawal blood pressure
 
buy tramadol online tramadol use addiction - can take 2 tramadol 50mg
 
buy tramadol online tramadol hcl 50 mg tab - tramadol for dogs euthanasia
 
carisoprodol 350 mg carisoprodol 350 mg tablets used - carisoprodol 350 mg how many to get high
 
buy tramadol online cloridrato de tramadol 100mg - need to purchase tramadol
 
buy tramadol online buy tramadol using mastercard - tramadol for dogs ok for people
 
buy tramadol no prescription cheap tramadol overnight shipping - tramadol 50mg capsules uses
 
buy cialis online buy cialis without perscription - cialis online legitimate
 
xanax online xanax class of drug - xanax side effects and pregnancy
 
xanax online much does generic xanax cost - there generic xanax xr
 
buy tramadol buy tramadol paypal - tramadol hcl buy
 
learn how to buy tramdadol tramadol for dogs side effects panting - buy real tramadol
 
buy tramadol tramadol for dogs bluelight - can you buy tramadol on the internet
 
http://landvoicelearning.com/#30896 tramadol discount coupons - tramadol 50 mg tablets side effects
 
http://landvoicelearning.com/#23561 buy cheapest tramadol online - tramadol online without rx
 
learn how to buy tramdadol buy tramadol american express - generic tramadol no prescription cod
 
tramadol 100mg suboxone for tramadol addiction - tramadol withdrawal in babies
 
buy ativan online can overdose ativan fatal - lorazepam dorom 20cpr 1mg
 
buy tramadol online que es tramadol hcl - tramadol journal
 
buy tramadol overnight buy tramadol hydrochloride - legal buy tramadol online united states
 
tramadol no rx buy tramadol online cod overnight - tramadol 50 mg opiate
 
http://ranchodelastortugas.com/#30416 alprazolam 1mg side effects - is xanax good for opiate withdrawal
 
Enregistrer un commentaire

Abonnement Publier les commentaires [Atom]





<< Accueil

This page is powered by Blogger. Isn't yours?

Abonnement Articles [Atom]