===== Instalación de SNMP ===== El paquete que se debe instalar es el siguiente: # aptitude install snmpd Lo primero que debemos verificar es que inicie automáticamente y configurar las interfaces que deseamos, ubicados en el archivo /etc/default/snmpd en Debian. NMPDRUN=yes SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' Nota: para que escuche sobre todas las interfaces debemos eliminar 127.0.0.1. Para que pueda escuchar IPs remotas, debemos cambiar 127.0.0.1 por nuestra red local definida en "comunity". Luego se debe configurar el archivo /etc/snmp/snmpd.conf (el original es solo un ejemplo). Aquí se asignan las interfaces que deseamos configurar, la comunidad (grupo de trabajo), el protocolo de snmp a usar y el nivel de acceso. # command name host/ip/default comunity com2sec public default public com2sec internet 208.51.140.118 internet com2sec mynet 10.48.2.0/24 mynet # command grp-name version comunity group public v1 public group public v2c public group public usm public group mynet v1 mynet group mynet v2c mynet group mynet usm mynet group internet v1 internet group internet v2c internet group internet usm internet # view config view all included .1 # access for groups r/w/info access public "" any noauth exact all all all access mynet "" any noauth exact all none none access internet "" any noauth exact all none none Para probar si esta bien instalado usaremos el comando: # snmpwalk -Os -c mi-grupo -v 1 host/ip system Si responde bien se verá un montón de información, en caso de que esté mal configurado, se vera la leyenda: "Timeout: No Response from localhost " En tal caso, revisar muy bien los nombres de los grupos y los permisos de acceso. ===== Instalación de CACTI ===== Cacti es un graficador de estadísticas basado en PHP/MySQL accesible vía interfase web. Para juntar la información, ejecuta un script que junta la información de los servidores que registremos en Cacti llamado /usr/share/cacti/site/poller.php Los paquetes a instalar son los siguientes: # aptitude install mysql-server apache2 libapache2-mod-php5 php5-mysql php5-cli php5-snmp # aptitude install cacti Utilizaremos el debconf para configurar Cacti, por lo tanto cuando nos pregunte si queremos usarlo seleccionamos la opcion "yes". Luego pide la clave de root de MySQL para poder crear la DB para Cacti. Luego crea el usuario cacti y nos pide una contraseña para ese usuario. Seleccionamos el servidor web a utilizar, en este caso apache2 y ya está listo el servidor. En este paso solo falta acceder a través de un explorador web al servidor. ===== Configuración de Cacti ===== Creating a new device To create a new device, first make sure you are in the "Console", if not, click on the "Console" tab on the top left and click on Create devices for network. This will bring you to a new page where you are going to give details about the SNMP host. Fill up the form and make sure you have the following value properly set: * Hostname to localhost or whichever url/address your SNMP server can be found at * Host Template to ucd/net SNMP Host * SNMP Community to mycommunity or whatever your community is called * SNMP Version to Version 1 * SNMP Port default is 161 which should be fine for 99% settings. Change accordingly to your SNMP server settings Then Click create and you should get to a page where you get something similar to: MySNMPServer (snmp.server.ip) SNMP Information System: Linux hostname kernel-version #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 Uptime: 980871 (0 days, 2 hours, 43 minutes) Hostname: hostname Location: Unknown (configure /etc/snmp/snmpd.local.conf) Contact: Root root@localhost (configure /etc/snmp/snmpd.local.conf) and not like: SNMP Information SNMP error If you get the latest output, this means that the connection between the manager and the SNMP host could not be established, either firewalled or refused by the host. Use snmpwalk -Os -c mycommunity -v 1 snmp.server.ip system to troubleshoot. 3.2. Creating a new Graph for a device OK, sweet, we have enabled our first host to be monitored by cacti. Now, let's add a few graphs. Click the "Create Graphs for this Host" and check the boxes you want to monitor (CPU Usage, Load Average, Memory Usage). Under "Data Query [SNMP - Interface Statistics]", check the interfaces you want to monitor and finaly in "Select a graph type" choose the kind of stats you want. I chose "In/Out Bytes with Total Bandwidth". Validate, and that's it, you will start monitoring some componenets of your device. Now, lets organize our graph tree. 3.3. Creating a Graph Tree Cacti graphs are organied in a tree. Each host could be a branch of that tree. We are now going to create a branch for our device. Create a graph tree by going to the left menu and click on "Graph Tree" and "add" on the right side of the new page. Enter a name to describe your device and click create. Add a "Tree Item" and select: Parent Item [root] Tree Item Type Host Host yourhost Graph Grouping Style Graph Template And create! Here we are!!! Now click on the "Graph" tab and select your host from the tree. Voila! Mind that you will need some times before you can see datas.