Multi Router Trafic Grapher (MRTG)
Advertencia
Este documento es privado y es de uso exclusivo de sus autores y de SKINA TECH. Cualquier uso sin una autorización escrita es contra le ley de derechos de autor y de propiedad intelecutual, y será motivo de una acción legal.
Descripción
The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network-links. MRTG generates HTML pages containing GIF images which provide a LIVE visual representation of this traffic. Check http://www.ee.ethz.ch/stats/mrtg/ for an example. MRTG is based on Perl and C and works under UNIX and Windows NT. MRTG is being successfully used on many sites around the net. Check the MRTG-Site-Map.
Prerequistos
Suele ser necesario snmp por lo menos para permitir el analisis del ancho de banda
Procedimiento
A. Instalación básica
Instale mrtg y muy seguramente configure snmp y snmpd para que funcione.
## apt-get install mrtg mrtg-contrib
Debians: /etc/mrtg.conf
Mandrakes
Se suele poner todo en /etc/mrtg/ .. y mas facil
SNMP para Debian comente en snmpd.conf
com2sec paranoid default public
com2sec readonly default public
com2sec readwrite default private
…
syslocation gamma.skinatech.com
syscontact Root
B. Configuración
Hay un archivito de configuracion vacano en el directorio bin que se llama instale_mrtg.txt y ojo en donde quedan las paginas
web de salida.
1. Que se repita
El cron cuando se llama .. en /etc/cron.d/mrtg .. corrija para que use el /etc/mrtg/mrtg.cfg
2. Agregar otras utilidades
En mrtg-utils aparecen otras utilidades que permiten poder monitoriar otras cosas y por
supuesto en el mrtg.cf se ponen los bloques correspondientes a estos servicios.
cpuinfo:
.. toca montar un “sar” que esta en sysstat o en atsar y con eso se configura el cpuinfo.sh para que funcione.
#—————————————————————
Target[localhost_machine]: `/usr/local/sbin/cpuinfo.sh oficinamovil`
MaxBytes[localhost_machine]: 100
Options[localhost_machine]: gauge, nopercent
Unscaled[localhost_machine]: dwym
YLegend[localhost_machine]: % of CPU used
ShortLegend[localhost_machine]: %
LegendO[localhost_machine]: CPU System:
LegendI[localhost_machine]: CPU User:
Title[localhost_machine]: Oficinamovil
PageTop[localhost_machine]: <H1>CPU usage for Oficinamovil
</H1>
<TABLE>
<TR><TD>System:</TD><TD>Oficinamovil</TD></TR>
</TABLE>
#—————————————————————
Meminfo
Tambien tenemos una version adaptada en perl para que funcione memory.pl.
#—————————————————————
Target[localhost_memory]: `/usr/local/sbin/memory.pl localhost`
MaxBytes[localhost_memory]: 2000000000
Options[localhost_memory]: gauge, nopercent
Unscaled[localhost_memory]: dwym
YLegend[localhost_memory]: Memory used
ShortLegend[localhost_memory]: bytes
LegendO[localhost_memory]: Memory System:
LegendI[localhost_memory]: Memory User:
Title[localhost_memory]: Oficinamovil
PageTop[localhost_memory]: <H1>Memory usage for Oficinamovil
</H1>
<TABLE>
<TR><TD>System:</TD><TD>Oficinamovil</TD></TR>
</TABLE>
#—————————————————————
mailstats
Utilidad en perl para obtener estadisticas de correo de postfix obtenidas de (http://taz.net.au/postfix/mrtg/ )
#—————————————————————
Target[postfix]: `/usr/local/bin/mrtg-mailstats.pl`
Options[postfix]: gauge, growright
MaxBytes[postfix]: 50000
Title[postfix]: Postfix Statistics
PageTop[postfix]: <H1>Postfix Statistics</H1>
WithPeak[postfix]: dwmy
YLegend[postfix]: No. of messages
ShortLegend[postfix]: messages
LegendI[postfix]: Incoming:
LegendO[postfix]: Outgoing:
#—————————————————————
B. Problemas
1. Si el instale_mrtg.sh no le funciona
SNMP no funciona: o el control de acceso de snmp esta mal o simplemente esta abajo
OJO tambien tcpwrappers puede bloquear las vainas … en /etc/hosts.allow coloque
snmpd: ALL:ALLOW
2. Si el cpuinfo.sh no le funciona
En ubuntu y posiblemente en distribuciones debian, despues de instalar el sysstat este no arranca entonces toca habilitar la recolecion de informacion en /etc/default/sysstat cambiando ENABLED=“false” por ENABLED=“true”
FIN
15-Marzo-2006 J.E.Gomez v0.5 Primera version