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.
Post Reply
salukanw
Posts: 1
Joined: Thu Jul 20, 2023 12:14 am

Error: Service has no hosts and/or service_description

Post by salukanw »

I am using Nagios Core 4.1.1 & Nconf to monitor our infrastructure. I can remove a host from nconf. But after removing host and running Generate Nagios Config gives following error. Host is still appearing on Nagios Core.

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Service has no hosts and/or service_description (config file '/var/www/nconf/temp/dc1ni_collector/advanced_services.cfg', starting on line 192)
Error processing object config files!

Line no points to this.

define service {
service_description Oracle - Connection
check_command check_oracle_connection!--connect IRIS
check_period 24x7
notification_period 24x7
hostgroup_name Databases - Oracle
servicegroups Oracle Services
contact_groups +admins,Imaging.Application Support
use service-template_05-min
}

Why can't i remove hosts from Nagios Core?
kg2857
Posts: 237
Joined: Wed Apr 12, 2023 5:48 pm

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

Post by kg2857 »

Well, since there are no hosts defined, how exctly is the hostgroup defined? I don't use spaces in names, but I use nagios XI and it tends to use the names as filenames and if there are spaces (or other funky chars), odd things can happen. That's not to say that's what's happened, just a thought.
As an example, nagios core and XI don't validate hostnames or IP addresses. Both have rules defined in RFCs for validity when it comes to syntax. My point is, it's up to the nagios admin to use naming conventions to avoid nagios making a mistake. That means conforming to RFC's, and not using funny characters, or spaces in things that could become filenames. This helps us not to have to deeply read the nagios documentation.
Post Reply