Question

Excluding services from monitoring on Windows.

  • 13 May 2022
  • 9 replies
  • 1970 views

Badge +2

Hello Team

I want to exlude some services with startup type Automatic on Windows Server from being monitored. I understand that it should be done in service Services-Auto. Then i should add New entries in ‘Service check options’ named EXCLUDE, EXCLUDE2, EXCLUDE3 and in the value field windows service name?

Is it correct configured on above screeshot? Thanks for reply.


9 replies

Userlevel 4
Badge +14

Hello @jakubsz 

You cannot add options (MACROS) like that, you need to use regular expression (Regexp) to exclude services.

Documentation is really light about your plugin pack : https://docs.centreon.com/pp/integrations/plugin-packs/procedures/operatingsystems-windows-nsclient-05-nrpe/ for the supervision of this operating system.

And the older documentation also :

https://docs-older.centreon.com/older/

Plugin Packs : https://docs-older.centreon.com/docs/plugins-packs/fr/latest/ or https://docs-older.centreon.com/docs/plugins-packs/en/latest/

You could have more help and understanding about plugins and regular expressions on SugarBug website https://www.sugarbug.fr/

https://www.sugarbug.fr/atelier/techniques/plugins/plugins_centreon/regex-perl/

And also the syntax about NSClient++ : https://docs.nsclient.org/checks/

A plugin pack is just an preconfigured Host template with is Services template (Not really ALL the possibility of the script behind) and maybe sometimes Discovery template to use Discovery module.

All the options (MACROS) are defined on the Command that the reason you cannot add options (MACROS) except if you create your command, your service template, host template in order to apply your host template to your host.

Command behind your service template :

$USER1$/$_HOSTNRPECLIENT$ -H $HOSTADDRESS$ -p $_HOSTNRPEPORT$ -t $_HOSTNRPETIMEOUT$ $_HOSTNRPEEXTRAOPTIONS$ -c check_service -a "filter=$_SERVICEFILTER$" "service=$_SERVICESERVICE$" "exclude=$_SERVICEEXCLUDE$" "exclude=$_SERVICEEXCLUDE2$" "warning=$_SERVICEWARNING$" "critical=$_SERVICECRITICAL$" 'top-syntax=$_SERVICETOPSYNTAX$' 'detail-syntax=$_SERVICEDETAILSYNTAX$' $_SERVICEEXTRAOPTIONS$

Regards,

Userlevel 4
Badge +14

And also here :

And others things about NSClient++ :

 

 

 

Badge +5

Could someone post an actual working example? I’ve tried various combinations and with regexp and none work. For example:

 

[root@luluxlinfpv007 ~]# /usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.125.218.245 -p 5666 -t 30 -u -2 -P 8192 -c  check_service -a "filter=start_type = 'auto' and is_trigger = 0" "service=*"  "exclude=tiledatamodelsvc" "warning=not state_is_perfect()" "critical=not state_is_ok()" 'top-syntax=${problem_list}'  'detail-syntax=${name}=${state} (${start_type})' 'perf-config=none'
OK: All 42 service(s) are ok.
[root@luluxlinfpv007 ~]# /usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.125.218.245 -p 5666 -t 30 -u -2 -P 8192 -c  check_service -a "filter=start_type = 'auto' and is_trigger = 0" "service=*"  "exclude=^(MapsBroker|tiledatamodelsvc)$" "warning=not state_is_perfect()" "critical=not state_is_ok()" 'top-syntax=${problem_list}'  'detail-syntax=${name}=${state} (${start_type})' 'perf-config=none'
tiledatamodelsvc=stopped (auto)

 

Userlevel 4
Badge +14

Hi @fvinancano_dtt 

Maybe i’m wrong, but exclude option wrong you

 

Examples

Signification

.*

Every characters

^word$

Search exact word resource

^word

Search all resource beginning by word

word$

Search all resource ending by word

^word|word1$

Search word and word1 resources

^(?!word$)

Exclude word resource

^(?!(word|word1)$)

Exclude word and word1 resources

 

^(?!(MapsBroker|tiledatamodelsvc)$)

 

Could you test with : 

[root@luluxlinfpv007 ~]# /usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.125.218.245 -p 5666 -t 30 -u -2 -P 8192 -c  check_service -a "filter=start_type = 'auto' and is_trigger = 0" "service=*"  "exclude=^(?!(MapsBroker|tiledatamodelsvc)$)" "warning=not state_is_perfect()" "critical=not state_is_ok()" 'top-syntax=${problem_list}'  'detail-syntax=${name}=${state} (${start_type})' 'perf-config=none'

 

 

Badge +5

Hi @gespada 

 

No luck

 

