Page 1 of 1

Error: Could not find a service matching host name

Posted: Wed Aug 24, 2016 4:49 am
by kaushalshriyan
Hi,

I am facing a issue whose details are as below :-

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.2.0
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-01-2016
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Could not find a service matching host name 'nodejs01.example.in' and description 'check_rabbitmq_example_smsqueue' (config file '/usr/local/nagios/etc/objects/servicegroups.cfg', starting on line 1)
Error: Could not expand members specified in servicegroup 'rabbitmqqueues' (config file '/usr/local/nagios/etc/objects/servicegroups.cfg', starting at line 1)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

cat nodejs01.example.in.cfg
define service {
use generic-service
host_name nodejs01.example.in
service_description Check Rabbit MQ SMS Queue
check_command check_nrpe!check_rabbitmq_example_smsqueue
servicegroups rabbitmqqueues
}

define service {
use generic-service
host_name nodejs01.example.in
service_description Check Rabbit MQ Email Queue
check_command check_nrpe!check_rabbitmq_example_emailqueue
servicegroups rabbitmqqueues

define servicegroup{
servicegroup_name rabbitmqqueues
alias RabbitMQ Helpcchat queues
members nodejs01.example.in,check_rabbitmq_example_smsqueue,nodejs01.example.in,check_rabbitmq_example_emailqueue
}

hostname :- nodejs01.example.in
service :- check_rabbitmq_example_smsqueue

hostname :- nodejs01.example.in
service :- check_rabbitmq_example_emailqueue

Any help will be highly appreciable.

Thanks and Regards,

Kaushal

Re: Error: Could not find a service matching host name

Posted: Wed Aug 24, 2016 10:27 am
by rkennedy
Can you show us your host definition for nodejs01.example.in as well?

Re: Error: Could not find a service matching host name

Posted: Wed Aug 24, 2016 7:11 pm
by kaushalshriyan
Hi Robert,

Please find the below details :-

host definition :- http://sprunge.us/hGSg located inside /usr/local/nagios/etc/servers
cat nagios.cfg -> http://sprunge.us/KYEY in /usr/local/nagios/etc

Regards,

Kaushal

Re: Error: Could not find a service matching host name

Posted: Wed Aug 24, 2016 7:15 pm
by kaushalshriyan
Hi Robert,

cfg_dir=/usr/local/nagios/etc/servers as mentioned in nagios.cfg file located inside /usr/local/nagios/etc directory

Regards,

Kaushal

Re: Error: Could not find a service matching host name

Posted: Wed Aug 24, 2016 8:10 pm
by Box293
kaushalshriyan wrote:Error: Could not find a service matching host name 'nodejs01.example.in' and description 'check_rabbitmq_example_smsqueue' (config file '/usr/local/nagios/etc/objects/servicegroups.cfg', starting on line 1)
You do not have a service called check_rabbitmq_example_smsqueue, your service is called Check Rabbit MQ SMS Queue.

Your servicegroup definition should be:

Code: Select all

define servicegroup{
servicegroup_name rabbitmqqueues
alias RabbitMQ Helpcchat queues
members nodejs01.example.in,Check Rabbit MQ SMS Queue,nodejs01.example.in,Check Rabbit MQ Email Queue
}