Update to CheckMK 2.2 CEE

CMK version: 2.1.0p28.cee → 2.2.0.cee
OS version: Ubuntu 22.04 LTS

Error message: Error: name ‘DropDownChoice’ is not defined

Dear CheckMK Forum users, we have a problem with Updating from 2.1.0p28.cee → 2.2.0.cee.

The following lines are the last before (inlcuding) the error message:

[...]
Creating temporary filesystem /omd/sites/mysite/tmp...OK
Executing update-pre-hooks script "01_init_state_creation.py"...OK
Executing update-pre-hooks script "01_mkp-disable-outdated"...OK
Executing update-pre-hooks script "02_cmk-update-config"...
-| ATTENTION
-|   Some steps may take a long time depending on your installation.
-|   Please be patient.
-| 
-| Verifying Checkmk configuration...
-|  01/04 Rulesets...
-| Unknown error on pre update action.
-| Error: name 'DropdownChoice' is not defined
-| 
ERROR (exit code: 1)

We tried updating (with snapshot to roll-back when needed) without changing anything, but that didn’t work.
Afterwards, we disabled all CheckMK Exchange MKPs for this update, yet still no luck with updating.

The following extensions were active (before being disabled):

  • MSTeams (Ricardo Ribeiro)
  • apcaccess (Robert Sander)
  • blacklist (ways)
  • unifi_controller (thorstenspille)
  • mikrotik (thomas.tretbar)
  • redis (has been disabled for quite a while now)
  • php_fpm (has been disabled for quite a while now)

Does anybody have any similar problems with updating to 2.2 ?

FYI - Error messages before
We encountered an error message saying ListChoice is not defined.
We got past this by removing/commenting some msteams rules in ~/etc/check_mk/conf.d/wato/rules.mk.

Best regards,
pixelpoint

this is the plugin causing the error.
Are you sure you disabled the package?
If i run mkp disable mikrotik after the failed update and run “cmk-update-config” again it looks fine to me

Hello _rb, thanks for taking the time to help :slight_smile:

I think all extensions were disabled, but I tested it again and I do get a different error now.

