- Back to Home »
- Nagios - Configurações dos hosts
Posted by : Rafael Holanda
quarta-feira, 6 de abril de 2011
Continuação do post: Instalando o Nagios
Aqui vamos definir as máquinas vamos monitorar.
Acesse o arquivos nagios.cfg
Aqui vamos definir as máquinas vamos monitorar.
Acesse o arquivos nagios.cfg
No meu caso: /usr/local/nagios/etc/nagios.cfg
Podemos notar que existem algumas linhas comentadas, vamos descomentar as linhas dos equipamentos que iremos monitorar.
Exemplo servidores Windows:
#Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
#Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
Agora vamos acessar o arquivo windows.cfg
vim /usr/local/nagios/etc/objects/windows.cfg
vim /usr/local/nagios/etc/objects/windows.cfg
Recomendo que você faça uma copia de segurança do arquivo original antes de alterar o mesmo.
Neste arquivo você configura as máquinas Windows na rede
# HOST DEFINITIONS - Define o nome, alias, ip.
# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation
define host{
use windows-server ; Inherit default values from a template(NÃO ALTERE)
host_name SERVIDOR1 ; The name we're giving to this host
alias SERVIDOR DC ; A longer name associated with the host
address 172.31.2.1 ; IP address of the host
}
# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation
define host{
use windows-server ; Inherit default values from a template(NÃO ALTERE)
host_name SERVIDOR1 ; The name we're giving to this host
alias SERVIDOR DC ; A longer name associated with the host
address 172.31.2.1 ; IP address of the host
}
define host{
use windows-server ; Inherit default values from a template(NÃO ALTERE)
host_name SERVIDOR2 ; The name we're giving to this host
alias SERVIDOR DHCP ; A longer name associated with the host
address 172.31.2.2 ; IP address of the host
}
# HOST GROUP DEFINITIONS - Define o grupo, nomes.
# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}
# SERVICE DEFINITIONS - Define os serviços.
# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name SERVIDOR1
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
use windows-server ; Inherit default values from a template(NÃO ALTERE)
host_name SERVIDOR2 ; The name we're giving to this host
alias SERVIDOR DHCP ; A longer name associated with the host
address 172.31.2.2 ; IP address of the host
}
# HOST GROUP DEFINITIONS - Define o grupo, nomes.
# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}
# SERVICE DEFINITIONS - Define os serviços.
# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name SERVIDOR1
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
define service{
use generic-service
host_name SERVIDOR2
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
use generic-service
host_name SERVIDOR2
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
Fica a dica: Mude somente o host_name, alias e IP
Toda vez que você alterar os seus arquivos de configuração, você deve executar uma verificação deles. É importante fazer isso antes de (re)iniciar o Nagios:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Reinicie as configurações:
/etc/rc.d/init.d/nagios reload
Dependendo da localização da instalação, os demais arquivos estão nos seguintes locais:
/usr/local/nagios/etc/objects/commands.cfg
/usr/local/nagios/etc/objects/localhost.cfg
/usr/local/nagios/etc/objects/printer.cfg
/usr/local/nagios/etc/objects/switch.cfg
/usr/local/nagios/etc/objects/windows.cfg
/usr/local/nagios/etc/objects/contacts.cfg
/usr/local/nagios/etc/objects/localhost.cfg
/usr/local/nagios/etc/objects/printer.cfg
/usr/local/nagios/etc/objects/switch.cfg
/usr/local/nagios/etc/objects/windows.cfg
/usr/local/nagios/etc/objects/contacts.cfg