Instalação e Configuração Nagios 3
Autor: Marcio Felder | Publicado: 2010-06-04T19:38:00-07:00

Instalação nagios 3 

Instalação:

aptitude search nagios

Resultado do comando -
------------------------------
libnagios-object-perl           - Perl module to parse and represent Nagios
pi  nagios-images                   - Collection of images and icons for the nag
p   nagios-nrpe-plugin              - Nagios Remote Plugin Executor Plugin
p   nagios-nrpe-server              - Nagios Remote Plugin Executor Server
pi  nagios-plugins                  - Plugins for the nagios network monitoring
pi  nagios-plugins-basic            - Plugins for the nagios network monitoring
pi  nagios-plugins-standard         - Plugins for the nagios network monitoring
p   nagios-snmp-plugins             - SNMP Plugins for nagios
p   nagios-statd-client             - Nagios client for monitoring remote system
pi  nagios-statd-server             - Nagios server for monitoring remote system
pi  nagios3                         - A host/service/network monitoring and mana
pi  nagios3-common                  - support files for nagios3
p   nagios3-dbg                     - debugging symbols and debug stuff for nagi
pi  nagios3-doc                     - documentation for nagios3
p   nagiosgrapher                   - Charting add-on for Nagios
p   ndoutils-nagios3-mysql          - This provides the NDOUtils for Nagios with

-------------------------------------
aptitude install nagios3 

aptitude install nagios3
Lendo listas de pacotes... Pronto
Construindo Ã¡rvore de dependÃªncias
Lendo informaÃ§Ã£o de estado... Pronto
Lendo informaÃ§Ãµes estendidas de estado
Inicializando estados de pacotes... Pronto
Lendo descriÃ§Ãµes de tarefas... Pronto
Os NOVOS pacotes a seguir serÃ£o instalados:
libradius1{a} libradiusclient-ng2{a} nagios-images{a} nagios-plugins{a}
nagios-plugins-basic{a} nagios-plugins-standard{a} nagios3
nagios3-common{a} nagios3-doc{a} qstat{a} radiusclient1{a} smbclient{a}
snmp{a}
0 pacotes atualizados, 13 novos instalados, 0 a serem removidos e 3 nÃ£o atualizados.
Ã preciso obter 13,6MB de arquivos. Depois do desempacotamento, 35,6MB serÃ£o usados.
VocÃª deseja continuar? [Y/n/?]

Informe Y.

VocÃª deseja continuar? [Y/n/?] Y
Escrevendo informaÃ§Ãµes estendidas de estado... Pronto
Obter:1 http://ftp.debian.org lenny/main libradiusclient-ng2 0.5.5-1 [36,4kB]
Obter:2 http://security.debian.org lenny/updates/main smbclient 2:3.2.5-4lenny9 [6305kB]
Obter:3 http://ftp.debian.org lenny/main nagios-images 0.4 [1765kB]
Obter:4 http://ftp.debian.org lenny/main nagios-plugins-basic 1.4.12-5 [406kB]
Obter:5 http://ftp.debian.org lenny/main nagios3-doc 3.0.6-4~lenny2 [2071kB]
46% [5 nagios3-doc 1122616/2071kB 54%] [2 smbclient 2950728/6305kB 46%]

--------------------------------------------------
cd /etc/nagios3

ls -l
total 63
-rw-r--r-- 1 root root    1882 Jun 30  2009 apache2.conf
-rw-r--r-- 1 root root   10767 Jul  2  2009 cgi.cfg
-rw-r--r-- 1 root root    2441 Jul  2  2009 commands.cfg
drwxr-xr-x 2 root root    1024 Mai 28 17:16 conf.d
-rw-r--r-- 1 root root   42723 Jul  2  2009 nagios.cfg
-rw-r----- 1 root nagios  1293 Jun 30  2009 resource.cfg
drwxr-xr-x 2 root root    1024 Mai 28 17:16 stylesheets

cd conf.d

ls -l

total 15
-rw-r--r-- 1 root root 1695 Jun 30  2009 contacts_nagios2.cfg
-rw-r--r-- 1 root root  418 Jun 30  2009 extinfo_nagios2.cfg
-rw-r--r-- 1 root root 1152 Jun 30  2009 generic-host_nagios2.cfg
-rw-r--r-- 1 root root 1803 Jun 30  2009 generic-service_nagios2.cfg
-rw-r--r-- 1 root root  209 Mai 28 17:16 host-gateway_nagios3.cfg
-rw-r--r-- 1 root root  976 Jun 30  2009 hostgroups_nagios2.cfg
-rw-r--r-- 1 root root 2167 Jun 30  2009 localhost_nagios2.cfg
-rw-r--r-- 1 root root 1005 Jun 30  2009 services_nagios2.cfg
-rw-r--r-- 1 root root 1609 Jun 30  2009 timeperiods_nagios2.cfg

Configurações 

----------------- 
contacts_nagios2.cfg
-----------------
define contact {
contact_name                  administrador
alias                         Administrador do Sistema
service_notification_period   24x7
host_notification_period      24x8
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                         administrador@dominio.com.br
} 

define contact {
contact_name                  administrador2
alias                         Administrador do Sistema 2
service_notification_period   24x7
host_notification_period      24x8
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                         administrador2@dominio.com.br
}


------------------------------
define contactgroup{
contactgroup_name       admins
alias                   Nagios Administradores
members                 administrador,administrador2,administrador3
} 

define contactgroup{
contactgroup_name       informatica
alias                   Informática Administradores
members                 administrador,administrador2
}
----------------------------
hostgroups_nagios2.cfg
----------------------------
# A list of your ssh-accessible servers
define hostgroup {
        hostgroup_name  ssh-servers
                alias           SSH servers
                members         localhost
        }

# nagios doesn't like monitoring hosts without services, so this is
# a group for devices that have no other "services" monitorable
# (like routers w/out snmp for example)
define hostgroup {
        hostgroup_name  ping-servers
                alias           Pingable servers
                members         gateway
        }

define hostgroup {
        hostgroup_name nagios_servers
        alias          Nagios home
        #contact_groups  nagios-home
        members       Jose, maria
        }
-----------------------------------------------------------------------
localhost.cfg
-----------------------------------------------------------------------

# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
#

define host{
        use                     generic-host            ; Name of host template to use
        host_name               localhost
        alias                   localhost
        address                 127.0.0.1
        }

# Define a service to check the disk space of the root partition
# on the local machine.  Warning if < 20% free, critical if
# < 10% free space on partition.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       localhost
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%
        }



# Define a service to check the number of currently logged in
# users on the local machine.  Warning if > 20 users, critical
# if > 50 users.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       localhost
        service_description             Current Users
        check_command                   check_users!20!50
        }


# Define a service to check the number of currently running procs
# on the local machine.  Warning if > 250 processes, critical if
# > 400 processes.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       localhost
        service_description             Total Processes
                check_command                   check_procs!250!400
        }



# Define a service to check the load on the local machine.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       localhost
        service_description             Current Load
                check_command                   check_load!5.0!4.0!3.0!10.0!6.0!4.0
        }
flinux:/etc/nagios3/conf.d#

------------------------------------------------------------------------------------

Como pode ver acima alguns exemplos de configurações.

contact_nagios refere-se aos contato de email.
Pessoas responsáveis por receber as notificações por email.
Alem do grupos relacionado, a receber.
Associados ao grupos observe bem os campos.

---------------------------------------------------------------------------------------
Hostgroups Grupos de de serviços que será monitorado e enviado para respectivo membro.
Pode sem host ou serviços.
----------------------------------------------------------------------------------------
localhost refere-se ao equipamento que vai ser monitorado.
Cada equipamento que for monitorado deve ser criado novo arquivo com respectivo nome com extensao .cfg.
-----------------------------------------------------------------------------------------
Outros arquivos importantes hosts e services nele contas os 2 tipos de recursos do nagios,
Monitorar links e monitorar serviços.
-----------------------------------------------------------------------------------------
alguns link para referencia:

http://www.vivaolinux.com.br/artigo/Instalando-e-configurando-o-Nagios-com-e-sem-MySQL
http://www.vivaolinux.com.br/artigo/Nagios-Um-poderoso-programa-de-monitoramento-de-rede-(parte-1)/
-----------------------------------------------------------------------------------------
Em Breve vou postar mais detalhes.