Page 1 of 2

Fail to apply config

Posted: Thu Jan 26, 2017 10:43 am
by bercesm
Hi all!

I'have problem to apply my config.

Write host configurations ...
Configuration file: localhost.cfg successfully written!
Host configuration files successfully written!

Write service configurations ...
Configuration file: localhost.cfg successfully written!
Service configuration files successfully written!

Configuration file: hostgroups.cfg successfully written!
Configuration file: servicegroups.cfg successfully written!
Configuration file: hosttemplates.cfg successfully written!
Configuration file: servicetemplates.cfg successfully written!
Configuration file: timeperiods.cfg successfully written!
Configuration file: commands.cfg successfully written!
Configuration file: contacts.cfg successfully written!
Configuration file: contactgroups.cfg successfully written!
Configuration file: contacttemplates.cfg successfully written!
Configuration file: servicedependencies.cfg successfully written!
Configuration file: hostdependencies.cfg successfully written!
Configuration file: serviceescalations.cfg successfully written!
Configuration file: hostescalations.cfg successfully written!
Configuration file: serviceextinfo.cfg successfully written!
Configuration file: hostextinfo.cfg successfully written!
Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/localhost.cfg', starting on line 93)
But on an other machine, with the same config file, it works properly.
The db is working. wget works as well.

What can I do?

Thanks!

Re: Fail to apply config

Posted: Thu Jan 26, 2017 10:56 am
by dwhitfield
When you say the same config file, do you mean the same /usr/local/nagios/etc/services/localhost.cfg or the same nagios.cfg?

Can you PM me both of your XI profiles (I'm assuming both machines are XI)? You can download it by going to Admin > System Config > System Profile and click the Download Profile button towards the top. If for whatever reason you *cannot* download the profile, please put the output of View System Info (5.3.4+, Show Profile if older) in the thread (that will at least get us some info).

After you PM the profile, please update this thread. Updating this thread is the only way for it to show back up on our dashboard.

If both machines are not XI, what version(s) of Core are you using? Were they compiled from source or installed from distro repos? On what OS/version are they running? cat /etc/*-release may be of use. Also, if not XI, can you send your localhost.cfg and nagios.cfg. With the XI profile, I shouldn't need those separately.

Re: Fail to apply config

Posted: Fri Jan 27, 2017 3:18 am
by bercesm
Hi!

Ichecked, and both of the files, you mentioned are the same on the two machine. Both system is nagiosXI.

On DEV, I can apply changes without problem, But on PROD it fails, with the following error:
Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/localhost.cfg', starting on line 93)

Thanks!
profile_DEV.zip
profile_PROD.zip

Re: Fail to apply config

Posted: Fri Jan 27, 2017 2:15 pm
by tgriep
It could be that the configs stored in the MYSQL database are out of sync and that could be causing the error.
If you follow this procedure, that should sync them up and you should be able to Apply the Config.

Go to the Core Config Manager
Under "Tools", click "Write Config Files" or if you are running a newer versions of XI, The menu is called "Config File Management"
Click the click the "Write" button, then the "Delete" button then click the "Write" button and then the "Verify" button
If you get any errors, resolve them and click on the "Write", "Verify" until all of the errors are resolved.
Click the Apply Configuration link and click the "Apply Configuration" button

Re: Fail to apply config

Posted: Sat Jan 28, 2017 5:49 am
by bercesm
I've done it several times, but all the same.
Config verification is ok, but apply config fails.
I've removed localhost from linux-server server group, so could delete ssh service (which is in line no. 93), but after that, the error is the same. (localhost.cfg written back, by the system, and apply config fails again.)

All the other hosts, services, changes I was mafe, works fine. How can I delete localhost from appliance?

Thanks!

Re: Fail to apply config

Posted: Sat Jan 28, 2017 3:01 pm
by WillemDH
Give localhost a service description?

Re: Fail to apply config

Posted: Sat Jan 28, 2017 3:09 pm
by bercesm
When it recreate the file, no.
I correct it, but apply fails.

Re: Fail to apply config

Posted: Mon Jan 30, 2017 11:14 am
by rkennedy
Are you correcting it on the file, or in the Core Config Manager?

I've seen it in the past be due to time not lining up between your system and SQL, what is the output of these commands?

Code: Select all

grep "date.timezone" /etc/php.ini
ls -l /etc/localtime
php -r 'echo date("D M j G:i:s T Y")."\n";'
date
mysql -unagiosxi -pn@gweb -e "SELECT NOW();"

Re: Fail to apply config

Posted: Tue Jan 31, 2017 6:52 am
by bercesm
Sorry for the late answer...

"Are you correcting it on the file, or in the Core Config Manager? "
Correcting it in command line, then click on ccm "Write config" then to "Verify config" buttons.

All the command sais it's CET, 12.51:xx now.
(The server is in Hungary.)

Re: Fail to apply config

Posted: Tue Jan 31, 2017 11:51 am
by rkennedy
bercesm wrote:Sorry for the late answer...

"Are you correcting it on the file, or in the Core Config Manager? "
Correcting it in command line, then click on ccm "Write config" then to "Verify config" buttons.

All the command sais it's CET, 12.51:xx now.
(The server is in Hungary.)
Correcting it on the command line won't help since it's in the database already. You'll need to modify it in the Core Config Manager to be proper, and then run a delete -> write -> verify.