Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: dynamic module does not define init function (inituuid) #22

Open
Lotus907efi opened this issue May 30, 2018 · 1 comment
Open

Comments

@Lotus907efi
Copy link

Lotus907efi commented May 30, 2018

I copied the py files into the /usr/lib64/collectd/ directory (where the other collectd plugins are located) and then used the following conf file (just showing the keystone one):

LoadPlugin python

<Plugin "python">
ModulePath "/usr/lib64/collectd"

Import "keystone_plugin"

<Module "keystone_plugin">
    Username "admin"
    Password "Emnz"
    TenantName "admin"
    AuthURL "http://96.239.248.100:5000/v2.0"
    Verbose "False"
</Module>

When I then attempt to restart collectd I get an error and it will not actually start. So to isolate the error I ran the collectd module test using the following command:

/usr/sbin/collectd -T -C /etc/collectd.conf

When I do this the messages I get back are:

plugin_load: plugin "write_http" successfully loaded.
plugin_load: plugin "cpu" successfully loaded.
plugin_load: plugin "disk" successfully loaded.
plugin_load: plugin "memory" successfully loaded.
plugin_load: plugin "netlink" successfully loaded.
plugin_load: plugin "virt" successfully loaded.
plugin_load: plugin "ethstat" successfully loaded.
ethstat plugin: Registered interface eth0
plugin_load: plugin "load" successfully loaded.
plugin_load: plugin "swap" successfully loaded.
plugin_load: plugin "python" successfully loaded.
python plugin: Error importing module "keystone_plugin".
Unhandled python exception in importing module: ImportError: dynamic module does not define init function (inituuid)
python plugin: Found a configuration for the "keystone_plugin" plugin, but the plugin isn't loaded or didn't register a configuration callback.
Error: Reading the config file failed!
Read the logs for details.

All of my conf files are similar and if I attempt to use the other openstack modules for glance, cinder, nova or neutron, I get the same exact error for each one.

@Lotus907efi
Copy link
Author

OK, I have a solution for this issue. It seems that when the python interpreter in collectd sees an import statement in the code that it will try to load the needed python module based on the ModulePath given in the configuration. If I put the *.py files from this project in the standard plugin directory with the other collectd plugins, there is another collectd plugin called uuid.so and this is NOT a python library and if the python interpreter tries to load this file by mistake then there will indeed be no init function.

The solution to this issue is to put the *.py files from this project into a separate directory and restrict the ModulePath option to just that one directory that does not contain the uuid.so plugin file from collectd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant