#MRTG in Ubuntu Lucid Ionel Mocanu MRTG in Ubuntu Lucid — Ionel Mocanu
Skip to content
 

MRTG in Ubuntu Lucid

Se instaleaza mrtg, snmp si serverul apache:
root@router1:~# apt-get install mrtg mrtg-contrib mrtgutils snmp snmpd
Intai configuram snmp.
In fiserul /etc/snmp/snmpd.conf este necsar sa se specifice comunitatea SNMP pentru statia locala (implicit pentru readonly se foloseste public, iar pentru readwrite private):
com2sec readonly default ethernet
Se restarteaza snmp:
root@router1:~# /etc/init.d/snmpd restart
* Restarting network management services:

Pentru statia locala folosim ethernet, iar pentru monitorizarea unor access-pointuri wireless vom folosi numele wireless.

Pe access-point, snmp-ul se configureaza astfel:

Daca se foloseste tcp wrappers este necesar ca in /etc/hosts.allow sa se adauge snmpd: IP-ul statiei si/sau snmpd: 127.0.0.1

Verificam daca putem colecta informatii:
root@router1:~# snmpwalk 127.0.0.1 -c ethernet -v2c interfaces | grep -i speed
IF-MIB::ifSpeed.1 = Gauge32: 10000000
IF-MIB::ifSpeed.2 = Gauge32: 100000000
IF-MIB::ifSpeed.3 = Gauge32: 100000000

Daca nu obtinem valorile corecte, adaugam in fisierul /etc/snmp/snmpd.conf, interface eth0 6 100000000 (pentru o placa de retea 100Mbit)

root@router1:~# snmpwalk 127.0.0.1 -c ethernet -v1 interfaces | grep -i descr
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: eth1

Pentru access-point:
root@router1:~# snmpwalk 192.168.101.26 -c wireless -v2c interfaces | grep -i speed
IF-MIB::ifSpeed.1 = Gauge32: 54000000
IF-MIB::ifSpeed.2 = Gauge32: 100000000

root@router1:~# snmpwalk 192.168.101.26 -c wireless -v2c interfaces | grep -i descr
IF-MIB::ifDescr.1 = STRING: Wireless 802.11G
IF-MIB::ifDescr.2 = STRING: Ethernet

Se genereaza fisierul de configurare pentru mrtg:
root@router1:~# cfgmaker ethernet@localhost > /etc/mrtg.cfg
root@router1:~# cfgmaker wireless@192.168.0.6 >> /etc/mrtg.cfg

Se genereaza fisierul index.html pentru web:
root@router1:~# indexmaker --columns=1 --title="Monitorizare Banda" \
> /etc/mrtg.cfg > /var/www/mrtg/index.html

Leave a Reply