Instalando e configurando o CACTI

De Wiki do Ouro Minas Palace Hotel
Revisão de 16h38min de 22 de abril de 2015 por 2532252>Jefferson
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para navegação Ir para pesquisar

Instalação e configuração de monitoramento com CACTI

Introdução

Procedimentos para instalação do cacti em sistemas operacionais Linux CentOS versão 5.x e 6.3, deve ser levando em consideração as diferentes versões e a localização de arquivos, tempo médio DOC 30 mins.

 LSB Version:	:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
 Distributor ID:	CentOS
 Description:	CentOS release 6.4 (Final)
 Release:	6.4
 Codename:	Final


Instalação dos softwares necessários utilizando o YUM

 yum install mysql-server
 yum install net-snmp net-snmp-utils
 yum install cacti php-snmp
 yum install cacti-spine.x86_64 --enablerepo=rpmforge


Configuração do servidor apache para aceitar conexões remotas

 # vi /etc/httpd/conf.d/cacti.conf
 Alias /cacti    /usr/share/cacti
 <Directory /usr/share/cacti/>
       <IfModule mod_authz_core.c>
               # httpd 2.4
               Require host localhost
       </IfModule>
       <IfModule !mod_authz_core.c>
               # httpd 2.2
               Order deny,allow
               Allow from all
               Allow from localhost
       </IfModule>
 </Directory>
 <Directory /usr/share/cacti/install>
       # mod_security overrides.
       # Uncomment these if you use mod_security.
       # allow POST of application/x-www-form-urlencoded during install
       #SecRuleRemoveById 960010
       # permit the specification of the rrdtool paths during install
       #SecRuleRemoveById 900011
 </Directory>
 <Directory /usr/share/cacti/log>
       <IfModule mod_authz_core.c>
               Require all denied
       </IfModule>
       <IfModule !mod_authz_core.c>
               Order deny,allow
               Allow from all
       </IfModule>
 </Directory>
 <Directory /usr/share/cacti/rra>
       <IfModule mod_authz_core.c>
               Require all denied
       </IfModule>
       <IfModule !mod_authz_core.c>
               Order deny,allow
               Allow from all
       </IfModule>
 </Directory>

Reiniciando os serviços necessários

 # service httpd restart
 # service mysqld start
 # chkconfig mysqld on
 # chkconfig httpd on

Configurando o MySQL

Aqui estou considerando que o servidor não tem nenhum banco configurado e que a versão do cacti é a 0.8.8a-2

 # mysqladmin --user=root create cacti
 # cd /usr/share/doc/cacti-0.8.8a/
 # cd /var/www/cacti
 # mysql cacti < cacti.sql
 # mysql
 # mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';
 # mysql> flush privileges;
 # mysql> quit
 # cd /usr/share/cacti/include/ ou /var/www/cacti
 # vi config.php
   ...
   $database_type = "mysql";
   $database_default = "cacti";
   $database_hostname = "localhost";
   $database_username = "cacti";
   $database_password = "cacti";
   ...
 # cd ..
 # chown -R cacti rra/ log/

Configurando o spine

 # usermod -s /bin/bash cacti
 # crontab -e
 ...
   */5 * * * * su - cacti -c "php /usr/share/cacti/poller.php > /dev/null 2>&1"
 ...
 # vi /etc/spine.conf
 ...
 DB_Host         localhost
 DB_Database     cacti
 DB_User         cacti
 DB_Pass         cacti
 DB_Port         3306
 DB_PreG         0
 ...

Configurando o Cacti

Abra o navegador internet e aponte para o endereço do servidor configurado e siga as instruções para o término da configuração.

http://servidor.cancella.com.br/cacti

Login: admin Senha: admin

Item de menu: Settings e depois Paths Spine Poller File Path: /usr/bin/spine Poller type: spine

Configurando o net-snmpd nos servidores que serão monitorados

 # yum install net-snmp net-snmp-utils
 # cp /usr/share/doc/net-snmp-5.5/EXAMPLE.conf /etc/snmp/snmpd.conf
 # vi /etc/snmp/snmpd.conf
   ...
   agentAddress  udp:127.0.0.1:161
   agentAddress  udp:10.25.10.9:161
   ...
   view   systemonly  included   .1.3.6.1.2.1
   view   systemonly  included   .1.3.6.1.2.1.25.1.1
   ...
   rocommunity public  default    -V systemonly
   rocommunity secret  10.25.10.0/24
   ...
 # service snmpd start
 # chkconfig snmpd on
 # snmpwalk -Os -v 2c -c public localhost

Alterando a senha de admin do Cacti

 # mysql -u root cacti
 # mysql> update user_auth set password = MD5('nova-senha') where username = 'admin';

Problemas com Time Zone

Se ocorrer mensagens de erro com o timezone semelhante a esta:

PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRT/-3.0/no DST' instead in /usr/share/cacti/lib/functions.php on line 486

Edite o arquivo /etc/php.ini e ajuste a variável time_zone

 date.timezone = 'America/Sao_Paulo'

+55-31-8456-6829 - +55-31-3281-8901 (discussão) 09h30min de 4 de junho de 2013 (BRT)

Adicionar Host Windows

Primeiro habilitar o SNMP no windows, painel de controle > adicionar e remover programas > ativar ou desativar recursos do Windows > marcar PROTOCOLO SNMP e PROVEDOR DE SNMP

Apos isto, ir em Ferramentas administrativas > Serviços > Abrir o Serviço SNMP e na aba Segurança, desmarcar a caixa Enviar interceptação de autenticação > Adicionar Comunidade (Ex: CANCELLA_PUBLIC) > Marcar Aceitar pacotes SNMP de qualquer host > ok e reiniciar o serviço SNMP