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

[os::windows::snmp::plugin] --mode=service: 20230810 not working as expected #4598

Closed joschi99 closed 1 year ago

joschi99 commented 1 year ago

Using latest version 20230810 there are some problems with refactored version:

  1. if a existing service is stopped the plugin will return: UNKNOWN: No service found
  2. --warning-status or --critical-status seem's not working correctly or will be ignored. If I try to use: --critical-status='%{operating_state} != /active/' or --critical-status='%{operating_state} != /test/' output status will not change
  3. %{installed_state} is not usable until error 1 will not working, because every not existing service or every not running service will return UNKNOWN: No service found
garnier-quentin commented 1 year ago

You have the option --warning-total and --critical-total with that PR: https://github.com/centreon/centreon-plugins/pull/4606

For the issue 2, it's a syntax issue. It's a regexp so you need to use the operator !~

cgagnaire commented 1 year ago

Actually it was broken with https://github.com/centreon/centreon-plugins/pull/4573/commits/cb55715b53837159c6d0c87972a848f4726ba762 and the change in counter's label name. The addition of a "s" to "service" broked the mapping with old options:

      if (defined($options{option_results}->{critical}) && $options{option_results}->{critical} ne '') {
          $options{option_results}->{'critical-service-active-count'} = $options{option_results}->{critical};
      }

With default configuration that makes sure at least 1 service is expected (--critical=1:) you should have:

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

Eventhough the total metric is useful, you don't really need it.

I making the PR for the missing "s".

cgagnaire commented 1 year ago

Or can you add it in the https://github.com/centreon/centreon-plugins/pull/4606 @garnier-quentin ?

garnier-quentin commented 1 year ago

@cgagnaire i have add it

fixlair commented 1 year ago

Hello ! we are facing the same 1. issue !

When do you plane to merge the MR https://github.com/centreon/centreon-plugins/pull/4606 ?

Thanks a lot for your work !