5.8.3 not saving the host_name for services

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
dscrimpsher
Posts: 13
Joined: Wed Jan 22, 2014 4:24 pm

5.8.3 not saving the host_name for services

Post by dscrimpsher »

Running on Ubuntu 20.04 64bit. I upgraded from 5.7.3 to 5.8.3.
The issue I am having is when i edit a service and click the save button the Managed Hosts are not saved. I apply the configuration and I get the error "Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/vm-master.cfg', starting on line 304)". I go back to edit the service in CCM and the Managed Host is back at '0' and no host is listed. It appears that the Managed Hosts selection does not get saved.

Here is an example of the steps.
I do the Delete, Write and Verify of the files with no errors.
I go into CCM and Services. Click on a service to edit.
There is a Managed Hosts entry.
Capture1.PNG
I can even click on the View Config button to look at the config file and see the hosts_name tag.
Capture2.PNG
I click on the Save button and then the Apply Configuration button
Capture3.PNG
Now I get the error
Capture4.PNG
I go back to edit this same service and now there is no Managed Hosts
Capture5.PNG
I go through the steps to add the host again and click the Save and Apply Configuration buttons again and get the same error.
The only way I have found to get past this is to deactivate this service, then I can successfully Apply the configuration. Of course the service is now deactivated.

I have even tried to import this file from my 5.7.3 backup and I get the same result.
I delete the service, apply the config. Service is gone. I place the file from the backup into the import folder and go through the import. The import indicates it is successful. The host_name is in the imported file. I apply the config and same error again.

When I go through the Delete, Write and Verify to create the files from the database I look in the files under services folder. All the files include the host_name tag inside each service in all the files except for the file with the service I tried to update. That file is missing the host_name tag. This happens with any service I edit.
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: 5.8.3 not saving the host_name for services

Post by gsmith »

Hi

Please provide me with a system profile
To send us your system profile.
1. Login to the Nagios XI GUI using a web browser.
2. Click the "Admin" > "System Profile" Menu
3. Click the "Download Profile" button
4. Save the profile.zip file and share this a private message and then reply to this post to bring it up in the queue.

Thanks
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: 5.8.3 not saving the host_name for services

Post by benjaminsmith »

Hi,

In addition to the profile, can you re-create the error in the CCM, and then run the following command to dump the database and then send the file as well in a PM, and we'll try to replicate it.

Code: Select all

mysqldump -uroot -pnagiosxi nagiosql > nagiosql.sql
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: 5.8.3 not saving the host_name for services

Post by gsmith »

Hi,

When I loaded your system and tried to apply the configuration I was receiving errors.

In order to get rid of the errors I did the following:

localhost -delete 4 services in file (12 in file, 8 in gui)
/usr/local/nagios/etc/services/localhost.cfg has 12 services, gui has 8
service_description Service Status - mysqld
service_description Memory Usage
service_description Service Status - crond
service_description Service Status - httpd

delete host jenzabar1.csi.edu - in CCM gui
delete 6 leftover services jenzabar1.csi.edu - in CCM gui but not in cfg file
TmsEPrd MSSQL Connection Time
TmsEPrd MSSQL Database Size
TmsEPrd MSSQL Log File Usage
TmsEPrd MSSQL Transactions / Sec
Total User Connections
Uptime

You can only successfully apply a configuration if there are no errors. If there are errors the system will
roll back the changes to last known good. One way to make things less messy is
to run the "Apply Configuration" after you make changes to one host, that way things are narrowed
down for you.

Once you fix the issues above your problem should be solved.

Please let me know how things turn out.

Thanks
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: 5.8.3 not saving the host_name for services

Post by ssax »

See the previous post but you can try doing this as well:

Please go to Configure > Core Config Manager > Tools > Config File Management:
- Click the Delete Files button (don't worry, it's safe, they will be rewritten)
- Then click the Write Configs button
- After they are done writing, click verify, if it verifies properly try to apply config
dscrimpsher
Posts: 13
Joined: Wed Jan 22, 2014 4:24 pm

Re: 5.8.3 not saving the host_name for services

Post by dscrimpsher »

