Update to 2.2.0 error in msteams plugin

CMK version:
2.1.0p39cre

OS version:
Oracle Linux 8

Error message:

I try to update checkmk from 2.1.0p39 to 2.2.0p25 raw

I have 2 mkp plugins witch i need

OMD[checkmk]:~$ mkp list
Name            Version Title                               Author                                       Req. Version Until Version Files State
--------------- ------- ----------------------------------- -------------------------------------------- ------------ ------------- ----- -----------------------------
MSTeams         2.1     Microsoft Teams Notification Plugin Ricardo Ribeiro                              2.1.0p01     None          2     Enabled (active on this site)
sslcertificates 8.7.2   SSL-Certificates                    Robert Sander <r.sander@heinlein-support.de> 2.0.0        None          6     Enabled (active on this site)

During update I see

-| [MSTeams 2.1]: Not uninstalling
-| [sslcertificates 8.7.2]: Not uninstalling
-| [MSTeams 2.1]: Updating from 2.1
-| [MSTeams 2.1]: Installed
-| [sslcertificates 8.7.2]: Updating from 8.7.2
-| [sslcertificates 8.7.2]: Installed
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...
-| Failed to load plugin /omd/sites/checkmk/local/share/check_mk/web/plugins/wato/msteams.py: name 'socket' is not defined
-| Traceback (most recent call last):
-|   File "/omd/sites/checkmk/lib/python3/cmk/gui/utils/__init__.py", line 66, in load_web_plugins
-|     exec(f.read(), globalvars)
-|   File "<string>", line 18, in <module>
-| NameError: name 'socket' is not defined
-| Failed to load plugin /omd/sites/checkmk/local/share/check_mk/web/plugins/wato/msteams.py: name 'socket' is not defined
-| Traceback (most recent call last):
-|   File "/omd/sites/checkmk/lib/python3/cmk/gui/utils/__init__.py", line 66, in load_web_plugins
-|     exec(f.read(), globalvars)
-|   File "<string>", line 18, in <module>
-| NameError: name 'socket' is not defined
-|  02/04 UI extensions...
-| Failed to load plugin /omd/sites/checkmk/local/share/check_mk/web/plugins/wato/msteams.py: name 'socket' is not defined
-| Traceback (most recent call last):
-|   File "/omd/sites/checkmk/lib/python3/cmk/gui/utils/__init__.py", line 66, in load_web_plugins
-|     exec(f.read(), globalvars)
-|   File "<string>", line 18, in <module>
-| NameError: name 'socket' is not defined
-| Incompatible file 'msteams' of extension package 'MSTeams 2.1'
-| Error: name 'socket' is not defined
-|
-| You can abort the update process (A) or disable the extension package (d) and continue the update process.
-| Abort the update process? [A/d]

I don’t know python i see socket in 18 line

OMD[checkmk]:~$ cat -n  /omd/sites/checkmk/local/share/check_mk/web/plugins/wato/msteams.py
     1  #!/usr/bin/env python3
     2  # -*- encoding: utf-8; py-indent-offset: 4 -*-
     3  # Author : ricardoftribeiro@gmail.com @krfribeiro
     4
     5  from cmk.gui.plugins.wato import HTTPProxyReference
     6  from cmk.utils.site import omd_site
     7
     8  register_notification_parameters("msteams", Dictionary(
     9      elements = [
    10          ("url_prefix",
    11                   TextAscii(
    12                       title=_("URL prefix for links to Check_MK"),
    13                       help=_("Your Check_MK servers address with this format : http/https://server/sitename/"),
    14                       allow_empty=False,
    15                       regex="^(http|https)://.*/.*/$",
    16                       regex_error=_("The URL must begin with <tt>http</tt> or <tt>https</tt> and end with <tt>/</tt>."),
    17                       size=64,
    18                       default_value="http or https://" + socket.gethostname() + "/" + omd_site() + "/",
    19          )),
    20          ("webhook", TextAscii(
    21              title = _("Webhook URL"),
    22              help = _("MS-Teams Channel webhook URL"),
    23              allow_empty = False,
    24          )),
    25          ("proxy_url", Transform(
    26              HTTPProxyReference(),
    27              forth=lambda v: ("url", v) if isinstance(v, str) else v,
    28          )),
    29      ]
    30  ))
    31

Hi,

in checkmk 2.2 the Teams Notification plugin is already included, if your configuration is not to complex i would just remove the old MS Teams plugin and migrate it to the native one.

1 Like

thank you for the quick answer, I have some rules,
I have to make copies and copy them and I will try again

There’s also a newer version of the sslcertificates extension available.

https://exchange.checkmk.com/p/sslcertificates

1 Like

Thank you, it helped