Skip to content

Commit 1eca1a1

Browse files
authored
Merge pull request #7 from hugovalente-pm/readme-review
unified code snippets
2 parents 53af6ff + 3ba551c commit 1eca1a1

File tree

1 file changed

+69
-28
lines changed

1 file changed

+69
-28
lines changed

README.md

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ To start using the Netdata data source plugin on your Grafana environment, local
5757
#### Pre-buit script - setup-demo-environment
5858
We provide you a script `setup-demo-environment.sh` that will help you setting this up real fast.
5959
To start the container with the Netdata datasource plugin already installed you just need to:
60-
> `setup-demo-environment.sh run`
60+
```
61+
setup-demo-environment.sh run
62+
```
6163

6264
To remove container:
63-
> `setup-demo-environment.sh remove`
65+
```
66+
setup-demo-environment.sh remove
67+
```
6468

6569
This script will:
6670
1. Spin up a grafana container without starting grafana itself
@@ -72,99 +76,136 @@ This script will:
7276

7377
1. Setup your grafana docker container with the the permissions to load netdata plugin as unsinged
7478

75-
`docker run -d --env GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=netdata-datasource --name=grafana grafana/grafana`
79+
```
80+
docker run -d --env GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=netdata-datasource --name=grafana grafana/grafana
81+
```
7682

7783
2. Ensure you have the desired version of the plugin you want to install, get it from github releases
7884

79-
```curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \
85+
```
86+
curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \
8087
jq -r '.assets[] | select(.name|match("zip$")) | .browser_download_url'
8188
```
8289

8390
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
8491

85-
`docker exec -ti grafana bash`
86-
`mkdir /var/lib/grafana/plugins/netdata`
92+
```
93+
docker exec -ti grafana bash
94+
mkdir /var/lib/grafana/plugins/netdata
95+
```
8796

8897
4. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2
8998

90-
`unzip netdata-datasource-<version_number>.zip`
91-
`docker cp netdata-datasource grafana:/var/lib/grafana/plugins/netdata/`
99+
```
100+
unzip netdata-datasource-<version_number>.zip
101+
docker cp netdata-datasource grafana:/var/lib/grafana/plugins/netdata/
102+
```
92103

93104
### Linux (local)
94105

95106
1. Ensure you have the desired version of the plugin you want to install, get it from github releases
96107

97-
```curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \
108+
```
109+
curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \
98110
jq -r '.assets[] | select(.name|match("zip$")) | .browser_download_url'
99111
```
100112

101113
2. Grafana plugins, by default, should be under /var/lib/grafana/plugins. Create a folder for netdata
102114

103-
`mkdir /var/lib/grafana/plugins/netdata`
115+
```
116+
mkdir /var/lib/grafana/plugins/netdata
117+
```
104118

105119
3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2
106120

107-
`unzip netdata-datasource-<version_number>.zip`
108-
`cp -rf netdata-datasource/ /var/lib/grafana/plugins/netdata`
121+
```
122+
unzip netdata-datasource-<version_number>.zip
123+
cp -rf netdata-datasource/ /var/lib/grafana/plugins/netdata
124+
```
109125

110126
4. Ensure that Netdata plugin which currently isn’t signed can be registered
111127

112-
`vi /etc/grafana/grafana.ini`
128+
```
129+
vi /etc/grafana/grafana.ini
130+
```
113131

114132
On `allow_loading_unsigned_plugins` entry add **netdata-datasource**
115133

116-
`allow_loading_unsigned_plugins = netdata-datasource`
134+
```
135+
allow_loading_unsigned_plugins = netdata-datasource
136+
```
117137

118138
5. After adding the plugin a restart of grafana server is needed
119139

120140
For init.d based services you can use the command:
121-
`sudo service grafana-server restart`
141+
```
142+
sudo service grafana-server restart
143+
```
122144

123145
For systemd based services you can use the following:
124-
`systemctl restart grafana-server`
146+
```
147+
systemctl restart grafana-server
148+
```
125149

126150
### Windows (local)
127151

128152
1. Ensure you have the desired version of the plugin you want to install, get it from github releases
129153

130-
```curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \
154+
```
155+
curl -s https://api.github.com/repos/netdata/netdata-grafana-datasource-plugin/releases/latest \
131156
jq -r '.assets[] | select(.name|match("zip$")) | .browser_download_url'
132157
```
133158

134159
2. Grafana plugins, by default, should be under C:\Program Files\GrafanaLabs\grafana\data\plugins. Create a folder for netdata
135160

136-
`mkdir ‘C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata’`
161+
```
162+
mkdir ‘C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata’
163+
```
137164

138165
3. Copy the contents of the Netdata data source plugin to the new plugin folder created on step 2
139166

140-
`wzunzip -d netdata-datasource-<version_number>.zip`
167+
```
168+
wzunzip -d netdata-datasource-<version_number>.zip
169+
```
141170
or
142-
`gzip -d < netdata-datasource-<version_number>.zip `
143-
`cp .\netdata-datasource\* "C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata"`
171+
```
172+
gzip -d < netdata-datasource-<version_number>.zip
173+
cp .\netdata-datasource\* "C:\Program Files\GrafanaLabs\grafana\data\plugins\netdata"
174+
```
144175

145176
4. Ensure that Netdata plugin which currently isn’t signed can be registered
146177

147-
`notepad ‘C:\Program Files\GrafanaLabs\grafana\conf\default.ini’`
178+
```
179+
notepad ‘C:\Program Files\GrafanaLabs\grafana\conf\default.ini’
180+
```
148181
149182
On `allow_loading_unsigned_plugins` entry add **netdata-datasource**
150183
151-
`allow_loading_unsigned_plugins = netdata-datasource`
184+
```
185+
allow_loading_unsigned_plugins = netdata-datasource
186+
```
152187
153188
5. After adding the plugin a restart of grafana server is needed
154189
155-
`net stop Grafana`
156-
`net start Grafana`
190+
```
191+
net stop Grafana
192+
net start Grafana
193+
```
157194
158195
### Building the plugin locally
159196
160197
For any of the above steps if you prefer to build this plugin locally instead of retrieving it from from the releases you can:
161198
162199
1. Clone this repo
163-
`git clone https://github.com/netdata/netdata-grafana-datasource-plugin`
200+
```
201+
git clone https://github.com/netdata/netdata-grafana-datasource-plugin
202+
```
164203
165204
2. Build it locally
166-
`yarn`
167-
`yarn build`
205+
```
206+
yarn
207+
yarn build
208+
```
168209
169210
3. Place the contents of the `/dist` folder under the netdata folder in Grafana plugins directory.
170211

0 commit comments

Comments
 (0)