[root@luluxlinfpv007 ~]# /usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.125.218.245 -p 5666 -t 30 -u -2 -P 8192 -c  check_service -a "filter=start_type = 'auto' and is_trigger = 0" "service=*"  "exclude=^(?!(MapsBroker|tiledatamodelsvc)$)" "warning=not state_is_perfect()" "critical=not state_is_ok()" 'top-syntax=${problem_list}'  'detail-syntax=${name}=${state} (${start_type})' 'perf-config=none'
Invalid command line: unrecognised option '(MapsBroker|tiledatamodelsvc)$)'

 

This is the kind of stuff I’m constantly hitting with nearly every single Centreon plugin - it’s becoming quite tiresome ☹️

Badge +5

BTW, for now this has been my workaround by adding each one separately to the “EXTRAOPTIONS” field:

 

/usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.125.218.246 -p 5666 -t 30 -u -2 -P 8192 -c  check_service -a "filter=start_type = 'auto' and is_trigger = 0" "service=*"  "exclude=MapsBroker" "exclude=" "warning=not state_is_perfect()" "critical=not state_is_ok()" 'top-syntax=${problem_list}'  'detail-syntax=${name}=${state} (${start_type})' 'perf-config=none' exclude='gupdate' exclude='EVault InfoStage BUAgent' exclude='tiledatamodelsvc' exclude='ShellHWDetection'

 

But it’s a kludge that we shouldn’t need to do

Userlevel 4
Badge +14

Hi @gespada 

 

No luck

 

[root@luluxlinfpv007 ~]# /usr/lib64/nagios/plugins/check_centreon_nrpe3 -H 10.125.218.245 -p 5666 -t 30 -u -2 -P 8192 -c  check_service -a "filter=start_type = 'auto' and is_trigger = 0" "service=*"  "exclude=^(?!(MapsBroker|tiledatamodelsvc)$)" "warning=not state_is_perfect()" "critical=not state_is_ok()" 'top-syntax=${problem_list}'  'detail-syntax=${name}=${state} (${start_type})' 'perf-config=none'
Invalid command line: unrecognised option '(MapsBroker|tiledatamodelsvc)$)'

 

This is the kind of stuff I’m constantly hitting with nearly every single Centreon plugin - it’s becoming quite tiresome ☹️

 

It’s not the fault of the centreon-plugins sometimes. With NRPE, you have the nasty_metachars parameter who can complicate the execution of the command 😓

With the 4.0.2 of NRPE :

https://github.com/NagiosEnterprises/nrpe/blob/master/CHANGELOG.md#402---2020-03-11

Impossible to change the nasty_metachars, because not readed from configuration (hardcoding)

With the 4.0.3 of NRPE : 

https://github.com/NagiosEnterprises/nrpe/blob/master/CHANGELOG.md#403---2020-04-28

They added to the standard settings “ who are add to the nasty_metachars

A fix was made with the 4.1.0, but Centreon don’t packaged it https://github.com/NagiosEnterprises/nrpe/blob/master/CHANGELOG.md#410---2022-07-18 (Maybe about a licensing problem) Nagios change is license or block to Nagios only)

NRPE is depreacated since 2019/2020 but they modify it, it’s disturbing : https://github.com/NagiosEnterprises/nrpe/blob/master/README.md

Your workaround is good !

Badge +2

Bonjour,

Pour exclure la supervision de certains services voici ma commande en utilisant des --arg=”exclude=service_name” :
/usr/lib/centreon/plugins//centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin --mode=query --hostname='**' --port='**' --proto='https' --legacy-password='***' --http-backend=curl --curl-opt="CURLOPT_SSL_VERIFYPEER => 0" --timeout=40 --command=check_service --arg="filter=start_type='auto' and is_trigger=0" --arg="service=*"  --arg="exclude=TrustedInstaller" --arg="exclude=tiledatamodelsvc" --arg="warning=not state_is_perfect()" --arg="critical=not state_is_ok()" --arg='top-syntax=${problem_list}' --arg='detail-syntax=${name}=${state}(${start_type})' --arg="perf-config=none" --arg="exclude=ISSUSER"

vous pouvez ajouter l’exclusion d’autres services en ajoutant dans le champ extraoptions.

--arg=”exclude=service_name”

 

Userlevel 1
Badge +1

Hi,
You can try this
At the end of the “FILTER” macro, you can add - 

start_type = 'auto' and is_trigger = 0 and name not like 'GoogleUpdaterInternalService' and name not like 'GoogleUpdaterService' and name not in ('xxxx','other service you want to exclude','xxxx','xxxx')

replace xxxx with actual service name you want to exclude and also replace service with changing version number in you case clr_optimization_vxxxx.x in front of not like ’xxxx’. it will exclude them no matter their version number.

Regards,
CM

Reply