Page 1 of 1

please help

Posted: Thu May 28, 2020 6:07 am
by fraju
I got the following error while I was adding the router in Nagios. Please see the attachment. Can you please help me asap?


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

Nagios Core 4.4.6
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2020-04-28
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Could not open config directory '/usr/local/nagios/etc/servers' for reading.
Error: Invalid max_check_attempts value for host 'RAJU-LAPTOP'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 21)
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.

Re: please help

Posted: Thu May 28, 2020 2:41 pm
by benjaminsmith
Hi @fraju,

Thanks for joining the Nagios Community Forum! Looking out the output, it looks like the permissions may not be set correctly in the configurations.
Error: Could not open config directory '/usr/local/nagios/etc/servers' for reading.
Check the /usr/local/nagios/etc directory, it should look like the following:

Code: Select all

[root@centos01 etc]# ls -lR
.:
total 144
-rw-rw-r--. 1 nagios nagios 13710 Sep 18  2019 cgi.cfg
-rw-rw-r--. 1 nagios nagios 13710 Sep 18  2019 cgi.cfg~
-rw-r--r--. 1 root   root      50 Sep 18  2019 htpasswd.users
-rw-rw-r--. 1 nagios nagios 45843 Sep 18  2019 nagios.cfg
-rw-rw-r--. 1 nagios nagios 45843 Sep 18  2019 nagios.cfg~
drwxrwxr-x. 2 nagios nagios  4096 Dec 11 13:22 objects
-rw-rw----. 1 nagios nagios  1312 Sep 18  2019 resource.cfg
-rw-rw----. 1 nagios nagios  1312 Sep 18  2019 resource.cfg~

./objects:
total 104
-rw-rw-r--. 1 nagios nagios  6765 Sep 18  2019 commands.cfg
-rw-rw-r--. 1 nagios nagios  6765 Sep 18  2019 commands.cfg~
-rw-rw-r--. 1 nagios nagios  1797 Sep 18  2019 contacts.cfg
-rw-rw-r--. 1 nagios nagios  1797 Sep 18  2019 contacts.cfg~
-rw-rw-r--. 1 nagios nagios  4776 Oct 22  2019 localhost.cfg
-rw-rw-r--. 1 nagios nagios  4777 Sep 18  2019 localhost.cfg~
-rw-rw-r--. 1 nagios nagios  3001 Sep 18  2019 printer.cfg
-rw-rw-r--. 1 nagios nagios  3001 Sep 18  2019 printer.cfg~
-rw-rw-r--. 1 nagios nagios  3484 Sep 18  2019 switch.cfg
-rw-rw-r--. 1 nagios nagios  3484 Sep 18  2019 switch.cfg~
-rw-rw-r--. 1 nagios nagios 12533 Sep 18  2019 templates.cfg
-rw-rw-r--. 1 nagios nagios 12533 Sep 18  2019 templates.cfg~
-rw-rw-r--. 1 nagios nagios  3512 Sep 18  2019 timeperiods.cfg
-rw-rw-r--. 1 nagios nagios  3512 Sep 18  2019 timeperiods.cfg~
-rw-rw-r--. 1 nagios nagios  4074 Sep 18  2019 windows.cfg
-rw-rw-r--. 1 nagios nagios  4074 Sep 18  2019 windows.cfg~
Once you clear that error, run the pre-flight check again to make sure you do not have any configuration errors.

Code: Select all

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

Re: please help

Posted: Fri May 29, 2020 5:04 am
by fraju
Hi Please find the attached screenshot and let me know how to fix the permission for those files? Thanks

Re: please help

Posted: Fri May 29, 2020 3:30 pm
by benjaminsmith
Hi @fraju,

Try running the following commands and let me know if you're still having trouble.

Code: Select all

chown -R nagios:nagios /usr/local/nagios/etc/
chmod -R 775 /usr/local/nagios/etc/

Re: please help

Posted: Fri May 29, 2020 5:07 pm
by fraju
I run your command but Still, I am getting the error...can you please check it ???

Re: please help

Posted: Mon Jun 01, 2020 4:53 pm
by scottwilkerson
Could you share your /usr/local/nagios/etc/objects.windows.cfg (redacting any necessary info)?

Also, it looks like your nagios.cfg has a cfg_dir specified for /usr/local/nagios/etc/servers but the path doesn't exist

Re: please help

Posted: Mon Jun 01, 2020 8:17 pm
by fraju
scottwilkerson wrote:Could you share your /usr/local/nagios/etc/objects.windows.cfg (redacting any necessary info)?

Also, it looks like your nagios.cfg has a cfg_dir specified for /usr/local/nagios/etc/servers but the path doesn't exist

Please find the attached files. please let me know if need anything, thanks