Executing update-pre-hooks script "02_cmk-update-config"...
-| ATTENTION
-|   Some steps may take a long time depending on your installation.
-|   Please be patient.
-| 
-| Verifying Checkmk configuration...
-|  01/04 Rulesets...
-| WARNING: Invalid rule configuration detected
-| Ruleset: notification_parameters:msteams
-| Title: Parameters for Microsoft Teams
-| Folder: main
-| Rule nr: 1
-| Exception: The URL must begin with <tt>http</tt> or <tt>https</tt> and end with <tt>/check_mk/</tt>.
-| 
-| You can abort the update process (A) and try to fix the incompatibilities with a downgrade to the version you came from or continue (c) the update.
-| 
-| Abort update? [A/c]
c
-|  02/04 UI extensions...
-|  03/04 Agent based plugins...
-|  04/04 Deprecated .mk configuration of plugins...
-| Done (success)
-| 
-| Updating Checkmk configuration...
-|  01/21 Validate user IDs...
-|  02/21 Update views...
-|  03/21 Update dashboards...
-|  04/21 Update reports...
-|  05/21 User attributes...
-|  06/21 Global settings...
-|  07/21 Rulesets...
-|  + "Rulesets" failed
-| Traceback (most recent call last):
-|   File "/omd/sites/mysite/lib/python3/cmk/update_config/main.py", line 223, in __call__
-|     action(self._logger, self.update_state.setdefault(action.name))
-|   File "/omd/sites/mysite/lib/python3/cmk/update_config/plugins/actions/rulesets.py", line 54, in __call__
-|     _transform_wato_rulesets_params(
-|   File "/omd/sites/mysite/lib/python3/cmk/update_config/plugins/actions/rulesets.py", line 160, in _transform_wato_rulesets_params
-|     valuespec = ruleset.valuespec()
-|                 ^^^^^^^^^^^^^^^^^^^
-|   File "/omd/sites/mysite/lib/python3/cmk/gui/watolib/rulesets.py", line 879, in valuespec
-|     return self.rulespec.valuespec
-|            ^^^^^^^^^^^^^^^^^^^^^^^
-|   File "/omd/sites/mysite/lib/python3/cmk/gui/watolib/rulespecs.py", line 348, in valuespec
-|     return self._valuespec()
-|            ^^^^^^^^^^^^^^^^^
-|   File "<string>", line 84, in _valuespec_special_agent_mikrotik
-| NameError: name 'ListChoice' is not defined
-|  08/21 Autochecks...
-|  09/21 Remove unused host attributes....
-|  10/21 Cleanup version specific caches...
-|  11/21 Background jobs...
-|  12/21 Extract remote sites CAs...
-|  13/21 Add a rule_id to each notification rule...
-|  14/21 Change absolute paths in registered hosts symlinks to relative...
-|  15/21 Remove old custom logos...
-|  16/21 Check for incompatible password hashes...
-|  17/21 Update licensing folders or settings...
-| Transform subscription settings
-| Remove deprecated subscription settings /omd/sites/mysite/etc/check_mk/multisite.d/subscription_settings.mk
-| Rename folder /omd/sites/mysite/var/check_mk/license_usage to /omd/sites/mysite/var/check_mk/licensing
-| Upgrade license usage report
-| No such instance id; create new one.
-|  18/21 Transform spool files...
-|  19/21 Update backup config...
-|  20/21 Removing deprecated allocated_ports file...
-|  21/21 Update Agent Bakery...
-| Done (with errors)
ERROR (exit code: 1)

It seems, MSTeams (though disabled) throws an error. I tried to continue the process, but the Rulesets step now says NameError: name ‘ListChoice’ is not defined.

OMD[mysite]:~$ mkp list
Name             Version Title                               Author                                       Req. Version Until Version Files State                        
---------------- ------- ----------------------------------- -------------------------------------------- ------------ ------------- ----- -----------------------------
apcaccess        5.2.0   APC Status via apcaccess            Robert Sander <r.sander@heinlein-support.de> 2.1.0        None          7     Enabled (active on this site)
blacklist        3.1     blacklist                           pixelpoint                                   2.0.0p3      None          2     Enabled (active on this site)
unifi_controller 0.83    Unifi API with piggyback Devices    Bash Club                                    2.0.0p3      None          14    Enabled (active on this site)
redis            1.0     Redis monitoring                    tribe29 GmbH                                 1.6.0        None          13    Disabled                     
MSTeams          2.1     Microsoft Teams Notification Plugin Ricardo Ribeiro                              2.1.0p01     None          2     Disabled                     
mikrotik         2.3.3   MikroTik                            thomas.tretbar@managedhosting.de             2.0.0        None          25    Disabled                     
php_fpm          0.20    PHP-FPM monitoring                  Ilya Rassadin elcamlost at gmail dot com     1.6.0p1      None          5     Disabled

That’s the same error from earlier today.
The “solution” was to remove every line containing msteams in ~/etc/check_mk/conf.d/wato/rules.mk, but that just led to the error ‘DropDownChoice’ is not defined.

Our CheckMK has some rules for MS Teams notifications, could that be the left-over from MSTeams after disabling it?
They were user-notification rules (not in the general notification tab).

Best regards,
pixelpoint

The rule errors are not the big problem.

This one is more important. It comes from a gui extension. In this case it should be the Mikrotik special agent.
You can do a grep over your ~/local/ folder to find the files left there inside.
Such a problem can happen if you change/copy a file contained inside a mkp to another location. Then it will not be removed at deactivation time of the mkp.

I had a look a the Mikrotik files and there are the imports missing for some elements used inside the valuespec.

1 Like

That’s a good point. Have you changed files in the local directory before?

We implemented some pre update checks and i wonder why they did not abort the update

Overlooked this yesterday.
Did you get this prompt also for the first error?

This incompatibilities have to be fixed before you continue the update.
I hope this werk will help you:

I am very sorry for taking such a long time to answer, I only got to read your replies and test again today.

The Update to 2.2.0 finally went through, thanks to your help!

SOLUTION

  1. Disable and uninstall MSTeams

My colleague had created a user-specific MS Teams notifications rule, he removed it.

Commented every line with msteams in some rules.mk files.
Found with:

for rulefile in $(find -type f -iname 'rules.mk'); do grep 'msteams' -l -i --color "$rulefile"; done
  1. Disable and uninstall Mikrotik + remove dissolved package files

At one point my colleague had to modify the Mikrotik plugin, so the package was dissolved.
These files were forgotten and still lingered in the system, so they were deleted alltogether.
I found them with:

find -L ~/local -type f

After that, the update went through :slight_smile:

@_rb Thank you for the link, I will probably need it when re-installing plugins (I think MSTeams needs the socket import)

@andreas-doehler Thank you for pointing me to the mikrotik plugin!

Best regards,
pixelpoint