Page 1 of 1

unable to remove service check from Nagios

Posted: Wed Jun 14, 2023 9:01 am
by Pratapa
Hi,

We are using Nagios core 4.4.4

We need to remove a service check "SAN Device Backup" . Its hostname is dc2aldc08a.

Service definition is as follows :

define service{
service_description SAN Device Backup
use cisco-service
hostgroups CISCO SAN
check_command Backup-Cisco-SAN
max_check_attempts 3
retry_interval 10
check_interval 1440
}

I removed host dc2aldc08a from the hostgroup CISCO SAN and ran sanity check. But we are getting error.

Error: Could not find any host matching '#dc2aldc08a' (config file /usr/local/nagios/etc/objects/hostgroups.cfg starting on line 400
Error : Could not expand members specified in the hostgroup (config file '/usr/local/nagios/etc/objects/hostgroups.cfg' starting on line 400

What could be the reason.

Re: unable to remove service check from Nagios

Posted: Wed Jun 14, 2023 5:58 pm
by kg2857
What's that # character in the error message?
Maybe post the hostgroup here.

Re: unable to remove service check from Nagios

Posted: Thu Jun 15, 2023 5:44 am
by Pratapa
I commented the host in the hostgroup file using # at the beginning of the hostname.
#dc2ald08a

Re: unable to remove service check from Nagios

Posted: Thu Jun 15, 2023 5:48 pm
by kg2857
That's the problem.

Re: unable to remove service check from Nagios

Posted: Wed Aug 30, 2023 9:16 pm
by Feativill
Nagios provides several built-in tools to help with configuration debugging. For example, you can use the Nagios configuration verification tool (nagios -v /path/to/nagios.cfg) to check for any syntax errors or configuration problems. Additionally, the Nagios web interface may provide further details about the error if you navigate to the specific host or service definition.
[align=right]splatoon 3[/align]

Re: unable to remove service check from Nagios

Posted: Tue Sep 05, 2023 11:29 am
by swolf
Hi @Pratapa, thanks for reaching out.

I agree with @kg2857. You will need to actually remove the hostname from the listing, not just use a pound sign. There are ways to use comments in Nagios Core, but for this change, I would leave the information on a separate line, instead of trying to leave a comment inside the hostgroup definition.

Please let me know if that helps or if you have any further questions or concerns.

-Sebastian Wolf