Error: Service has no hosts and/or service_description

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
neshelman
Posts: 9
Joined: Fri Dec 01, 2017 11:29 am

Error: Service has no hosts and/or service_description

Post by neshelman »

Hi, We moved from nagios 3 to 4. The upgrade was done by the zypper package manager. Now we get this error on starting the service:
Error: Service has no hosts and/or service_description (config file '/etc/nagios/objects/templates.cfg', starting on line 379)

(379) define service{
name local-service ; The name of this service template
service_description LOCAL-SERVICE
use generic-service ; Inherit default values from the generic-service definition
max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until a hard state can be determined
register 1 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}

"/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg" finds no errors.
I switched register to 0 and then it chokes at the previous template set to 1. When I set them all to 0 there are no errors on starting nagios, but the application does not start.
systemctl status nagios
show this:
● nagios.service - Network Monitor Nagios
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2019-12-12 11:17:31 EST; 21s ago
Process: 25201 ExecStart=/usr/sbin/nagios /etc/nagios/nagios.cfg (code=exited, status=1/FAILURE)
Process: 25200 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 25127 ExecStartPre=/usr/lib/nagios/nagios-exec-start-pre (code=exited, status=0/SUCCESS)
Main PID: 25201 (code=exited, status=1/FAILURE)

Dec 12 11:17:31 Storm nagios[25200]: Checked 3 host dependencies
Dec 12 11:17:31 Storm nagios[25200]: Checked 6 timeperiods
Dec 12 11:17:31 Storm nagios[25200]: Checking global event handlers...
Dec 12 11:17:31 Storm nagios[25200]: Checking obsessive compulsive processor commands...
Dec 12 11:17:31 Storm nagios[25200]: Checking misc settings...
Dec 12 11:17:31 Storm nagios[25200]: Total Warnings: 0
Dec 12 11:17:31 Storm nagios[25200]: Total Errors: 0
Dec 12 11:17:31 Storm nagios[25200]: Things look okay - No serious problems were detected during the pre-flight check
Dec 12 11:17:31 Storm systemd[1]: nagios.service: Unit entered failed state.
Dec 12 11:17:31 Storm systemd[1]: nagios.service: Failed with result 'exit-code'.

Thanks for any help you can give.
------------------------------------------------------------------------
SOlution:
qh: Failed to init socket '/var/lib/nagios/rw/nagios.qh'. bind() failed: No such file or directory
Adding this to nagios.cfg fixed things:

query_socket=/usr/local/nagios/var/rw/query.sh
Locked