I have installed ganglia 3.1.1 in a 'non-standard' location (changed prefix, libdir, etc) and I'm getting this error when starting gmond 3.1.1:
[PYTHON] Can't import the metric module [multidisk]
ImportError: No module named multidisk
despite being able to import the modules using the location listed for the params variable in modpython.conf without issue. After looking at gmond/modules/python/modpython.c, seeing that we're using PYTHONPATH to influence the include path, and reading http://mail.python.org/pipermail/python-list/2008-September/506206.html I added:
PyObject *sys_path = PySys_GetObject("path");
PyObject *addpath = PyString_FromString(path); // from python_module.module_params;
just after Py_Initialize() and now the python modules load from the location specified in modpython.conf. The one thing I can't reconcile is that in a separate installation, using the normal install paths, I am able to move the python_modules directory around the filesystem and modpython still finds them (when updating params) - any ideas?. Is there any advantage to using something like this sys.path.append equivalent over setting PYTHONPATH?