Error: Service has no hosts and/or service_description

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jbursa
Posts: 11
Joined: Fri Mar 10, 2017 9:04 am

Error: Service has no hosts and/or service_description

Post by jbursa »

I am trying to install nagiosxi 5-4.0.2.el7 in an offline mode using rpm files which I downloaded from the nagios site.
I needed to use the offline mode because I can not get to external websites from our servers.
Eventually I was able to get all the dependencies installed and startup nagoisxi.

Prior to installing xi, I installed nagios core and created numerous configuration files.
I am now in the process of trying to import the flat files into nagios XI.
Originally I tried to install all the configuration files using the cfgprep approach.
I tried to import the files in the recommended order but always ended up with an issue I would not resolve.
I then tried to setback and use a small set of contacts, templates, service and hosts as possible using the import approach.

I placed the single cfg file in the import directory, deleted prior files, wrote new ones and selected verify.
I could not work my way around the "Error: Service has no hosts and/or service_description" in my services file.
I could never get a host_name or hostgroup_name to appear in the file. The entry was always missing.
In looking at the services within the configuration manager, I could see that there was a host name and hostgroup_name assigned to the service.
I tried to add multiple hosts and groups to the service but nothing would ever appear.
I even tried to create a service from scratch and when I regenerated the file, the new service would also be missing the host name.

Finally I tried to revert back to the original configuration by running, scripts/restore_defaults.sh.
Unfortunately I kept getting a "NAGIOSQL LOGIN FAILED" error in the generated nagiosql.login file.
I tried to reset the security credentials and remove the old files in services and hosts, but it did not help.
For some reason the php function get_component_credential, was returning the wrong value.
As of yet, I have not updated the password so I still have the default.
I searched everything in /usr/local and could not find the string nagios was pulling anywhere.
I am not very familiar with php so I could not determine where the function was pulling the password from.
The php include files all still have the initial value.

I was able to force the restore_defaults.sh script to work by hardcoding the password in the file.
I still got the same error that the services did not have a host defined for localhost.
I tried removing the nagioscore, nagiossql and nagiosxi packages and reinstalling them.
I still got the same error that the services did not have a host defined for local host.

So my questions are:
1) Why is host_name and hostgroup_name not appearing in my services files which are being generated by xi?
2) Where is get_component_credential pulling the password from because its not what I expect?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Error: Service has no hosts and/or service_description

Post by avandemore »

First off, I probably would have asked here sooner. I think you dug your hole a little deeper as we all have at times. ;)

1) I'd really need to see the configs. There were some issues addressed earlier in a possibly related update: https://assets.nagios.com/downloads/nag ... NGES-5.TXT
2) I think this may be an example of an XY problem. Let's start at the beginning. What problem as of right now do you wish to solve?
Previous Nagios employee
jbursa
Posts: 11
Joined: Fri Mar 10, 2017 9:04 am

Re: Error: Service has no hosts and/or service_description

Post by jbursa »

I guess I would like to start with the missing host_name and hostgroup_name in the services file.

Which configuration files would you like to see?
I will send you my nagios.cfg, even though its pretty much the default since I recently reinstalled xi.

I searched though the bug list in the link you sent and I could not figure out what XY problem you were referring to.
The in the search results seemed to all point to proXY.
Note: I did update /etc/wgetrc to not use a proxy for localhosts requests.

I tried to update from nagiosxi 5.4.0 to 5.4.3 but was not successfully uses the instructions that I found.
I untar'ed the zip file to /tmp and changed to the /tmp/nagiosxi directory.
When I executed ./upgrade, I get the following:

RPM Install detected, switching to yum update
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
[Errno -2] Name or service not known
No packages marked for update
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Error: Service has no hosts and/or service_description

Post by avandemore »

Can you attach or PM your config files pre-upgrade attempt eg when they were in a working state.
Previous Nagios employee
jbursa
Posts: 11
Joined: Fri Mar 10, 2017 9:04 am

Re: Error: Service has no hosts and/or service_description

Post by jbursa »

I think something must have gone wrong during my initial nagiosxi install.
Prior to my attempt, I did not update /etc/wgetrc to ignore localhost for the proxy.

Later I did try to uninstall nagiosxi using the uninstall script, but that did not fix my issue.
I think my problem was in in the nagiossql DB which the uninstall did not seem to remove.
I reran the uninstall and dropped the all the remaining DBs.
Upon reinstalling nagios XI, I was able to successfully generate the cfg files.
Thanks for the earlier feedback. I am good to go now.
Locked