Werk #13336: Windows Services works if Services states has no elements

Komponente Checks und Agenten
Titel Windows Services works if Services states has no elements
Datum 14.09.2021
Checkmk-Editon Checkmk Raw (CRE)
Checkmk-Version 2.1.0i1 2.0.0p12
Level Kleine Änderung
Klasse Bugfix
Kompatibilität Kompatibel - benötigt kein manuelles Eingreifen

This Bug affects users, if they created the rule Setup > Services > Service monitoring rules > Windows Services > New rule: Windows Services with the following two properties:

  • they added the option Service states
  • they did not create any new elements within this option
Creating this rule caused services, which check the current state of a Windows Service to crash with the error UnboundLocalError: local variable 'this_state' referenced before assignment . The problem is alleviated if any of the two properties above are changed. This patch eliminates the crash alltogether. The state of the service will now show State if no entry matches, if this option is specified. Otherwise, it shows CRIT.

The previous version of services.py falsely assumed that if params contains the key "states", that the corresponding entry contains at least one element matching the service. However, this assumption is violated if ones species a rule without any elements. In this params["states"] is the empty list [].

Zur Liste aller Werks