Você está na página 1de 14

4468

Monitoramento de Redes com o Zabbix 2.0

www.4linux.com.br

Projetos na sua empresa com a qualidade dos treinamentos

ence Business Intelig lx8 F u/ .m va http://

BPM http://va.mu/EuiT

Servidor Java EE http://va.mu/FlyB

GED - ECM http://va.mu/Flx3

Integrao Continua http://va.mu/FlyD

PostgreSQL http://va.mu/EuhV

Monitoramento http://va.mu/EukN

Alta Disponibilidade http://va.mu/FNbL

Virtualizao http://va.mu/Flxl

Groupware Yj u/FN http://va.m

Backup http://va.mu/Flxr

Infraestrutura Web http://va.mu/Flxi

Auditoria e Anlise http://va.mu/Flxu

Segurana http://va.mu/Flxy

Ensino Distncia http://va.mu/Flxc

Implantao garantida http://va.mu/GcFv

Contedo
5 Compilar e congurar os agentes Zabbix no Debian/Ubuntu 5.1 Instalao do agente por compilao . . . . . . . . . . . . . . . . . . . . 5.1.1 Gateway Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Instalao do agente por script . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Datacenter Server . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 File Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.3 Virtua Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Ativar monitoramento dos novos servidores . . . . . . . . . . . . . . . . 1 1 1 4 4 5 6 8

Captulo 5 Compilar e congurar os agentes Zabbix no Debian/Ubuntu


5.1 Instalao do agente por compilao
Agora chegou o momento de instalar o agente do Zabbix nas outras mquinas virtuais com GNU/Linux. O procedimento de instalao similar ao do servidor, mas no iremos habilitar a opo --enable-server"no "congure". Tambm no so necessrios todos as opes de "with"usadas acima. O agente certamente mais simples que o servidor em termos de funcionamento e s precisa do suporte a LDAP.

5.1.1 Gateway Server


Etapa 1: Baixar a fonte e desempacotar

1 2 3 4 5 6

root@gateway :~ # cd / usr / src root@gateway :~ # wget http :// ufpr . dl . sourceforge . net / project / zabbix / ZABBIX %2 Latest %2 Stable /2. .6/ zabbix -2. .6. tar . gz # ## OBS .: Pacote j est na m quina - N O PRECISA BAIXAR . root@gateway :~ # tar xf zabbix -2. .6. tar

Etapa 2: Instalar dependncias para compilao

4Linux - www.4linux.com.br

1 2 3

root@gateway :~ # apt - get install build - essential make pkg - config root@gateway :~ # aptitude install postgresql - server - dev -9.1 ( Selecione a op o N e depois Y Y para resolver as dependencias ) root@gateway :~ # cd / usr / src / zabbix -2. .6

Etapa 3: Congurar o agente

root@gateway :~ # ./ configure -- prefix =/ opt / zabbix -2. .6 -- mandir =/ usr / share / man -- disable - server -- disable - static -- enable - proxy -enable - agent -- with - postgresql

A opo enable-proxy foi usado neste servidor que tambm ser um Zabbix Proxy.

Etapa 4: Compilar e instalar

1 2 3

root@gateway :~ # make - j2 root@gateway :~ # make install root@gateway :~ # ln - svf / opt / zabbix -2. .6 / opt / zabbix

Etapa 5: Remover arquivos ps instalao

1 2 3

root@gateway :~ # rm / opt / zabbix -2. .6/ sbin / zabbix_agent root@gateway :~ # rm - rf / opt / zabbix / etc / zabbix_agent * ( CUIDADO !!) root@gateway :~ # strip -- strip - all / opt / zabbix -2. .6/*/*

Etapa 6: Criar usurio e grupo Zabbix

1 2

root@gateway :~ # groupadd zabbix root@gateway :~ # useradd -g zabbix -m -s / bin / bash zabbix

Monitoramento de Redes com o Zabbix 2.0

4Linux - www.4linux.com.br Etapa 7: Criar diretrios do Zabbix

1 2

