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

How do I debug a python plugin that is not a "Service"? #3522

Closed
7hacker opened this issue Mar 8, 2018 · 2 comments
Closed

How do I debug a python plugin that is not a "Service"? #3522

7hacker opened this issue Mar 8, 2018 · 2 comments
Labels

Comments

@7hacker
Copy link

7hacker commented Mar 8, 2018

Hi

I have a custom plugin written in Python that is not using any of the Framework Services classes such as URLService, LogService etc. In fact I merely adopted this script and turned it to generate and spit out data that was relevant for my use case: See script in this issue #206 by user: ktsaou

It runs great and I can see the charts in netdata but I really like the ability to debug a Service based script. When I try to debug this script I hit an exception:

'module' object has no attribute 'Service'

I already understand what is going on, i think : the python plugin daemon probably runs all charts that are based on the Service architecture, which leads me to the questions:

  1. How do I debug a plugin that is a simply Python script and doesn't use the Service classes
  2. What runs these scripts, if its not the python plugin daemon?
  3. Maybe I should simply implement a custom class that inherits the base Service class to get around this? Is there any advantage to this?
  4. Is there a way I can see the loading, output of netdata's internal and external plugins on the command line? This is useful for me in scenarios where I don't want to load up a browser in a remote machine via an SSH tunnel.

Thanks!

@ilyam8
Copy link
Member

ilyam8 commented Mar 9, 2018

Well, the easiest way is to create a Service class which inherits from SimpleService (SimpleService inherits from Thread, Logging).

In general python.d.plugin initialize all the Service classes. And start() them.

How do I debug a plugin that is a simply Python script and doesn't use the Service classes

you have to implement it yourself 😄

@7hacker
Copy link
Author

7hacker commented Mar 9, 2018

Gotcha, thanks!

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

No branches or pull requests

3 participants