Page 1 of 1

Creating new service via Config Manager throws error

Posted: Tue May 19, 2020 10:29 am
by csheridan01
I am trying to create a service for a switch. I accidentally unchecked Port 53 Status and Bandwidth (CPU Interface) during the initial setup, so I tried to create the service via the Core Config Manager -> Services -> Add New option. The switch IP is 192.168.20.25, so I give it the name "192.168.20.25," choose "check_xi_service_ifoperstatus" in the Check command dropdown, give it the necessary arguments, then click on "Manage Hosts" and associate a host with that service.
When I try to apply the new configuration, I get the error "

Code: Select all

Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/192.168.20.25.cfg', starting on line 319)
"

The config file in /usr/local/nagios/etc/services/192.168.20.25.cfg is not being updated with the new service as well. What am I doing wrong?

Re: Creating new service via Config Manager throws error

Posted: Tue May 19, 2020 11:23 am
by jbrunkow
It may help to rewrite your configuration files. Navigate to Configure using the bar on top > click Core Config Manager under Advanced Configuration on the left pane > then click Config File Management under Tools > and use the buttons on that page to perform the following steps.
  1. Click Delete Files to remove your problematic configuration files.
  • Click Write Configs to generate new configuration files.
  • Click Verify Files to check for errors.
  • If any errors are returned, correct the problem they specify and then do steps 1 - 3 again.
  • Once errors are cleared, click Restart Nagios Core to apply changes.
If this does not work, please provide the errors here, and send us a profile so that we can look into this further. You can do so by navigating to System Profile under System Config on the left pane > and clicking the Download Profile button on that page.

Re: Creating new service via Config Manager throws error

Posted: Wed May 20, 2020 8:28 am
by csheridan01
Ok, there were a couple of things.

This Nagios installation is on a virtual machine, and I mistakenly set it to fixed disk size. It filled up on me, and corrupted my databases. I started over from scratch with a new VM and new Nagios installation. I forgot to edit my /etc/hosts file, so Nagios had nothing to point to when referring to "localhost." Fixed that problem. I had to fill out the forms for the service on 192.168.20.25, and assign it a host again. Once I did those things, and applied the configuration again, it worked!

Thank you for showing me that "Delete/Write/Verify" method. That showed me a detailed enough error where I could debug properly. Along with the previously mentioned error, it also showed me

Code: Select all

Could not find any host matching localhost 

Re: Creating new service via Config Manager throws error

Posted: Wed May 20, 2020 3:48 pm
by jbrunkow
I'm glad you figured it out!

Please let me know if you have any more questions, otherwise we can lock this thread for editing.