root@gateway :~ # mkdir / var /{ log , run }/ zabbix -p root@gateway :~ # chown zabbix . / var /{ run , log }/ zabbix -R

Etapa 8: Congurar arquivos e permisses

1 2 3 4 5 6 7 8 9 10 11 12 13

root@gateway :~ # cd / usr / src root@gateway :~ # tar xf zabbix - agent -2. - config . tar -C / opt / zabbix root@gateway :~ # tar xf zabbix - agent - bootscript - debian . tar -C / root@gateway :~ # chown root . zabbix / opt / zabbix / etc -R root@gateway :~ # find / opt / zabbix / etc - type d - exec chmod root@gateway :~ # find / opt / zabbix / etc - type f - exec chmod root@gateway :~ # chmod 75 / etc / init . d / zabbix - agentd 75 64 {} \; {} \;

root@gateway :~ # vim / opt / zabbix / etc / agentd . d / passivechecks . conf # ## Modificar a linha 8 de acordo com a linha abaixo : Server =127. . .1 ,192.168.2 .2 ,192.168.2 .1

Etapa 9: Congurar PATH do sistema

1 2 3

root@gateway :~ # vim / etc / profile . d / zabbix - path . sh export PATH = " $PATH :/ opt / zabbix / bin :/ opt / zabbix / sbin "

root@gateway :~ # . / etc / profile

Etapa 10: Congurao do agente na inicializao e testes de comunicao

Monitoramento de Redes com o Zabbix 2.0

4Linux - www.4linux.com.br
1 2 3 4 5 6 7 8

root@gateway :~ # insserv -v zabbix - agentd root@gateway :~ # service zabbix - agentd start root@gateway :~ # ps u -C zabbix_agentd root@gateway :~ # zabbix_get -s 127. . .1 -k agent . ping root@gateway :~ # zabbix_get -s 192.168.2 .1 -k agent . ping root@gateway :~ # zabbix_get -s gateway -k agent . ping

1 2 3

# ## A partir da MAQUINA Zabbix Server - 192.168.2 root@zabbixserver :~ # zabbix_get -s 192.168.2

.2

.1 -k agent . ping

5.2 Instalao do agente por script


5.2.1 Datacenter Server
Para realizar a instalao do agente do zabbix de uma maneira automtica, desenvolvemos um script de instalao do agente. Etapa 1: Instalar dependncias para compilao

1 2

root@datacenter :~ # cd / usr / src root@datacenter :~ # apt - get install build - essential make pkg - config

Etapa 2: Executar script de instalao SINTAXE: [Script.sh] [IP do Servidor] [IP do Host]

Os

pacotes

.tar(zabbix-agent-2.0-cong.tar

zabbix-agent-bootscript-

debian.tar) e a fonte do zabbix (zabbix-2.0.6.tar), devem estar no mesmo local que o script.

Monitoramento de Redes com o Zabbix 2.0

4Linux - www.4linux.com.br

1 2

root@datacenter :~ # chmod + x zabbix - agent -2. - install - debian . sh root@datacenter :~ # ./ zabbix - agent -2. - install - debian . sh 2. .6 192.168.2 .2 192.168.2 .4

Etapa 3: Congurar PATH do sistema

1 2 3

root@datacenter :~ # vim / etc / profile . d / zabbix - path . sh export PATH = " $PATH :/ opt / zabbix / bin :/ opt / zabbix / sbin "

Etapa 4: Congurao do agente na inicializao e testes de comunicao

1 2 3 4 5

root@datacenter :~ # ps u -C zabbix_agentd root@datacenter :~ # zabbix_get -s 127. . .1 -k agent . ping root@datacenter :~ # zabbix_get -s 192.168.2 .4 -k agent . ping root@datacenter :~ # zabbix_get -s datacenter -k agent . ping

1 2 3

# ## A partir da MAQUINA Zabbix Server - 192.168.2 root@zabbixserver :~ # zabbix_get -s 192.168.2

.2

.4 -k agent . ping

5.2.2 File Server


Etapa 1: Instalar dependncias para compilao

1 2

