@@ -5,7 +5,8 @@ and dashboards in Grafana using data in Dataset. You may want to use this plugin
5
5
to allow you to visualize Dataset data next to other data sources, for instance
6
6
when you want to monitor many feeds on a single dashboard.
7
7
8
- ![ SystemDashboard] ( https://github.com/scalyr/scalyr-grafana-datasource-plugin/blob/go-rewrite-v2/src/img/SystemDashboard.png )
8
+ <!-- TODO When the go-rewrite-v2 branch gets merged into master, change these urls -->
9
+ ![ SystemDashboard] ( https://raw.githubusercontent.com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/SystemDashboard.png )
9
10
10
11
With the Dataset plugin, you will be able to create and visualize your log-based
11
12
metrics along side all of your other data sources. It's a great way to have a
@@ -27,7 +28,7 @@ can find documentation on API Keys [here](https://www.scalyr.com/help/api#scalyr
27
28
28
29
## Getting started
29
30
30
- ### Installing with grafana-cli
31
+ ### Installing the latest / stable version with grafana-cli
31
32
32
33
1 . To install the stable version of the plugin using grafana-cli, run the following command:
33
34
@@ -37,13 +38,9 @@ can find documentation on API Keys [here](https://www.scalyr.com/help/api#scalyr
37
38
plugins install sentinelone-dataset-datasource
38
39
```
39
40
40
- 2 . Update your Grafana configuration in the ` grafana.ini ` file to allow this plugin by adding the following line:
41
+ Older versions can be downloaded from [ github releases ] ( https://github.com/scalyr/scalyr-grafana-datasource-plugin/releases ) .
41
42
42
- ``` bash
43
- allow_loading_unsigned_plugins = sentinelone-dataset-datasource
44
- ```
45
-
46
- 3 . Adding plugins requires a restart of your grafana server.
43
+ 2 . Adding plugins requires a restart of your grafana server.
47
44
48
45
For init.d based services you can use the command:
49
46
@@ -57,41 +54,60 @@ can find documentation on API Keys [here](https://www.scalyr.com/help/api#scalyr
57
54
systemctl restart grafana-server
58
55
` ` `
59
56
60
- If you require the development version, use the manual installation instructions.
61
- # ## Installing manually
57
+ # ## Building a development version and installing manually
62
58
63
- 1. If you want a stable version of plugin, download the desired version from
64
- [github releases](https://github.com/scalyr/scalyr-grafana-datasource-plugin/releases).
65
- If you want the ` development` version of the plugin,
66
- clone the [plugin repository](https://github.com/scalyr/scalyr-grafana-datasource-plugin)
67
- from GitHub. Switch to branch ` go-rewrite-v2`
59
+ 1. To build and install the ` development` version of the plugin, clone the
60
+ [plugin repository](https://github.com/scalyr/scalyr-grafana-datasource-plugin) from GitHub.
68
61
69
62
` ` ` bash
70
63
git clone https://github.com/scalyr/scalyr-grafana-datasource-plugin.git
71
64
` ` `
72
65
73
- 2. Grafana plugins exist in the directory: ` /var/lib/grafana/plugins/ ` . Create a folder for the dataset plugin:
66
+ 2. Build the Golang backend (with the version defined in go.mod, currently 1.16) using Mage
74
67
75
68
` ` ` bash
76
- mkdir /var/lib/grafana/plugins/dataset
69
+ mage
70
+ ` ` `
71
+
72
+ This will build the executables in ` dist/`
73
+
74
+ To install Mage (Golang make-like build tool):
75
+
76
+ ` ` ` bash
77
+ git clone https://github.com/magefile/mage $GOPATH /src/github.com/magefile/mage
78
+ cd $GOPATH /src/github.com/magefile/mage
79
+ git checkout tags/v1.12.1 # Specified in go.mod
80
+ go run bootstrap.go
77
81
` ` `
78
82
79
- 3. Copy the contents of the Dataset plugin into grafana:
83
+ A ` mage ` executable should now be in ` $GOPATH /bin/ ` .
80
84
81
- Stable version:
85
+ 3. Build the Typescript frontend using LTS Node ( > = v14) and Yarn
82
86
83
87
` ` ` bash
84
- tar -xvf scalyr_grafana_plugin_51057f6.tar.gz
85
- cp -rf dist/ /var/lib/grafana/plugins/scalyr/
88
+ yarn install --pure-lockfile # Install dependencies into node_modules
89
+ yarn build
86
90
` ` `
87
91
88
- Development version:
92
+ This will build and the frontend files in ` dist/`
93
+
94
+ To install Yarn: ` npm install --global yarn`
95
+
96
+
97
+ 5. For development versions, simply copy the files to the Grafana server plugin directory
89
98
90
99
` ` ` bash
91
- cp -r scalyr-grafana-datasource/dist/ /var/lib/grafana/plugins/scalyr/
100
+ mkdir /var/lib/grafana/plugins/dataset
101
+ # copy files from dist/ into /var/lib/grafana/plugins/dataset
92
102
` ` `
93
103
94
- 4. Adding plugins requires a restart of your grafana server.
104
+ Note that this is an unsigned plugin, and you must update your ` grafana.ini` file to allow it adding the following line:
105
+
106
+ ` ` ` bash
107
+ allow_loading_unsigned_plugins = sentinelone-dataset-datasource
108
+ ` ` `
109
+
110
+ 6. Adding plugins requires a restart of your grafana server.
95
111
96
112
For init.d based services you can use the command:
97
113
@@ -104,26 +120,44 @@ from GitHub. Switch to branch `go-rewrite-v2`
104
120
` ` ` bash
105
121
systemctl restart grafana-server
106
122
` ` `
123
+
124
+ # ## Package and sign the plugin
125
+
126
+ To sign and package the plugin for distribution:
127
+
128
+ ` ` ` bash
129
+ export GRAFANA_API_KEY=< YOUR_API_KEY>
130
+ npx @grafana/toolkit plugin:sign # This creates dist/MANIFEST.txt
131
+
132
+ cp -r dist sentinelone-dataset-datasource
133
+ zip -r sentinelone-dataset-datasource-$(jq -r .info.version sentinelone-dataset-datasource/plugin.json).zip sentinelone-dataset-datasource
134
+ rm -rf sentinelone-dataset-datasource # Cleanup
135
+ ` ` `
136
+
137
+ References
138
+ - https://grafana.com/docs/grafana/latest/developers/plugins/package-a-plugin/
139
+ - https://grafana.com/docs/grafana/latest/developers/plugins/sign-a-plugin/
140
+
107
141
# ## Verify the Plugin was Installed
108
142
109
143
1. In order to verify proper installation you must log in to your grafana instance
110
144
and navigate to ** Configuration Settings -> Data Sources** .
111
145
112
- ! [ConfigDataSource](https://github. com/scalyr/scalyr-grafana-datasource-plugin/blob /go-rewrite-v2/src/img/ConfigDataSource.png)
146
+ ! [ConfigDataSource](https://raw.githubusercontent. com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/ConfigDataSource.png)
113
147
114
148
2. This will take you into the configuration page. If you already have other data
115
149
sources installed, you will see them show up here. Click on the ** Add data source** button:
116
150
117
- ! [DatasetConfig](https://github. com/scalyr/scalyr-grafana-datasource-plugin/blob /go-rewrite-v2/src/img/DatasetConfig.png)
151
+ ! [DatasetConfig](https://raw.githubusercontent. com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/DatasetConfig.png)
118
152
119
153
3. If you enter " Dataset" in the search bar on the resulting page you should see " Dataset" grafana plugin show up as an option.
120
154
121
- ! [SearchForPlugin](https://github. com/scalyr/scalyr-grafana-datasource-plugin/blob /go-rewrite-v2/src/img/SearchForPlugin.png)
155
+ ! [SearchForPlugin](https://raw.githubusercontent. com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/SearchForPlugin.png)
122
156
123
157
4. Click on *** “Select”*** . This will take you to a configuration page where you
124
158
insert your API key mentioned in the prerequisite section.
125
159
126
- ! [PluginConfig](https://github. com/scalyr/scalyr-grafana-datasource-plugin/blob /go-rewrite-v2/src/img/PluginConfig.png)
160
+ ! [PluginConfig](https://raw.githubusercontent. com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/PluginConfig.png)
127
161
128
162
5. Enter these settings:
129
163
@@ -141,17 +175,17 @@ using Scalyr data.
141
175
142
176
1. Create a new dashboard by click Create > dashboard
143
177
144
- ! [CreateDashboard](https://github. com/scalyr/scalyr-grafana-datasource-plugin/blob /go-rewrite-v2/src/img/CreateDashboard.png)
178
+ ! [CreateDashboard](https://raw.githubusercontent. com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/CreateDashboard.png)
145
179
146
180
2. In the ** “New dashboard”** box, select the ** “Add a new panel** icon
147
181
148
182
3. From the Data source dropdown, select **"Dataset"**.
149
183
150
- ! [DataSetPlugin](https://github. com/scalyr/scalyr-grafana-datasource-plugin/blob /go-rewrite-v2/src/img/DatasetPlugin.png)
184
+ ! [DataSetPlugin](https://raw.githubusercontent. com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/DatasetPlugin.png)
151
185
152
186
4. A ' Query Type' field allows to choose the type of query you wanted to search for
153
187
154
- ! [QueryType](https://github. com/scalyr/scalyr-grafana-datasource-plugin/blob /go-rewrite-v2/src/img/QueryType.png)
188
+ ! [QueryType](https://raw.githubusercontent. com/scalyr/scalyr-grafana-datasource-plugin/go-rewrite-v2/src/img/QueryType.png)
155
189
156
190
5. ' Standard Query' - A standard query allows to search on Graph view,
157
191
You can enter Graph Functions into the expression box and visualize the results. You can even enter and visualize Complex Expressions
@@ -160,13 +194,13 @@ using Scalyr data.
160
194
Enter expression and click the save button. In the image below, we' ve added a query to graph visualized the
161
195
number of log messages that contain the word "error"
162
196
163
- 
197
+ 
164
198
165
199
6. ' Power Query' - Works similar to PQ search in Dataset app. You can enter rich set of commands for transforming
166
200
and manipulating data. Data can be viewed in Table format
167
201
Visit [this documentation](https://app.scalyr.com/help/power-queries) for more information on building Power Queries
168
202
169
- 
203
+ 
170
204
171
205
You’ve successfully installed, configured and created a graph in Grafana using Dataset data!
172
206
0 commit comments