CMK version: Raw 2.0.p19 OS version: Ubuntu 20.04.4 LTS Installed MKP: MSTeams-1.5.mkp from @ricardoftribeiro
Hi, hope someone could help. I´ve installed the MKP above, setting up the notification rule, restarting site and testing notification. Notification get failed, error message follows:
Error message:
> ImportError: No module named requests Traceback (most recent call last): -- File "/omd/sites/azure/local/share/check_mk/notifications/msteams", line 6, in <module> -- import requests -- ImportError: No module named requests
Output of: “sudo pip3 install requests”:
> Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.22.0)
Output of: “sudo apt install python3-requests”:
> python3-requests is already the newest version (2.22.0-2ubuntu1)
same result:
Traceback (most recent call last): – File “/omd/sites/azure/local/share/check_mk/notifications/msteams”, line 6, in – import requests – ImportError: No module named requests
It looks like the shebang is not replaced with the correct one. Yes you need to change it to python3.
Inside a CMK 2.0 site only python3 is available.
For the “pip3 install …” @r.sander was completely right that the requests is already included. Only if you need modules that are not already existing, then you need to install it with “pip3 install …”.
If this is changed and you start the script directly inside your site, you should get the message Webhook URL not set.
new day, new try, new error (changed to python3, → replay notify via webgui → notifications)
> Traceback (most recent call last): -- File "/omd/sites/azure/local/share/check_mk/notifications/msteams", line 10, in <module> -- context = dict([ (var[7:], value.decode("utf-8")) -- File "/omd/sites/azure/local/share/check_mk/notifications/msteams", line 10, in <listcomp> -- context = dict([ (var[7:], value.decode("utf-8")) -- AttributeError: 'str' object has no attribute 'decode'
notify.log
46 2022-04-27 09:20:58,710 [20] [cmk.base.notify] ----------------------------------------------------------------------
47 2022-04-27 09:20:58,710 [20] [cmk.base.notify] Analysing notification (XXX-PKR) context with 36 variables
48 2022-04-27 09:20:58,711 [20] [cmk.base.notify] Global rule ''...
49 2022-04-27 09:20:58,711 [20] [cmk.base.notify] -> matches!
50 2022-04-27 09:20:58,711 [20] [cmk.base.notify] - adding notification of monitoring via msteams
51 2022-04-27 09:20:58,712 [15] [cmk.base.notify] Global rule 'Notify all contacts of a host/service via HTML email'...
52 2022-04-27 09:20:58,712 [15] [cmk.base.notify] -> does not match: The host's name 'XXX-PKR' is on the list of excluded hosts
53 2022-04-27 09:20:58,712 [15] [cmk.base.notify] Global rule 'Only one notify during a service problem'...
54 2022-04-27 09:20:58,712 [15] [cmk.base.notify] -> does not match: This rule requires membership in a service group, but this is a host notification
55 2022-04-27 09:20:58,713 [20] [cmk.base.notify] Executing 1 notifications:
56 2022-04-27 09:20:58,713 [20] [cmk.base.notify] * would notify monitoring via msteams, parameters: url_prefix, webhook, bulk: no
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.