root@fileserver :~ # cd / usr / src root@fileserver :~ # apt - get install build - essential make pkg - config

Etapa 2: Executar script de instalao SINTAXE: [Script.sh] [IP do Servidor] [IP do Host]

Monitoramento de Redes com o Zabbix 2.0

4Linux - www.4linux.com.br

Os

pacotes

.tar(zabbix-agent-2.0-cong.tar

zabbix-agent-bootscript-

debian.tar) e a fonte do zabbix (zabbix-2.0.6.tar), devem estar no mesmo local que o script.

1 2

root@fileserver :~ # chmod + x zabbix - agent -2. - install - debian . sh root@fileserver :~ # ./ zabbix - agent -2. - install - debian . sh 2. .6 192.168.2 .2 192.168.2 .6

Etapa 3: Congurar PATH do sistema

1 2 3

root@fileserver :~ # vim / etc / profile . d / zabbix - path . sh export PATH = " $PATH :/ opt / zabbix / bin :/ opt / zabbix / sbin "

Etapa 4: Congurao do agente na inicializao e testes de comunicao

1 2 3 4 5

root@fileserver :~ # ps u -C zabbix_agentd root@fileserver :~ # zabbix_get -s 127. . .1 -k agent . ping root@fileserver :~ # zabbix_get -s 192.168.2 .6 -k agent . ping root@fileserver :~ # zabbix_get -s fileserver -k agent . ping

1 2 3

# ## A partir da MAQUINA Zabbix Server - 192.168.2 root@zabbixserver :~ # zabbix_get -s 192.168.2

.2

.6 -k agent . ping

5.2.3 Virtua Switch


Para realizar a instalao do agente do zabbix de uma maneira automtica, desenvolvemos um script de instalao do agente.

Monitoramento de Redes com o Zabbix 2.0

4Linux - www.4linux.com.br Etapa 1: Instalar dependncias para compilao

1 2

root@virtuaswitch :~ # cd / usr / src root@virtuaswitch :~ # apt - get install build - essential make pkg - config

Etapa 2: Executar script de instalao SINTAXE: [Script.sh] [IP do Servidor] [IP do Host]

Os

pacotes

.tar(zabbix-agent-2.0-cong.tar

zabbix-agent-bootscript-

debian.tar) e a fonte do zabbix (zabbix-2.0.6.tar), devem estar no mesmo local que o script.

1 2

root@virtuaswitch :~ # chmod + x zabbix - agent -2. - install - ubuntu . sh root@virtuaswitch :~ # ./ zabbix - agent -2. - install - ubuntu . sh 2. .6 192.168.2 .2 192.168.2 .1

Etapa 3: Congurar PATH do sistema

1 2 3

root@virtuaswitch :~ # vim / etc / profile . d / zabbix - path . sh export PATH = " $PATH :/ opt / zabbix / bin :/ opt / zabbix / sbin "

Etapa 4: Congurao do agente na inicializao e testes de comunicao

1 2 3 4 5

root@virtuaswitch :~ # ps u -C zabbix_agentd root@virtuaswitch :~ # zabbix_get -s 127. . .1 -k agent . ping root@virtuaswitch :~ # zabbix_get -s 192.168.2 .1 -k agent . ping root@virtuaswitch :~ # zabbix_get -s virtualswitch -k agent . ping

Monitoramento de Redes com o Zabbix 2.0

4Linux - www.4linux.com.br

1 2 3

# ## A partir da MAQUINA Zabbix Server - 192.168.2 root@zabbixserver :~ # zabbix_get -s 192.168.2 .1

.2 -k agent . ping

5.3 Ativar monitoramento dos novos servidores


Aps instalar o Zabbix Agent nos servidores da Dexter, clique na aba Conguration -> Hosts e no status Not monitored para ativar o monitoramento. Ative os seguintes servidores: Gateway Datacenter File Server Virtual Switch

Figura 5.1: Servidores Debian e Ubuntu com monitoramento ativo

Monitoramento de Redes com o Zabbix 2.0

Você também pode gostar