# How do I add my python plugin?

**URL:** <https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554>\
**Category:** Help\
**Tags:** agent\
**Created:** [July 20, 2021, 10:54pm UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554 "2021-07-20T22:54:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![crafter2345](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/crafter2345/32/664_2.png) [@crafter2345](https://community.netdata.cloud/u/crafter2345)\
**Post date:** [July 20, 2021, 10:54pm UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/1 "2021-07-20T22:54:49Z")

</div>

## Problem/Question

I’ve a python script [# -\*- coding: utf-8 -\*-# Description: spigotmc netdata python.d module# Auth - Pastebin.com](https://pastebin.com/V7Y8NTa9) but i dont know how I can add it into netdata that it loads. I tried adding it into /etc/netdata/python.d.plugin and added into the python.d.conf mcserver: yes but the plugin doesnt load after restart. Did I put it into the correct location and enabled it correctly?  
And how can I disable for example the tc.helper?

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [July 21, 2021, 8:36am UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/2 "2021-07-21T08:36:09Z")

</div>

Hi, @crafter2345 👋

Do you mean python plugin or [python.d module](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin#pythondplugin)?

I guess it is python.d module. You need to put your script to the `python.d/` dir - `/usr/libexec/netdata/python.d/`. There you can find all other modules (i installed Netdata to the `/opt`, so my path is `/opt/netdata/usr/libexec/netdata/python.d/`):

```nohighlight
ilyam@pc ~]$ ls -l /opt/netdata/usr/libexec/netdata/python.d/ | grep chart.py
-rw-r--r-- 1 root root 6697 июл 21 10:47 adaptec_raid.chart.py
-rw-r--r-- 1 root root 3058 июл 21 10:47 alarms.chart.py
-rw-r--r-- 1 root root 1712 июл 21 10:47 am2320.chart.py
-rw-r--r-- 1 root root 21138 июл 21 10:47 anomalies.chart.py
-rw-r--r-- 1 root root 4398 июл 21 10:47 apache.chart.py
-rw-r--r-- 1 root root 8666 июл 21 10:47 beanstalk.chart.py
-rw-r--r-- 1 root root 7964 июл 21 10:47 bind_rndc.chart.py
-rw-r--r-- 1 root root 5438 июл 21 10:47 boinc.chart.py
-rw-r--r-- 1 root root 14837 июл 21 10:47 ceph.chart.py
-rw-r--r-- 1 root root 6636 июл 21 10:47 changefinder.chart.py
-rw-r--r-- 1 root root 3591 июл 21 10:47 chrony.chart.py
-rw-r--r-- 1 root root 15071 июл 21 10:47 couchdb.chart.py
-rw-r--r-- 1 root root 4662 июл 21 10:47 dnsdist.chart.py
...

```

---

<div class="post-metadata">

**Author:** ![crafter2345](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/crafter2345/32/664_2.png) [@crafter2345](https://community.netdata.cloud/u/crafter2345)\
**Post date:** [July 21, 2021, 10:57am UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/3 "2021-07-21T10:57:56Z")

</div>

Hi 👋  
I dropped my mcserver.chart.py in `/usr/libexec/netdata/python.d`.  
In my netdata conf I have  
[plugins]  
proc = yes  
python.d = yes  
And in my python.d.conf I have added to the bottom and restarted netdata. But my graph isnt showing up.  
mcserver: yes

And my second question was how to disable single modules like tc.helper

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [July 21, 2021, 11:16am UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/4 "2021-07-21T11:16:35Z")

</div>

> [@crafter2345](#):
>
> And in my python.d.conf I have added to the bottom and restarted netdata. But my graph isnt showing up.  
> mcserver: yes

Try the debug mode

```auto
# as netdata user
/usr/libexec/netdata/plugins.d/python.d.plugin debug 1 mcserver

```

* * *

> [@crafter2345](#):
>
> second

Disabling `tc` plugin in the `netdata.conf` should do

```auto
[plugins]
    tc = no

```

---

<div class="post-metadata">

**Author:** ![crafter2345](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/crafter2345/32/664_2.png) [@crafter2345](https://community.netdata.cloud/u/crafter2345)\
**Post date:** [July 21, 2021, 2:11pm UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/5 "2021-07-21T14:11:47Z")

</div>

/usr/libexec/netdata/plugins.d/python.d.plugin -ppython3 debug 1 mcserver says

> 2021-07-21 16:07:04: python.d INFO: plugin[main] : using python v3  
> 2021-07-21 16:07:04: python.d DEBUG: plugin[main] : looking for ‘/etc/netdata/python.d.conf’  
> 2021-07-21 16:07:04: python.d DEBUG: plugin[main] : ‘/etc/netdata/python.d.conf’ is loaded  
> 2021-07-21 16:07:04: python.d DEBUG: plugin[main] : looking for ‘/usr/lib/netdata/conf.d/python.d.conf’  
> 2021-07-21 16:07:04: python.d DEBUG: plugin[main] : ‘/usr/lib/netdata/conf.d/python.d.conf’ is loaded  
> 2021-07-21 16:07:04: python.d DEBUG: plugin[main] : looking for ‘pythond-jobs-statuses.json’ in /var/lib/netdata  
> 2021-07-21 16:07:04: python.d DEBUG: plugin[main] : loading ‘/var/lib/netdata/pythond-jobs-statuses.json’  
> 2021-07-21 16:07:04: python.d DEBUG: plugin[main] : ‘/var/lib/netdata/pythond-jobs-statuses.json’ is loaded  
> 2021-07-21 16:07:04: python.d WARNING: plugin[main] : [mcserver] has no callable Service object, skipping it  
> 2021-07-21 16:07:04: python.d INFO: plugin[main] : no jobs to run

But im logged in as root  
My mcserver.chart.py from `/usr/libexec/netdata/python.d` lookes like [# -\*- coding: utf-8 -\*-# Description: mc netdata python.d moduleimport jso - Pastebin.com](https://pastebin.com/zdaQr9uN)  
Dont know what I missed

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [July 21, 2021, 2:27pm UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/6 "2021-07-21T14:27:22Z")

</div>

> [@crafter2345](#):
>
> 2021-07-21 16:07:04: python.d WARNING: plugin[main] : [mcserver] has no callable Service object, skipping it

That is the problem. Here you go

```python
import json

from bases.FrameworkServices.UrlService import UrlService

update_every = 10

ORDER = [
    'players',
]

CHARTS = {
    'players': {
        'options': [None, 'Online Minecraft Players', 'players', 'players', 'mcserver.players', 'line'],
        'lines': [
            ['players', 'players', 'absolute', 1, 1]
        ]
    }
}

class Service(UrlService):
    def __init__ (self, configuration=None, name=None):
        UrlService. __init__ (self, configuration=configuration, name=name)
        self.order = ORDER
        self.definitions = CHARTS
        self.timeout = 5
        self.url = 'https://api.minetools.eu/ping/hypixel.net'

    def _get_data(self):
        raw_data = self._get_raw_data()
        if not raw_data:
            return None

        try:
            response = json.loads(raw_data)
        except ValueError as error:
            self.error('JSON decode error: {}'.format(error))
            return None

        try:
            return {'players': response['players']['online']}
        except KeyError as error:
            self.error('response has no {} key'.format(error))
            return None

```

---

<div class="post-metadata">

**Author:** ![andrewm4894](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/andrewm4894/32/125_2.png) [@andrewm4894](https://community.netdata.cloud/u/andrewm4894)\
**Post date:** [July 28, 2021, 7:56am UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/7 "2021-07-28T07:56:32Z")

</div>

@OdysLam this could be a cool community minecraft collector for the new community repos if @crafter2345 was happy to share it - looks like a nice example of fun/interesting stuff from the community.

---

<div class="post-metadata">

**Author:** ![OdysLam](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/odyslam/32/98_2.png) [@OdysLam](https://community.netdata.cloud/u/OdysLam)\
**Post date:** [July 28, 2021, 11:54am UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/8 "2021-07-28T11:54:58Z")

</div>

That’s a great idea!

I have outlined my thoughts on how to structure the repo in GitHub issues. I would love to hear some feedback.

> **[Issues · netdata/community](https://github.com/netdata/community/issues)**
>
> Netdata-powered applications and examples. For the community, by the community. - Issues · netdata/community

---

<div class="post-metadata">

**Author:** ![crafter2345](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/crafter2345/32/664_2.png) [@crafter2345](https://community.netdata.cloud/u/crafter2345)\
**Post date:** [July 28, 2021, 12:28pm UTC](https://community.netdata.cloud/t/how-do-i-add-my-python-plugin/1554/9 "2021-07-28T12:28:04Z")

</div>

For me it woudn’t be a problem. Feel free to use. But there is no config & direct fetch from the minecraft server, for me it is good like it is but probably for others.
