From 64939975dc62d35ce4a24a83f05907e74f0e3cb3 Mon Sep 17 00:00:00 2001 From: hugovalente-pm Date: Tue, 4 Oct 2022 16:37:09 +0100 Subject: [PATCH 1/4] review screenshots and add installation instructions --- README.md | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 700643c..f131388 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ _Enhanced high-fidelity troubleshooting data source for the Open Source community!_ -![chrome_czu5FR4B9k](https://user-images.githubusercontent.com/82235632/189611641-c1f9e4a9-0a86-41e2-b96e-9944d6b29339.png) +![Image](https://user-images.githubusercontent.com/82235632/193311991-a6d167ab-b845-49b7-817c-976b780e427e.png) ## What is Netdata data source plugin for Grafana? @@ -23,9 +23,9 @@ With this data source plugin we expose the troubleshooting capabilities of Netda Netdata’s data source plugin connects directly to our Netdata Cloud API’s, meaning that you’ll need to have your nodes (hosts) connected to [Netdata Cloud](https://app.netdata.cloud/?utm_source=grafana&utm_content=data_source_plugin) in order to be able to have them exposed on our plugin. For security purposes you will also need an API token for authentication (which you can get from within your Netdata profile). -Note: If you don't have an account [sign-up](https://app.netdata.cloud/?utm_source=grafana&utm_content=data_source_plugin) for free to get one! +Note: If you don't have an account [sign-up](https://app.netdata.cloud/?utm_source=grafana&utm_content=data_source_plugin) for free to get one! -> Netdata Agent will need to be installed and running on your server, VM and/or cluster, so that it can start collecting all the relevant metrics you have from the server +> Netdata Agent will need to be installed and running on your server, VM and/or cluster, so that it can start collecting all the relevant metrics you have from the server and applications running on it. More info at https://learn.netdata.cloud/docs/get-started. ### 2. Ensure you have an API Token for authentication purposes. @@ -44,6 +44,124 @@ Once you have added your API token to Netdata data source plugin you’re ready ![image](https://user-images.githubusercontent.com/82235632/189398814-1efbf1c7-1a62-4d5f-abe8-6a9297a3f008.png) +## How to install the plugin? + +To start using the Netdata data source plugin on your Grafana environment, local or Cloud, you need to install the plugin manually - it currently isn't signed. Here are some tips to get through this depending on your setup: +* Docker +* Linux (local) +* Windows (local) +* Building the plugin locally + +### Docker + +#### Pre-buit script - setup-demo-environment +We provide you a script `setup-demo-environment.sh` that will help you setting this up real fast. +To start the container with the Netdata datasource plugin already installed you just need to: +> `setup-demo-environment.sh run` + +To remove container: +> `setup-demo-environment.sh remove` + +This script will: +1. Retrieve the latest available release of the Netdata datasource plugin +2. Spin up a grafana container running on port `3000` that will allow installing this unsigned plugin +3. Install the Netdata datasource plugin in `/var/lib/grafana/plugins` +4. Start the container again + +#### Manual step-by-step + +1. Setup your grafana docker container with the the permissions to load netdata plugin as unsinged + + `docker run -d --env GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=netdata-datasource --name=grafana grafana/grafana` + +2. Ensure you have the desired version of the plugin you want to install, get it from github releases + + `git clone https://github.com/netdata/netdata-grafana-datasource-plugin` + +3. Grafana plugins, by default, should be under /var/lib/grafana/plugins. Create a folder for netdata inside the container. Enter in an interactive session + + `docker exec -ti grafana bash` + `mkdir /var/lib/grafana/plugins/netdata` + +4. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 + + `tar -xvf netdata…..tar.gz` + `docker cp dist grafana:/var/lib/grafana/plugins/` + +### Linux (local) + +1. Ensure you have the desired version of the plugin you want to install, get it from github releases + + `git clone https://github.com/netdata/netdata-grafana-datasource-plugin` + +2. Grafana plugins, by default, should be under /var/lib/grafana/plugins. Create a folder for netdata + + `mkdir /var/lib/grafana/plugins/netdata` + +3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 + + `tar -xvf netdata…..tar.gz` + `cp -rf dist/* /var/lib/grafana/plugins/netdata/` + +4. Ensure that Netdata plugin which currently isn’t signed can be registered + + `vi /etc/grafana/grafana.ini` + + On `allow_loading_unsigned_plugins` entry add **netdata-datasource** + + `allow_loading_unsigned_plugins = netdata-datasource` + +5. After adding the plugin a restart of grafana server is needed + + For init.d based services you can use the command: + `sudo service grafana-server restart` + + For systemd based services you can use the following: + `systemctl restart grafana-server` + +### Windows (local) + +1. Ensure you have the desired version of the plugin you want to install, get it from github releases + + `git clone https://github.com/netdata/netdata-grafana-datasource-plugin` + +2. Grafana plugins, by default, should be under C:\Program Files\GrafanaLabs\grafana\data\plugins. Create a folder for netdata + + `mkdir ‘C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata’` + +3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 + + `wzunzip -d file.gz` + or + `gzip -d < file.tar.gz | tar xvf -` + `cp .\dist\* "C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata"` + +4. Ensure that Netdata plugin which currently isn’t signed can be registered + + `notepad ‘C:\Program Files\GrafanaLabs\grafana\conf\default.ini’` + + On `allow_loading_unsigned_plugins` entry add **netdata-datasource** + + `allow_loading_unsigned_plugins = netdata-datasource` + +5. After adding the plugin a restart of grafana server is needed + + `net stop Grafana` + `net start Grafana` + +### Building the plugin locally + +For any of the above steps if you prefer to build this plugin locally instead of retrieving it from from the releases you can: + +1. Clone this repo + `git clone https://github.com/netdata/netdata-grafana-datasource-plugin` + +2. Build it locally + `yarn` + `yarn build` + +3. Place the contents of the `/dist` folder under the netdata folder in Grafana plugins directory. + ## Learn more - What is Netdata? - https://learn.netdata.cloud/docs/overview/what-is-netdata From 7552c46e7e76a1a82e43f65b65a9ec4dfc85c844 Mon Sep 17 00:00:00 2001 From: hugovalente-pm Date: Thu, 6 Oct 2022 11:23:34 +0100 Subject: [PATCH 2/4] reviewed after releases were completed --- README.md | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f131388..bf12473 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,10 @@ To remove container: > `setup-demo-environment.sh remove` This script will: +1. Spin up a grafana container without starting grafana itself 1. Retrieve the latest available release of the Netdata datasource plugin -2. Spin up a grafana container running on port `3000` that will allow installing this unsigned plugin -3. Install the Netdata datasource plugin in `/var/lib/grafana/plugins` -4. Start the container again +1. Install the Netdata datasource plugin in /var/lib/grafana/plugins +1. Start grafana #### Manual step-by-step @@ -76,7 +76,9 @@ This script will: 2. Ensure you have the desired version of the plugin you want to install, get it from github releases - `git clone https://github.com/netdata/netdata-grafana-datasource-plugin` + ```curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \ + jq -r '.assets[] | select(.name|match("zip$")) | .browser_download_url' + ``` 3. Grafana plugins, by default, should be under /var/lib/grafana/plugins. Create a folder for netdata inside the container. Enter in an interactive session @@ -85,14 +87,16 @@ This script will: 4. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 - `tar -xvf netdata…..tar.gz` - `docker cp dist grafana:/var/lib/grafana/plugins/` + `unzip netdata-datasource-.zip` + `docker cp netdata-datasource grafana:/var/lib/grafana/plugins/netdata/` ### Linux (local) 1. Ensure you have the desired version of the plugin you want to install, get it from github releases - `git clone https://github.com/netdata/netdata-grafana-datasource-plugin` + ```curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \ + jq -r '.assets[] | select(.name|match("zip$")) | .browser_download_url' + ``` 2. Grafana plugins, by default, should be under /var/lib/grafana/plugins. Create a folder for netdata @@ -100,8 +104,8 @@ This script will: 3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 - `tar -xvf netdata…..tar.gz` - `cp -rf dist/* /var/lib/grafana/plugins/netdata/` + `unzip netdata-datasource-.zip` + `cp -rf ./netdata-datasource * /var/lib/grafana/plugins/netdata/` 4. Ensure that Netdata plugin which currently isn’t signed can be registered @@ -123,7 +127,9 @@ This script will: 1. Ensure you have the desired version of the plugin you want to install, get it from github releases - `git clone https://github.com/netdata/netdata-grafana-datasource-plugin` + ```curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \ + jq -r '.assets[] | select(.name|match("zip$")) | .browser_download_url' + ``` 2. Grafana plugins, by default, should be under C:\Program Files\GrafanaLabs\grafana\data\plugins. Create a folder for netdata @@ -131,10 +137,10 @@ This script will: 3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 - `wzunzip -d file.gz` + `wzunzip -d netdata-datasource-.zip` or - `gzip -d < file.tar.gz | tar xvf -` - `cp .\dist\* "C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata"` + `gzip -d < netdata-datasource-.zip ` + `cp .\netdata-datasource\* "C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata"` 4. Ensure that Netdata plugin which currently isn’t signed can be registered From 50c908b0efc3568fead3b61837295241dc938ab4 Mon Sep 17 00:00:00 2001 From: hugovalente-pm Date: Thu, 6 Oct 2022 11:33:11 +0100 Subject: [PATCH 3/4] review after typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf12473..4fef3f6 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ This script will: 3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 `unzip netdata-datasource-.zip` - `cp -rf ./netdata-datasource * /var/lib/grafana/plugins/netdata/` + `cp -rf netdata-datasource/ /var/lib/grafana/plugins/netdata/` 4. Ensure that Netdata plugin which currently isn’t signed can be registered From 43c2341d0f2bf4eb2d0945d78c8788268e873c64 Mon Sep 17 00:00:00 2001 From: hugovalente-pm Date: Thu, 6 Oct 2022 11:33:36 +0100 Subject: [PATCH 4/4] review after typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fef3f6..badf5f4 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ This script will: 3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2 `unzip netdata-datasource-.zip` - `cp -rf netdata-datasource/ /var/lib/grafana/plugins/netdata/` + `cp -rf netdata-datasource/ /var/lib/grafana/plugins/netdata` 4. Ensure that Netdata plugin which currently isn’t signed can be registered