Mail notifications throw python error

Hi, we are experimenting with a fresh 1.5.0p22 install on rhel 7.5 and getting a standard python error during mail notification

  • notifying contact1 via mail, parameters: (no parameters), bulk: no
    executing /omd/sites/test/local/share/check_mk/notifications/mail
    Output: Could not find platform independent libraries
    Output: Could not find platform dependent libraries <exec_prefix>
    Output: Consider setting $PYTHONHOME to [:<exec_prefix>]
    Output: ImportError: No module named site
    Plugin exited with code 1

I can import the site module from both the system python and the check_mk python so I am not sure whats going on. Our other test box that is on centos7 does not have the issue

If the script is processed by site user you may have the problem with two python installation and probably with two different versions. you should set the two variables PYTHONHOME and PYTHONPATH before calling the scrip to explicit tell the script which libs and bins should be used to process your script.

CMK is coming along with a own python which is currently in version 2.7.

Hi Garth,

Are you running Check_MK on VM or lxd container or docker container ?
I’m getting the same error but just on lxd containers (centos 7) the instances that are running on virtual machines (centos 7) are ok.
I’ll debug this today and provide more info

Launched 2 containers and install latest 1.5 and 1.6 .
For some reason with python versions being equal it works on 1.5 and not on 1.6. I’m using a python script to send notifications to telegram.

@tosch I dont know how I would do that, its check_mk calling that script?

@tavanez its on a VM, no containers used

The problem is just on the 1.6, somehow it doesn’t know where python is even though you export vars/specify full path and copy notifications. I’ll try to debug it furthermore today by night !

Also in 1.5 the python versions can be different and the user who owns the file also don’t seem to affect which python version is used.

Changing the shebang in the plugin to #!/usr/bin/env python seems to have fixed the issue

I had tried that on my script and still outputs the same error strange.

Sorry applied on wrong method -.- it is working like that