[FUG-BR] [OFF] Tutorial instalacao/configuracao NAGIOS
Diego
shaamangra em gmail.com
Sexta Setembro 5 15:43:50 BRT 2008
Isso ai vai la pro FUG, claro.
2008/9/5 Diego <shaamangra em gmail.com>:
> Ola, boa tarde lista! Montei ( com ajuda do amigo Wendel) um pequeno
> howto da configuracao do Nagios. Gostaria de opniao de voces e da
> verificacao de possiveis erros, obrigado ! abracos !!
>
>
>
> Nagios (R) é um sistema de monitoramento de rede e de aplicação. Ele
> vigia hosts e serviços que você especificar, alertando você quando as
> coisas correm mal. Algumas coisas que o Nagios pode fazer por voce:
>
>
> * Acompanhamento dos serviços de rede (SMTP, POP3, HTTP, NNTP, PING, etc);
> * Acompanhamento de recursos (processador carga, uso do disco, etc);
> * Design com simples plugins que permite aos usuários facilmente
> desenvolver seu próprio serviço de controle;
> * Contato com notificações quando ocorrerem problemas de serviço
> ou parada de hosts (por e-mail, pager, ou definido pelo metodo pelo
> usuário);
> * Log file rotation;
> * Interface web para visualização do atual estado de rede,
> notificação e problema histórico, arquivo de registro, etc.
>
> Ai vai um pequeno tutorial pra por o servico funcionando, para mais
> detalhes acesse http://www.nagios.org
>
>
>
> Bom, let`s go ! Com o usuario root, baixe e instale o apache:
>
> #cd /usr/ports/www/apache13; make install clean
>
>
> Edite o httpd.conf e insira as seguintes linhas:
>
> #vi /usr/local/etc/apache/httpd.conf
>
> ScriptAlias /nagios/cgi-bin /usr/local/www/nagios/cgi-bin/
> <Directory "/usr/local/www/nagios/cgi-bin">
> Options ExecCGI
> Order allow,deny
> Allow from all
> AuthName "Nagios Access"
> AuthType Basic
> AuthUserFile /usr/local/etc/nagios/htpasswd.users
> Require valid-user
> </Directory>
>
> Alias /nagios /usr/local/www/nagios
>
> <Directory "/usr/local/www/nagios">
> Options None
> AllowOverride None
> Order allow,deny
> Allow from all
> AuthName "Nagios Access"
> AuthType Basic
> AuthUserFile /usr/local/etc/nagios/htpasswd.users
> Require valid-user
> </Directory>
>
>
> Voce precisa definir o arquivo onde vai ficar o passwd dos usuarios autorizados:
>
> #touch /usr/local/etc/nagios/htpasswd.users
>
>
> #htpasswd -c /usr/local/etc/nagios/htpasswd.users ## caso queira
> mudar a senha, basta nao incluir o flag -c.
>
>
>
>
> Baixe e instale o nagios:
>
> #cd /usr/ports/net-mgmt/nagios; make install clean
>
> Os arquivos de configuracao do nagios ficam em /usr/local/etc/nagios.
> Os principais arquivos sao:
>
> cgi.cfg -> Esse arquivos diz onde o CGI vai
> encontrar os arquivos de configuracao.
> commands.cfg -> Os comandos que o nagios oferece e suas
> sintaxes. Aconselhavel da uma olhada.
> nagios.cfg -> Arquivo principal do nagios, aqui voce
> vai fazer o seguinte:
>
> # cd /usr/local/etc/nagios; vi nagios.cfg
>
>
> ## Aqui voce ira procurar pelos cfg_file, nele voce setara` onde
> estarao os arquivos de configuracao (objects):
>
> cfg_file=/usr/local/etc/nagios/teste.cfg <-- Fica a seu criterio
> definir o nome do arquivo.
>
> # vi teste.cfg
>
>
> ## Aqui esta` tudo para localhost, cabe a voce fazer as alteracoes!! ##
>
> ## timeperiod voce define `grupos com horarios`. Voce pode especificar
> diversos horarios. Aqui eu criei 3: 24x7 (24 horas, ## 7 dias), Hora
> de trabalho (de 9 ## as 17) e nonworkhours (no qual nao estamaremos
> trabalhando).
>
>
> define timeperiod{
> timeperiod_name 24x7
> alias 24 Hours A Day, 7 Days A Week
> sunday 00:00-24:00
> monday 00:00-24:00
> tuesday 00:00-24:00
> wednesday 00:00-24:00
> thursday 00:00-24:00
> friday 00:00-24:00
> saturday 00:00-24:00
> }
>
>
> define timeperiod{
> timeperiod_name workhours
> alias "Normal" Working Hours
> monday 09:00-17:00
> tuesday 09:00-17:00
> wednesday 09:00-17:00
> thursday 09:00-17:00
> friday 09:00-17:00
> }
> define timeperiod{
> timeperiod_name nonworkhours
> alias Non-Work Hours
> sunday 00:00-24:00
> monday 00:00-09:00,17:00-24:00
> tuesday 00:00-09:00,17:00-24:00
> wednesday 00:00-09:00,17:00-24:00
> thursday 00:00-09:00,17:00-24:00
> friday 00:00-09:00,17:00-24:00
> saturday 00:00-24:00
> }
> define timeperiod{
> timeperiod_name none
> alias No Time Is A Good Time
> }
>
> ## Contatos, a quem avisar caso algo ocorra:
>
> define contact{
> contact_name MY_NAME
> alias Administrador da Rede
> service_notification_period 24x7
> host_notification_period 24x7
> service_notification_options w,u,c,r
> host_notification_options d,u,r
> service_notification_commands notify-by-email ## MTA tem que ta configurado !
> host_notification_commands host-notify-by-email ## MTA tem que ta
> configurado !
> email email em email # email para qual o nagios vai mandar as notificacoes.
> }
>
>
> ## Voce pode definir quantos for preciso, por exemplo, um grupo para a
> equipe tecnica da empresa:
>
> define contact{
> contact_name local
> alias Equipe Tecnica da Empresa
> service_notification_period 24x7
> host_notification_period 24x7
> service_notification_options w,u,c,r
> host_notification_options d,u,r
> service_notification_commands notify-by-email
> host_notification_commands host-notify-by-email
> email email em email
> }
>
> ## Aqui voce define o grupo de contatos; quais vao ser os membros, etc.
>
> define contactgroup{
> contactgroup_name equipe-de-suporte
> alias EQUIPE DE SUPORTE
> members ponha-os-nomes-aqui
> }
>
> ## Definicao do host a ser monitorado
>
> define host{
> name servidor
> notifications_enabled 1
> event_handler_enabled 1
> flap_detection_enabled 1
> process_perf_data 1
> retain_status_information 1
> retain_nonstatus_information 1
> register 0
> }
>
>
> # localhost
> define host{
> use servidor
> host_name localhost \\ mude para o nome da sua maquina
> alias localhost \\ como a maquina pode ser chamada pelo nagios.
> address 127.0.0.1 \\ IP da maquina a ser monitorada
> check_command check-host-alive
> max_check_attempts 10
> notification_interval 120 \\ Tempo de notificacao, em segundos.
> notification_period 24x7 \\ Quando vai ser notificado?
> notification_options d,u,r
> contact_groups equipe-de-suporte \\ Quem vai ser notificado?
> }
> ## Voce tambem pode montar um grupo de hosts a ser monitorado:
>
> define hostgroup{
> hostgroup_name servidores
> alias servidores
> members localhost
> }
>
> ### Servicos, aqui eh a parte legal !
>
> define service{
> name generic-service
> active_checks_enabled 1
> passive_checks_enabled 1
> parallelize_check 1
> obsess_over_service 1
> check_freshness 0
> notifications_enabled 1
> event_handler_enabled 1
> flap_detection_enabled 1
> process_perf_data 1
> retain_status_information 1
> retain_nonstatus_information 1
> register 0
> }
> define service{
> name gw
> active_checks_enabled 1
> passive_checks_enabled 1
> parallelize_check 1
> obsess_over_service 1
> check_freshness 0
> notifications_enabled 1
> event_handler_enabled 1
> flap_detection_enabled 1
> process_perf_data 1
> retain_status_information 1
> retain_nonstatus_information 1
> register 0
> }
> # roteador
> define service{
> use gw
> host_name z
> service_description PING
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 240
> notification_period 24x7
> notification_options c,r
> check_command check_ping!100.0,20%!500.0,60%
> }
> # >>> este servidor
> define service{
> use generic-service
> host_name localhost
> service_description SMTP
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options c,r
> check_command check_smtp
> }
> define service{
> use generic-service
> host_name localhost
> service_description IMAP
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options c,r
> check_command check_imap
> }
> define service{
> use generic-service
> host_name localhost
> service_description PING
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options c,r
> check_command check_ping!100.0,20%!500.0,60%
> }
> define service{
> use generic-service
> host_name localhost
> service_description POP3
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_pop
> }
> define service{
> use generic-service
> host_name localhost
> service_description HTTP
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_http
> }
> define service{
> use generic-service
> host_name localhost
> service_description / free space
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_local_disk!50%!30%!/dev/ad0s1a # <<< !!!
> }
> define service{
> use generic-service
> host_name localhost
> service_description /tmp free space
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_local_disk!20%!10%!/dev/ad0s1e # <<< !!!
> }
> define service{
> use generic-service
> host_name localhost
> service_description /usr free space
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_local_disk!50%!30%!/dev/ad2s1f # <<< !!!
> }
> define service{
> use generic-service
> host_name localhost
> service_description /var free space
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 3
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_local_disk!20%!10%!/dev/ad0s1d # <<< !!!
> }
> define service{
> use generic-service
> host_name localhost
> service_description Total Processes
> is_volatile 0
> check_period 24x7
> max_check_attempts 2
> normal_check_interval 5
> retry_check_interval 2
> contact_groups equipe-de-suporte
> notification_interval 240
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_local_procs!150!200!RSZDT
> }
> # <<< este servidor
>
> define service{
> use generic-service ; Name of service template to use
> host_name localhost
> service_description SQUID
> is_volatile 0
> check_period 24x7
> max_check_attempts 3
> normal_check_interval 5
> retry_check_interval 1
> contact_groups equipe-de-suporte
> notification_interval 120
> notification_period 24x7
> notification_options w,u,c,r
> check_command check_http
> }
>
>
> Lembrando que o sendmail (ou o que voce usar) deve esta` configurado.
> Qualquer sugestao estamos ai !
>
> --
> Att.
>
> Diego Queiroz dos Santos
>
>
>
>
> Powered by ....
>
> (__)
> \\\'',)
> \/ \ ^
> .\._/_) FreeBSD
>
--
Att.
Diego Queiroz dos Santos
Powered by ....
(__)
\\\'',)
\/ \ ^
.\._/_) FreeBSD
Mais detalhes sobre a lista de discussão freebsd