Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 127 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand All @@ -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.
Expand All @@ -44,6 +44,130 @@ 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. Spin up a grafana container without starting grafana itself
1. Retrieve the latest available release of the Netdata datasource plugin
1. Install the Netdata datasource plugin in /var/lib/grafana/plugins
1. Start grafana

#### 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

```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

`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

`unzip netdata-datasource-<version_number>.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

```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

`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

`unzip netdata-datasource-<version_number>.zip`
`cp -rf netdata-datasource/ /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

```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

`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 netdata-datasource-<version_number>.zip`
or
`gzip -d < netdata-datasource-<version_number>.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

`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
Expand Down