centreon-plugins icon indicating copy to clipboard operation
centreon-plugins copied to clipboard

[os::windows::snmp::plugin] --mode=service: CRITICAL: Number of services total: 0 when bracket in service name

Open joschi99 opened this issue 1 year ago • 9 comments

If we have brackets in a service name the service will not found:

centreon_plugins.pl --hostname=x.x.x.x --snmp-community='public' --snmp-version=1   --snmp-timeout= --plugin=os::windows::snmp::plugin --mode=service  --filter-name='SQL Full-text Filter Daemon Launcher (SHAREPOINT)' --warning-status= --critical-status='%{operating_state} !~ /active/' --warning-active= --warning-continue-pending= --warning-pause-pending= --warning-paused= --critical-active= --critical-continue-pending= --critical-pause-pending= --critical-paused= --warning-total= --critical-total=1:
CRITICAL: Number of services total: 0 | 'services.total.count'=0;;1:;0; 'services.active.count'=0;;;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;

joschi99 avatar Aug 28 '23 06:08 joschi99

You need to backslash it or replace it by a .

garnier-quentin avatar Aug 28 '23 07:08 garnier-quentin

but works with discovery?

joschi99 avatar Aug 28 '23 07:08 joschi99

It depends of your discovery module. With centreon module you can replace characters with regexp

garnier-quentin avatar Aug 28 '23 07:08 garnier-quentin

thanks

joschi99 avatar Aug 28 '23 07:08 joschi99

Ok, configuring a replace should work, but how we can approach all existing services using brackets? Need to reconfigure everyone? In the past the service check with option with option --regex has supportet brackets without problems. Are you able to support brackets in this new version to avoid problems with the new version?

joschi99 avatar Aug 31 '23 13:08 joschi99

You can still use the old options. We can also add an option to backslash special characters in the code (help user)

garnier-quentin avatar Aug 31 '23 13:08 garnier-quentin

the new version is better, an option to backslash special characters should be very usefull and simple to use and helps to avoid problems for older created services.

joschi99 avatar Aug 31 '23 14:08 joschi99

Hello, i am using latest centreon 23.10.4 and i got this problem too with all services with a space in in Example : /usr/lib/centreon/plugins//centreon_windows_snmp.pl --plugin=os::windows::snmp::plugin --mode=service --hostname=172.26.0.34 --snmp-version='2c' --snmp-community='public' --service='SQL Server (VEEAMSQL2016)' --warning= --critical= --state='' --regexp --filter-name='' --warning-active='' --critical-active='1:' --warning-continue-pending='' --critical-continue-pending='' --warning-pause-pending='' --critical-pause-pending='' --warning-paused='' --critical- paused='' --warning-status='' --critical-status='' --verbose

And result : CRITICAL: Number of services active: 0 | 'services.total.count'=0;;;0; 'services.active.count'=0;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;

If i put only SQL in service name that work but i got all the sql services :

/usr/lib/centreon/plugins//centreon_windows_snmp.pl --plugin=os::windows::snmp::plugin --mode=service --hostname=172.26.0.34 --snmp-version='2c' --snmp-community='public' --service='SQL' --warning= --critical= --state='' --regexp --filter-name='' --warning-active='' --critical-active='1:' --warning-continue-pending='' --critical-continue-pending='' --warning-pause-pending='' --critical-pause-pending='' --warning-paused='' --critical-paused='' --warning-status='' --critical-status='' --verbose OK: All services are ok | 'services.total.count'=4;;;0; 'services.active.count'=4;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0; Service 'SQL Server Browser' state is 'active' [installed state: 'installed'] Service 'SQL Server VSS Writer' state is 'active' [installed state: 'installed'] Service 'SQL Server (VEEAMSQL2016)' state is 'active' [installed state: 'installed'] Service 'SQL Server CEIP service (VEEAMSQL2016)' state is 'active' [installed state: 'installed']

And if i put a filter with a space in in i got he error : CRITICAL: Number of services active: 0 | 'services.total.count'=0;;;0; 'services.active.count'=0;;1:;0; 'services.continue.pending.count'=0;;;0; 'services.pause.pending.count'=0;;;0; 'services.paused.count'=0;;;0;

How i can filter to only have the service wanted : SQL Server (VEEAMSQL2016)

Thanx in advance

Sincerelly

NTIC94130 avatar Dec 28 '23 14:12 NTIC94130

Hi,

I've the same issue:

/usr/lib/centreon/plugins//centreon_windows_snmp.pl --plugin=os::windows::snmp::plugin --mode=service --hostname=x.x.x.x --snmp-version='2c' --snmp-community='troll' --filter-name='^(SQL Server \(SQLDATABASE\)$)' --warning-active= --critical-active=1: --snmp-timeout='30' --snmp-autoreduce

It's OK in cli, but KO in WebUI @garnier-quentin

@NTIC94130 : You can escape '(' with '' and the name of your service should be in filter-name not in service param The regex option is not mandatory because the filter-name param take it.

tlepelier avatar Jan 25 '24 09:01 tlepelier

Hello :)

We had put a fix on this in June release for the discovery : "Windows SNMP - Fixed an issue with windows services containing parenthesis blocking discovery exportation. This parenthesis will automatically be replaced by square brackets to avoid this issue."

And if you only use the command line way you can use Quentin advice above : "You need to backslash it or replace it by a ."

I close this issue, feel free to re-open it if the fix proposed in June release doesn't fully fix it.

lucie-dubrunfaut avatar Jun 28 '24 09:06 lucie-dubrunfaut