NSClient automatic service check in Icinga2 - with more advance exlude rules in arg. of nsclient doesnt work

Hello everyone,

I’m working on a service check based on nsclient (0.5.2.35 2018-01-28) to check the status of automatic services on Windows Servers, where I need to pass a filter argument, but I’m having trouble with the Icinga Director and quoting. We have issue that GoogleUpdateService is every time changing that service name with version inside (postfix). So that means every time when update is present google change service name and we got critical alert. Right now icinga director conf is looking like this:

a bit exapanded list to be able better see that we are specifing a lot of google update versions in exclude.

image

so at the end we want to exclude all google update service.

Here is raw cli cmd which Icinga Director want to execute when we add filter under nrpe_arguments, which obviously should not work and doesnt working:

'/usr/lib64/nagios/plugins/check_nrpe' '-H' 'blablabla.com' '-p' '5665' '-c' 'check_service' '-a' 'exclude=edgeupdate' 'exclude=sppsvc' 'exclude=tiledatamodelsvc' 'exclude=wuauserv' 'exclude=SysmonLog' 'exclude=RemoteRegistry' 'exclude=ShellHWDetection' 'exclude=Citrix.Xip.ClientService' 'exclude=WbioSrvc' 'filter="name not like 'Google'"'

Here’s the part of the command we are struggling with:

'filter="name not like 'Google'"'

It is working ok (when we try manual) with:

filter="name not like 'Google'"

or

'/usr/lib64/nagios/plugins/check_nrpe' '-H' 'blablabla.com' '-p' '5665' '-c' 'check_service' '-a' 'exclude=edgeupdate' 'exclude=sppsvc' 'exclude=tiledatamodelsvc' 'exclude=wuauserv' 'exclude=SysmonLog' 'exclude=RemoteRegistry' 'exclude=ShellHWDetection' 'exclude=Citrix.Xip.ClientService' 'exclude=WbioSrvc' filter="name not like 'Google'"

but icinga2 director is adding extra ' character which is making problems for us.

I know the nested quotes are causing an issue, and I’ve tried a few things, but can’t seem to get it right. Could someone help me with the correct way to quote this filter argument so it works as intended?

We have tried every possible commbination with escape characters what we got on our mines and we coudlnt find solution.

We treid to add \, \\, \\\\ before ' and to switch " ', any possible combination to everywhere but nothing did work for us.

Unfortunatelly we are limited with icinga2 director and cannot use DSL (maybe it could be solved with DSL).

Also it is not option to add new powershell script on the endpoints cause we have few thousend of them.

We have 3 lv architecture (master-sat-endpoint). check_nrpe is executing on satellite side. Maybe we could develope python wrapper but that should be least solution.

Thanks in advance for your help!

Our packages:

  • Director version (System - About): 1.11.1
  • Icinga Web 2 version and modules (System - About): 2.11.4
  • Icinga 2 version (icinga2 --version): r2.13.7-1
  • Operating System and version: Centos 7
  • Webserver, PHP versions: 8.0.28