Page 1 of 1

Nagios Core Error Nightmare!!

Posted: Fri Feb 19, 2016 4:31 pm
by fasongan
Hey i appreciate this great community of smart engineers:)

However i have a road block and was wondering if anyone could please help.
Nagios core gives me an error when i check for errors using the "/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg" command

the error reads......


Error: Cannot open config file ‘/usr/local/nagios/etc/hosts.cfg ;new file added ‘ for reading: No such file or directory
Error processing object config files!

***> 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.



My conf file is perfect as far as i know but i cant seem to figure out where the error is coming from

#
###############################################################################

# Define a host for the remote machine

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name nci-helicarrier.nci.nih.gov
alias CentOS 6.5
address 128.231.12.230

}

# Linux host definition template #

define host{
name linux-server ; The name of this host template
use generic-host ; This template inherits other values from the generic-host template
check_period 24×7 ; By default, Linux hosts are checked round the clock
check_interval 5 ; Actively check the host every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each Linux host 10 times (max)
check_command check-host-alive ; Default command to check Linux hosts
notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
; Note that the notification_period variable is being overridden from
; the value that is inherited from the generic-host template!
notification_interval 120 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
register 1 ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL HOST, JUST A TEMPLATE!
}
[Ryan01@ nci-s078880 ~]$

even the objects configuration file seems perfect

# OBJECT CONFIGURATION FILE(S)
# These are the object configuration files in which you define hosts,
# host groups, contacts, contact groups, services, etc.
# You can split your object definitions across several config files
# if you wish (as shown below), or keep them all in a single config file.

# 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
cfg_file=/usr/local/nagios/etc/hosts.cfg ;new file added
cfg_file=/usr/local/nagios/etc/services.cfg ;new file added

# Definitions for monitoring the local (Linux) host

i cant seem to find the issue here

1) the file is readable
2) its labelled right
3) The only thing i changed on it was the (hostname, alias and IP addresse.) Please help if you can.

Re: Nagios Core Error Nightmare!!

Posted: Sun Feb 21, 2016 9:50 pm
by Box293
fasongan wrote:define host{
name linux-server ; The name of this host template
use generic-host ; This template inherits other values from the generic-host template
check_period 24×7 ; By default, Linux hosts are checked round the clock
check_interval 5 ; Actively check the host every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each Linux host 10 times (max)
check_command check-host-alive ; Default command to check Linux hosts
notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
; Note that the notification_period variable is being overridden from
; the value that is inherited from the generic-host template!
notification_interval 120 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
register 1 ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL HOST, JUST A TEMPLATE!
}
Because this is a template, it needs to be a 0:

Code: Select all

register 0 ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL HOST, JUST A TEMPLATE!

Re: Nagios Core Error Nightmare!!

Posted: Tue Feb 23, 2016 3:55 pm
by fasongan
Thanks box 293
I only put a 1 later down the road when i tried everything else.

I went back and retraced my steps but it seemed like everything i did was right and i couldnt find out where i went wrong.

Please is there anything different i can do or check?

Re: Nagios Core Error Nightmare!!

Posted: Tue Feb 23, 2016 4:34 pm
by nozlaf
can you verify that the file /usr/local/nagios/etc/hosts.cfg actually exists?

Re: Nagios Core Error Nightmare!!

Posted: Tue Feb 23, 2016 4:42 pm
by hsmith
Thanks @nozlaf!

Let us know what you find out, OP.