Check your configuration file to ensure they are valid?

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Check your configuration file to ensure they are valid?

Postby ikekim » Thu Oct 12, 2017 1:05 pm

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.
ikekim
 
Posts: 64
Joined: Wed Aug 16, 2017 12:21 pm

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

Postby npolovenko » Thu Oct 12, 2017 3:09 pm

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.
User avatar
npolovenko
 
Posts: 95
Joined: Mon May 15, 2017 5:00 pm

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

Postby ikekim » Thu Oct 12, 2017 3:40 pm

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
ikekim
 
Posts: 64
Joined: Wed Aug 16, 2017 12:21 pm

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

Postby dwasswa » Thu Oct 12, 2017 3:45 pm

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.
User avatar
dwasswa
 
Posts: 208
Joined: Tue Jul 25, 2017 3:32 pm

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

Postby ikekim » Thu Oct 12, 2017 4:18 pm

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
ikekim
 
Posts: 64
Joined: Wed Aug 16, 2017 12:21 pm

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

Postby dwasswa » Thu Oct 12, 2017 4:34 pm

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.
User avatar
dwasswa
 
Posts: 208
Joined: Tue Jul 25, 2017 3:32 pm


Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot] and 15 guests