summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Maguire <andrewm4894@gmail.com>2020-10-14 22:57:04 +0100
committerGitHub <noreply@github.com>2020-10-14 22:57:04 +0100
commita0900ae81151211322160043d564141f8f9584fe (patch)
treeac2411bc09df1e31974cee3c9f0ee418a512b5da
parentd568a47c6bb7c2096d4dc534cd7775923bd5adfa (diff)
Update README.md (#10067)
Adding a paragraph about how to develop a collector 'locally' and then run it in debug mode against an already running Netdata without having to re-install Netdata each time you want to test a change. This could be useful to people looking to develop a collector the first time and was not clear to me until @ilyam8 pointed it out. So might save some others a bit of time and frustration and lower barriers to building a Python collector for newbies like myself :)
-rw-r--r--collectors/python.d.plugin/README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/collectors/python.d.plugin/README.md b/collectors/python.d.plugin/README.md
index c97fe80400..476f5858d9 100644
--- a/collectors/python.d.plugin/README.md
+++ b/collectors/python.d.plugin/README.md
@@ -84,6 +84,25 @@ If you plan to submit the module in a PR, make sure and go through the [PR check
For a quick start, you can look at the [example
plugin](https://raw.githubusercontent.com/netdata/netdata/master/collectors/python.d.plugin/example/example.chart.py).
+**Note**: If you are working 'locally' on a new collector and would like to run it in an already installed and running Netdata (as opposed to having to install Netdata from source again with your new changes) to can copy over the relevant file to where Netdata expects it and then either `sudo service netdata restart` to have it be picked up and used by Netdata or you can just run the updated collector in debug mode by following a process like below (this assumes you have [installed Netdata from a GitHub fork](https://learn.netdata.cloud/docs/agent/packaging/installer/methods/manual) you have made to do your development on).
+
+```bash
+# clone your fork (done once at the start but shown here for clarity)
+#git clone --branch my-example-collector https://github.com/mygithubusername/netdata.git --depth=100
+# go into your netdata source folder
+cd netdata
+# git pull your latest changes (assuming you built from a fork you are using to develop on)
+git pull
+# instead of running the installer we can just copy over the updated collector files
+#sudo ./netdata-installer.sh --dont-wait
+# copy over the file you have updated locally (pretending we are working on the 'example' collector)
+sudo cp collectors/python.d.plugin/example/example.chart.py /usr/libexec/netdata/python.d/
+# become user netdata
+sudo su -s /bin/bash netdata
+# run your updated collector in debug mode to see if it works without having to reinstall netdata
+/usr/libexec/netdata/plugins.d/python.d.plugin example debug trace nolock
+```
+
### Global variables `ORDER` and `CHART`
`ORDER` list should contain the order of chart ids. Example: