NAGIOS [RESOLVIDO]

1. NAGIOS [RESOLVIDO]

Welington Silva de Lima
welington27

(usa Debian)

Enviado em 09/02/2012 - 10:28h

Bom dia pessoal, gostaria de saber como faço pra colocar servidores dentro do meu nagios. Eu tava pesquinsando na Net eles pedem para alterar varios documentos mais acontece que na minha pasta nagios que se encontra no /usr/local/nagios/etc só tem esses arquivos aqui:

cgi.cfg htpasswd.users nagios.cfg objects resource.cfg


Ai não sei como faço pra configurar e colocar servidores. Queria colocar a rede interna daqui na empresa mais não sei como alguém por favor pode me ajudar???


  


2. MELHOR RESPOSTA

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/02/2012 - 10:58h

bom vamos lá

10.10.10.254

no diretório /usr/local/nagios/etc/objects/
crie um arquivo com nome de gateway

#cd /usr/local/nagios/etc/objects/


#vim gateway.cfg

de deixe assim



define host{
use linux-server
host_name gateway
alias gateway
address 10.10.10.254
}

define service{
use local-service
host_name gateway
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}


define service{
use local-service
host_name gateway
service_description Http
check_command check_http
notifications_enabled 0
}


depois adiciona a linha no nagios.cfg

#cd /usr/local/nagios/etc

#vim nagios.cfg

e adiciona a linha assim

cfg_file=/usr/local/nagios/etc/objects/gateway.cfg




e verifica se ficou ok as configurações

#/usr/local/nagios/bin/nagios -v usr/local/nagios/etc/nagios.cfg

se tiver certo só reiniciar o nagios e pronto











3. Re: NAGIOS [RESOLVIDO]

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/02/2012 - 10:34h

dentro do diretório /usr/local/nagios/etc/objects
lá tem alguns exemplo de uma olhada
lá você adiciona um novo servidor
e depois tem que adicionar no /usr/loca/nagios/etc/nagios.cfg
o caminho do novo servidor


4. Responder

Welington Silva de Lima
welington27

(usa Debian)

Enviado em 09/02/2012 - 10:38h

Lá dentro tem esse /usr/local/nagios/etc/objects:

commands.cfg contacts.cfg localhost.cfg printer.cfg switch.cfg templates.cfg timeperiods.cfg windows.cfg


POde me ajudar como posso fazer isso qual deles eu vou e como insiro um quero colocar um servidor cujo o IP é 10.10.10.254 que é o gateway da rede interna. Pode me ajudar??




5. Re: NAGIOS [RESOLVIDO]

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/02/2012 - 10:41h

ok que qual o serviço que vc quer monitorar ?
ou só saber que ele esta ok somente usado o ping ?


6. Responder

Welington Silva de Lima
welington27

(usa Debian)

Enviado em 09/02/2012 - 10:45h

Serviços de HTTP e de Ping pra saber se estará funcionando.


7. Responder

Welington Silva de Lima
welington27

(usa Debian)

Enviado em 09/02/2012 - 11:15h

Nesse ultimo comando deu essa mensagem aqui:

Nagios Core 3.2.1
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 03-09-2010
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Error: Cannot open main configuration file '/usr/local/nagios/etc/usr/local/nagios/etc/nagios.cfg' for reading!
Error processing main config file!



***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

O que pode ser???


8. Responder

Welington Silva de Lima
welington27

(usa Debian)

Enviado em 09/02/2012 - 11:18h

E na hora de startar deu esse erro:

Running configuration check... CONFIG ERROR! Restart aborted. Check your Nagios configuration.

Acho que é na configuração do arquivo gateway não? Ou no nagios.cgf


9. Re: NAGIOS [RESOLVIDO]

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/02/2012 - 11:34h

o erro é aqui
/usr/local/nagios/etc/usr/local/nagios/etc/nagios.cfg


o correto seria
/usr/local/nagios/etc/nagios.cfg


de uma olhada na suas configurações do
nagios.cfg


10. Responder

Welington Silva de Lima
welington27

(usa Debian)

Enviado em 09/02/2012 - 11:48h

As linhas Iniciais do meu arquivo nagios.cgf é:
O que tem de errado nelas?



# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg

# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

# Definitions for monitoring a Windows machine
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg

# Definitions for monitoring a router/switch
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg

# Definitions for monitoring a network printer
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg

#Nova linha do Gateway
cfg_file=/usr/local/nagios/etc/objects/gateway.cfg

# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:

#cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers




# OBJECT CACHE FILE
# This option determines where object definitions are cached when
# Nagios starts/restarts. The CGIs read object definitions from
# this cache file (rather than looking at the object config files
# directly) in order to prevent inconsistencies that can occur
# when the config files are modified after Nagios starts.

object_cache_file=/usr/local/nagios/var/objects.cache

# PRE-CACHED OBJECT FILE
# This options determines the location of the precached object file.
# If you run Nagios with the -p command line option, it will preprocess
# your object configuration file(s) and write the cached config to this
# file. You can then start Nagios with the -u option to have it read
# object definitions from this precached file, rather than the standard
# object configuration files (see the cfg_file and cfg_dir options above).
# Using a precached object file can speed up the time needed to (re)start
# the Nagios process if you've got a large and/or complex configuration.
# Read the documentation section on optimizing Nagios to find our more
# about how this feature works.

precached_object_file=/usr/local/nagios/var/objects.precache



# RESOURCE FILE
# This is an optional resource file that contains $USERx$ macro
# definitions. Multiple resource files can be specified by using
# multiple resource_file definitions. The CGIs will not attempt to
# read the contents of resource files, so information that is
# considered to be sensitive (usernames, passwords, etc) can be
# defined as macros in this file and restrictive permissions (600)
# can be placed on this file.

resource_file=/usr/local/nagios/etc/resource.cfg



# STATUS FILE
# This is where the current status of all monitored services and
# hosts is stored. Its contents are read and processed by the CGIs.
# The contents of the status file are deleted every time Nagios
# restarts.

status_file=/usr/local/nagios/var/status.dat



# STATUS FILE UPDATE INTERVAL
# This option determines the frequency (in seconds) that
# Nagios will periodically dump program, host, and
# service status data.

status_update_interval=10



# NAGIOS USER
# This determines the effective user that Nagios should run as.
# You can either supply a username or a UID.

nagios_user=nagios



# NAGIOS GROUP
# This determines the effective group that Nagios should run as.
# You can either supply a group name or a GID.

nagios_group=nagios



# EXTERNAL COMMAND OPTION
# This option allows you to specify whether or not Nagios should check
# for external commands (in the command file defined below). By default
# Nagios will *not* check for external commands, just to be on the
# cautious side. If you want to be able to use the CGI command interface
# you will have to enable this.
# Values: 0 = disable commands, 1 = enable commands

check_external_commands=1



# EXTERNAL COMMAND CHECK INTERVAL
# This is the interval at which Nagios should check for external commands.
# This value works of the interval_length you specify later. If you leave
# that at its default value of 60 (seconds), a value of 1 here will cause
# Nagios to check for external commands every minute. If you specify a
# number followed by an "s" (i.e. 15s), this will be interpreted to mean
# actual seconds rather than a multiple of the interval_length variable.
# Note: In addition to reading the external command file at regularly
# scheduled intervals, Nagios will also check for external commands after
# event handlers are executed.
# NOTE: Setting this value to -1 causes Nagios to check the external
# command file as often as possible.

#command_check_interval=15s
command_check_interval=-1



# EXTERNAL COMMAND FILE
# This is the file that Nagios checks for external command requests.
# It is also where the command CGI will write commands that are submitted
# by users, so it must be writeable by the user that the web server
# is running as (usually 'nobody'). Permissions should be set at the
# directory level instead of on the file, as the file is deleted every
# time its contents are processed.

command_file=/usr/local/nagios/var/rw/nagios.cmd



# EXTERNAL COMMAND BUFFER SLOTS
# This settings is used to tweak the number of items or "slots" that
# the Nagios daemon should allocate to the buffer that holds incoming
# external commands before they are processed. As external commands
# are processed by the daemon, they are removed from the buffer.

external_command_buffer_slots=4096



# LOCK FILE
# This is the lockfile that Nagios will use to store its PID number
# in when it is running in daemon mode.

lock_file=/usr/local/nagios/var/nagios.lock



# TEMP FILE
# This is a temporary file that is used as scratch space when Nagios
# updates the status log, cleans the comment file, etc. This file



11. Re: NAGIOS [RESOLVIDO]

Daniel Lara Souza
danniel-lara

(usa Fedora)

Enviado em 09/02/2012 - 11:55h

bom a configuração do nagios.cfg esta correto
e você criou o arquivo gateway.cfg nesse diretorio /usr/local/nagios/etc/objects/ ?


12. Responder

Welington Silva de Lima
welington27

(usa Debian)

Enviado em 09/02/2012 - 12:04h

Sim criei sim exatamente tudo certinho.






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts