Fail to apply config

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bercesm
Posts: 11
Joined: Wed Jan 25, 2017 4:46 am

Fail to apply config

Post 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!
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Fail to apply config

Post 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.
bercesm
Posts: 11
Joined: Wed Jan 25, 2017 4:46 am

Re: Fail to apply config

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Fail to apply config

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
bercesm
Posts: 11
Joined: Wed Jan 25, 2017 4:46 am

Re: Fail to apply config

Post 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!
You do not have the required permissions to view the files attached to this post.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Fail to apply config

Post by WillemDH »

Give localhost a service description?
Nagios XI 5.8.1
https://outsideit.net
bercesm
Posts: 11
Joined: Wed Jan 25, 2017 4:46 am

Re: Fail to apply config

Post by bercesm »

When it recreate the file, no.
I correct it, but apply fails.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Fail to apply config

Post 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();"
Former Nagios Employee
bercesm
Posts: 11
Joined: Wed Jan 25, 2017 4:46 am

Re: Fail to apply config

Post 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.)
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Fail to apply config

Post 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.
Former Nagios Employee
Locked