Thank you for the reply. Unfortunately your instructions do not address the issues I am talking about.
I can do the whole process in CCM for the Delete, Write and Verify files, without any errors.
I can also go to CCM -> Quick Tools -> Apply Configuration and click on the Apply Configuration button and get a 'Configuration applied successfully' message and the green box with "Nagios Core was restarted with an updated configuration." message. I will attach a new profile file that is not giving me any error messages and does successfully apply the configuration in a DM to you.

First I click on the button to Delete the configuration files; There are no files in the /usr/local/nagios/etc/services or hosts folders.
Then I go into CCM -> Monitoring -> Services and click on a service I want to modify, doesnt matter what property I want to change, when I click on the Save button something happens that removes the the host that is selected in the Managed Hosts property. Because there is no host selected I get an error when I click the Apply Configuration button. The error says Error: Service has no hosts and/or service_description... I go back to the service I just modified and there is no host defined again. Now there are files in the /usr/local/nagios/etc/services folder. The config file that the error is calling out does not have the hosts_name tag under the service in question.

Look:
1 host is in the Managed Hosts property.
Capture10.PNG
I click the Save button...
Click the Apply Configuration button...Get the error...
Capture11.PNG
Go back CCM -> Monitoring -> Services to edit that same service again and there is no host specified...
Capture12.PNG
The cycle repeats. Edit Service..No Host..Add Host..Click Save..Edit Service..No Host..Add Host..Click Save..Edit Service...Still no Host specified.. and so on.... There is no way I can figure out that will save the Managed Hosts property with any host that was selected.

Since the hosts does not get saved with the service and applying the configuration always fails I have to Deactivate the service that does not have the host specified and then I can Apply Configuration successfully. I can also go through CCM Delete, Write and Verify the config files successfully. If I try to Active the Service and Select the Host again, click Save I get the error again.

My own observations...
Why would the host specified in the service properties NOT get saved? I upgraded from 5.7.3 to 5.8.3 and all the services configured are being monitored properly, just as they were before the upgrade. Any service I edit, no matter what property I modify, or if I simply click the Save button without changing anything, the Managed Hosts property gets erased or ignored when the Save button is clicked on. I can edit a service and click the Cancel button without any issue, but when I click the Save button this causes the issue. I dont think I am doing anything wrong as I have used NagiosXI successfully for several years now. If it is something I am doing please enlighten me about what I am doing incorrectly.

Thank you for any help you can offer,

Dan
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: 5.8.3 not saving the host_name for services

Post by ssax »

Run this command:

Code: Select all

mysql -uroot -pnagiosxi -e 'select @@GLOBAL.sql_mode;'
If it outputs anything other than this:

Code: Select all

root@ubuntu:~# mysql -uroot -pnagiosxi -e 'select @@GLOBAL.sql_mode;'
mysql: [Warning] Using a password on the command line interface can be insecure.
+-------------------+
| @@GLOBAL.sql_mode |
+-------------------+
|                   |
+-------------------+
Then edit this file:

Code: Select all

/etc/mysql/mysql.conf.d/mysqld.cnf
Add this under the [mysqld] section:

Code: Select all

sql_mode=""
Then restart msyql/apache:

Code: Select all

systemctl restart mysql apache2
Then apply configuration and see if that resolves the issue.

If it does not, please create a ticket for this and include a link back to this forum thread so we can get a remote session setup:

https://support.nagios.com/tickets/

Thank you!
dscrimpsher
Posts: 13
Joined: Wed Jan 22, 2014 4:24 pm

Re: 5.8.3 not saving the host_name for services

Post by dscrimpsher »

That did the trick!

Got this from the query.

mysql: [Warning] Using a password on the command line interface can be insecure.
+-----------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode |
+-----------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,
NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------------------------------------------------------+

I edited the file you noted and restarted services. Now it is working like it should.
I also have green checks on the System Status page for the monitoring engine and performance grapher.

Thank you so much for the help.

Dan
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: 5.8.3 not saving the host_name for services

Post by vtrac »

Great!! ... may be lock / close this thread?

Regards,
Vinh
dscrimpsher
Posts: 13
Joined: Wed Jan 22, 2014 4:24 pm

Re: 5.8.3 not saving the host_name for services

Post by dscrimpsher »

Yes, thank you.
Locked