jueves, 31 de marzo de 2011

MRTG en debian squeeze 6.0



Instalamos MRTG y SNMPd:

apt-get install mrtg snmpd



Guardamos la config original por las dudas:

cp -pf /etc/mrtg.cfg /etc/mrtg.cfg.orig



Editamos el archive de configuracion del MRTG:

vim /etc/mrtg.cfg

# Global configuration
RunAsDaemon: yes
EnableIPv6: no
WorkDir: /var/www/mrtg
Options[_]: bits,growright
WriteExpires: Yes



Se agrega automaticamente solo al crontab:

cat /etc/cron.d/mrtg

*/5 * * * * root if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ]; then mkdir -p /var/log/mrtg ; env LANG=C /usr/bin/mrtg /etc/mrtg.cfg 2>&1 | tee -a /var/log/mrtg/mrtg.log ; fi


Configuramos la comunidad en la configuracion del snmpd:

vim /etc/snmp/snmpd.conf

agentAddress udp:192.168.1.100:161
rocommunity morsaRO default -V systemonly



Reiniciamos el snmp:

/etc/init.d/snmpd restart



Verificamos que escucha en el Puerto:

netstat -ano |grep :161

udp 0 0 192.168.1.100:161 0.0.0.0:* off (0.00/0/0)
udp 0 0 127.0.0.1:161 0.0.0.0:* off (0.00/0/0)



Verificamos con snmpwalk que podemos consultar por snmp en el localhost:

snmpwalk -v 2c -c morsaRO localhost



Agregamos la comunidad y un host al cual queremos monitorear:

cfgmaker morsaRO@localhost > /etc/mrtg.cfg
cfgmaker morsaRO@192.168.1.200 >> /etc/mrtg.cfg
mkdir /var/www/mrtg



Agregamos al index:

indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html



Accedemos por web:

https://192.168.1.100/mrtg/

No hay comentarios: