Check your configuration file to ensure they are valid?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ikekim
Posts: 85
Joined: Wed Aug 16, 2017 12:21 pm

Check your configuration file to ensure they are valid?

Post by ikekim »

I'm unable to start nagios.service and upon checking its status I get the message below.
How do I do "Check your configuration file(s) to ensure that they contain valid"?

thanks,
ik


[root@nagioscore ~]# systemctl status nagios.service
● nagios.service - LSB: Starts and stops the Nagios monitoring server
Loaded: loaded (/etc/rc.d/init.d/nagios; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2017-10-12 14:00:08 EDT; 1min 15s ago
Docs: man:systemd-sysv-generator(8)
Process: 5971 ExecStop=/etc/rc.d/init.d/nagios stop (code=exited, status=0/SUCCESS)
Process: 6047 ExecStart=/etc/rc.d/init.d/nagios start (code=exited, status=8)

Oct 12 14:00:08 nagioscore.localdomain nagios[6047]: Check your configuration file(s) to ensure that they contain valid
Oct 12 14:00:08 nagioscore.localdomain nagios[6047]: directives and data definitions. If you are upgrading from a previous
Oct 12 14:00:08 nagioscore.localdomain nagios[6047]: version of Nagios, you should be aware that some variables/definitions
Oct 12 14:00:08 nagioscore.localdomain nagios[6047]: may have been removed or modified in this version. Make sure to read
Oct 12 14:00:08 nagioscore.localdomain nagios[6047]: the HTML documentation regarding the config files, as well as the
Oct 12 14:00:08 nagioscore.localdomain nagios[6047]: 'Whats New' section to find out what has changed.
Oct 12 14:00:08 nagioscore.localdomain systemd[1]: nagios.service: control process exited, code=exited status=8
Oct 12 14:00:08 nagioscore.localdomain systemd[1]: Failed to start LSB: Starts and stops the Nagios monitoring server.
Oct 12 14:00:08 nagioscore.localdomain systemd[1]: Unit nagios.service entered failed state.
Oct 12 14:00:08 nagioscore.localdomain systemd[1]: nagios.service failed.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Check your configuration file to ensure they are valid?

Post by npolovenko »

Hi, @ikekim. What did you do prior to this error? Did you upgrade the core or did you try to add new hosts, services, etc ? Usually i'd start from checking the nagios.cfg file. You can also run the following command to troubleshoot configuration problems:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If it shows any errors please post the whole output here, as well as your nagios.cfg file.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ikekim
Posts: 85
Joined: Wed Aug 16, 2017 12:21 pm

Re: Check your configuration file to ensure they are valid?

Post by ikekim »

thanks for that command. here is the output.

Code: Select all

[root@nagioscore etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.3.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-08-24
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
Error: Could not find any hostgroup matching 'allhosts' (config file '/usr/local/nagios/etc/objects/iis.cfg', starting on line 1)
Error: Failed to process hostgroup names for host 'registration_iis' (config file '/usr/local/nagios/etc/objects/iis.cfg', starting at line 1)
Error: Invalid max_check_attempts value for host 'registration_iis'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/iis.cfg', starting on line 1)
   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 definitions.  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 iis.cfg file content is:

Code: Select all

define host {
    use         generic-host 
    host_name   registration_iis 
    alias       Some Remote Host
    address     10.155.58.26    
    hostgroups  allhosts        
}
I'm trying to add and define the host with minimal info just to get my very first host & service to appear on Nagios Core web page.

thanks.
Last edited by dwhitfield on Thu Oct 12, 2017 4:25 pm, edited 1 time in total.
Reason: code blocks FTW
dwasswa

Re: Check your configuration file to ensure they are valid?

Post by dwasswa »

Hi @ikekim


You have an error in your object definition:

Code: Select all

define host {
use generic-host
host_name registration_iis
alias Some Remote Host
address 10.155.58.26
hostgroups allhosts
}
Change:

Code: Select all

hostgroups allhosts
To:

Code: Select all

 hostgroup_name allhosts
Please take a look at Object Definitions


Let us know if you have any questions.
ikekim
Posts: 85
Joined: Wed Aug 16, 2017 12:21 pm

Re: Check your configuration file to ensure they are valid?

Post by ikekim »

After going through your response, it looks like I need this, but what file name do I use for this content and where do I place the file?

define hostgroup{
hostgroup_name hostgroup_name
alias alias
members hosts
hostgroup_members hostgroups
notes note_string
notes_url url
action_url url
}

For now I removed the "hostgroup" reference from the iis.cfg file and then I had to add "max_check_attempts 5" in the iis.cfg file.

That got rid of the error.


thanks,
ik
dwasswa

Re: Check your configuration file to ensure they are valid?

Post by dwasswa »

Glad it worked for you.

I am now going to close this thread as resolved.

Please let us know if you have any other questions.
Locked