Configurando o arquivo de contato para o administrador da rede:
# mcedit /etc/Nagios/contacts.cfg
############################
define contact{
contact_name Nagios #nome do contato
alias Nagios Admin
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,notify-by-epager
host_notification_commands host-notify-by-email,host-notify-by-epager
email 67XXXXXXXX@clarotorpedo.com.br # email para o contato, aqui no meu caso eu estou mandando para o meu celular da claro
pager pagenagios-admin@localhost # pagina do contato
}
# Adicionei um novo contato
define contact{
contact_name buzaneli
alias Jose Leandro Buzaneli dos Santos
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,host-notify-by-epager
email buzaneli@gmail.com
pager pagenagios-admin@localhost
}
############################
Salve o arquivo.
Criando grupos para os contatos:
# mcedit /etc/nagios/contactgroups.cfg
############################
define contactgroup{
contactgroup_name router-admins
alias Router Technicians
members nagios
}
# 'router-admins' contact group definition
define contactgroup{
contactgroup_name tecnicos
alias Tecnico da Empresa
members buzaneli
}
############################
Salve o arquivo e reinicie o Nagios.
Criando hosts para monitorar
Agora criaremos os hosts a serem monitorados.
# mcedit /etc/nagios/hosts.cfg
############################
# no generic host dever estar estas configurações e depois é só adicionar mais hosts
define host{
name generic-host ; The name of this host template - referenced in other host definitions, used for template recursion/resolution
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is disabled
flap_detection_enabled 1 ; Flap detection is disabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
# Default gateway host definition
define host{
use generic-host ; Name of host template to use
host_name gw
alias Default Gateway
address 10.1.1.1
check_command check-host-alive
max_check_attempts 20
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
############################
# comecei a criar os meus host a partir daqui
define host{
use generic-host ; Name of host template to use
host_name proxy
alias Servidor Proxy
address 192.168.200.1
check_command check-host-alive
parents gw # esse comando diz que o proxy está ligado ao gw ou modem adsl
max_check_attempts 20
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name Radio
alias Radio Wan
address 192.168.100.2
check_command check-host-alive
parents proxy # o Radio depende o proxy para funcionar
max_check_attempts 20
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name Voip
alias Servidor Voip
address 192.168.200.11
check_command check-host-alive
parents Radio
max_check_attempts 20
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name lucilene
alias Maq Lucilene
address 192.168.200.10
check_command check-host-alive
parents Radio
max_check_attempts 20
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
Criando grupos para os hosts
Agora devemos criar os grupos para os hosts, pois se não criarmos o Nagios dará erro.
# mcedit /etc/nagios/hostgroups.cfg
############################
# observe que o grupo de contato é aquele criado lá no arquivo contacts.cfg e contactgroups.cfg
define hostgroup{
hostgroup_name gateways
alias Routers and Gateways
contact_groups router-admins
members gw,proxy
}
define hostgroup{
hostgroup_name servidores
alias Servidores
Linux
contact_groups tecnicos
members proxy,Voip
}
define hostgroup{
hostgroup_name Radios
alias Radios Servidores
contact_groups router-admins
members Radio
}
define hostgroup{
hostgroup_name Cliente intranet
alias Rede Interna
contact_groups tecnicos
members lucilene
}
############################