centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
311 stars 274 forks source link

[apps::microsoft::sccm::local::plugin] UNKNOWN: Unsafe code evaluation #4392

Closed consign-dev closed 1 year ago

consign-dev commented 1 year ago

Hello,

I've been trying to get SCCM plugin to work but it fails me I've followed the official documentation and adapt according to my environment, here are the results :

INPUT /usr/lib/centreon/plugins/centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin --mode=query --hostname=ip_address --port='8443' --proto='https' --legacy-password='centreon' --ssl-opt='SSL_verify_mode => SSL_VERIFY_NONE' --command=check_centreon_plugins --arg='apps::microsoft::sccm::local::plugin' --arg='site-status' --arg='--critical-status="%{status} eq FAILED"'

OUTPUT UNKNOWN: Unsafe code evaluation: Bareword "FAILED" not allowed while "strict subs" in use at (eval 43) line 1.

It seems that the --critical-status switch is the main issue, If I remove this switch and add a --verbose the result is ok

OUTPUT

OK: All sites status are ok
Site 'XY1' status is 'ACTIVE' [type: PRIMARY] [mode: '-']
Site 'XY2' status is 'ACTIVE' [type: PRIMARY] [mode: '-']
Site 'XY3' status is 'ACTIVE' [type: CAS] [mode: '-']
Site 'XY4' status is 'ACTIVE' [type: PRIMARY] [mode: '-']

Any idea ?

garnier-quentin commented 1 year ago

Please use the following option: --arg='--critical-status="%{status} =~ /FAILED/"'

consign-dev commented 1 year ago

Thank you for your prompt response ! It's now working Cheers.