Giter Club home page Giter Club logo

Comments (4)

asaf400 avatar asaf400 commented on August 22, 2024

@kaitcoa Yeah, I'm the one who Added 'ServerError' import for aerospike,
at the time (a month ago), the latest aerospike client had this module, now it doesn't:

ModuleNotFoundError: No module named 'aerospike.exception'; 'aerospike' is not a package

I have found the issue, and have opened a PR: #19
however I still see that python3 is used in master, but collectd module doesn't support it:

File "/usr/local/lib/python3.7/site-packages/collectd.py", line 8, in
from Queue import Queue, Empty
ModuleNotFoundError: No module named 'Queue'

appliedsec/collectd#7

Edit: Formatting

from aerospike-collectd.

asaf400 avatar asaf400 commented on August 22, 2024

I updated the PR to use the python3 support feature branch in requirements.txt,
if you try to run the .py file as is, it will fail with:

Traceback (most recent call last):

File "/opt/collectd-plugins/aerospike_plugin.py", line 960, in
collectd.register_init(plugin.init)
AttributeError: 'module' object has no attribute 'register_init'

however, running under collectd as a plugin works fine, and metrics are emitted
Edit: so the "#!/bin/env python3" header doesn't affect the code, since it still runs under collectd as a python plugin

from aerospike-collectd.

kaitcoa avatar kaitcoa commented on August 22, 2024

@asaf400 Thanks!

from aerospike-collectd.

asaf400 avatar asaf400 commented on August 22, 2024

Jumping in here from the future,
although we didn't get this repo to work with changes in Aerospike 5.7.0.9* and the latest python aerospike module,
Me and my coworkers managed to get collectd to run python3 explicitly,
so for anyone who'll find this useful, here's how to do it:

First clone the collectd repo: https://github.com/collectd/collectd
Then make sure you install some of the pre-requisites for compiling C \ CPP, which mainly include:
autoconf, pkg-config, bison and:

  • yum groupinstall "Development tools" for RHEL\Fedora based
  • apt-get install build-essential for Debian based

After that make sure to install: python3-devel (RHEL) or python3-dev (Deb)
and then cd into the collectd repo root, and just run autoconf
you'll see that the ./configure script has been created\updated (timestamp), you can now run it with --enable-python flag, so:
./configure --enable-python
then you may inspect the Makefile, and make sure python3 libs are loaded (look for python \ python3 references in the Makefile)
After that run make install or make install all and now, collectd should load python3 when using the python module

can be verified with the following snippet, simply placed somewhere.. ( start of aerospike_plugin.py for example )

import sys
collectd.info("Python version: %s" % sys.version)

What happened?
Running autoconf after python3-dev(el) is installed, allows autoconf & confiure.ac scripts to detect python installation based on version priority, as I guess is written here, if python3-config binary exists (installed by dev package), it would use that, else it would fallback to the older versions..

  • Last known version to work for me is aerospike 5.2,
    I don't know at which point this repo became incompatible.

from aerospike-collectd.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.