@@ -5,7 +5,8 @@ and dashboards in Grafana using data in Dataset. You may want to use this plugin
55to allow you to visualize Dataset data next to other data sources, for instance
66when you want to monitor many feeds on a single dashboard.
77
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 )
910
1011With the Dataset plugin, you will be able to create and visualize your log-based
1112metrics 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
2728
2829## Getting started
2930
30- ### Installing with grafana-cli
31+ ### Installing the latest / stable version with grafana-cli
3132
32331 . To install the stable version of the plugin using grafana-cli, run the following command:
3334
@@ -37,13 +38,9 @@ can find documentation on API Keys [here](https://www.scalyr.com/help/api#scalyr
3738 plugins install sentinelone-dataset-datasource
3839 ```
3940
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 ) .
4142
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.
4744
4845 For init.d based services you can use the command:
4946
@@ -57,41 +54,60 @@ can find documentation on API Keys [here](https://www.scalyr.com/help/api#scalyr
5754 systemctl restart grafana-server
5855 ` ` `
5956
60- If you require the development version, use the manual installation instructions.
61- # ## Installing manually
57+ # ## Building a development version and installing manually
6258
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.
6861
6962 ` ` ` bash
7063 git clone https://github.com/scalyr/scalyr-grafana-datasource-plugin.git
7164 ` ` `
7265
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
7467
7568 ` ` ` 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
7781 ` ` `
7882
79- 3. Copy the contents of the Dataset plugin into grafana:
83+ A ` mage ` executable should now be in ` $GOPATH /bin/ ` .
8084
81- Stable version:
85+ 3. Build the Typescript frontend using LTS Node ( > = v14) and Yarn
8286
8387 ` ` ` 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
8690 ` ` `
8791
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
8998
9099 ` ` ` 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
92102 ` ` `
93103
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.
95111
96112 For init.d based services you can use the command:
97113
@@ -104,26 +120,44 @@ from GitHub. Switch to branch `go-rewrite-v2`
104120 ` ` ` bash
105121 systemctl restart grafana-server
106122 ` ` `
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+
107141# ## Verify the Plugin was Installed
108142
1091431. In order to verify proper installation you must log in to your grafana instance
110144 and navigate to ** Configuration Settings -> Data Sources** .
111145
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)
113147
1141482. This will take you into the configuration page. If you already have other data
115149 sources installed, you will see them show up here. Click on the ** Add data source** button:
116150
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)
118152
1191533. If you enter " Dataset" in the search bar on the resulting page you should see " Dataset" grafana plugin show up as an option.
120154
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)
122156
1231574. Click on *** “Select”*** . This will take you to a configuration page where you
124158 insert your API key mentioned in the prerequisite section.
125159
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)
127161
1281625. Enter these settings:
129163
@@ -141,17 +175,17 @@ using Scalyr data.
141175
1421761. Create a new dashboard by click Create > dashboard
143177
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)
145179
1461802. In the ** “New dashboard”** box, select the ** “Add a new panel** icon
147181
1481823. From the Data source dropdown, select **"Dataset"**.
149183
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)
151185
1521864. A ' Query Type' field allows to choose the type of query you wanted to search for
153187
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)
155189
1561905. ' Standard Query' - A standard query allows to search on Graph view,
157191 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.
160194 Enter expression and click the save button. In the image below, we' ve added a query to graph visualized the
161195 number of log messages that contain the word "error"
162196
163- 
197+ 
164198
1651996. ' Power Query' - Works similar to PQ search in Dataset app. You can enter rich set of commands for transforming
166200 and manipulating data. Data can be viewed in Table format
167201 Visit [this documentation](https://app.scalyr.com/help/power-queries) for more information on building Power Queries
168202
169- 
203+ 
170204
171205You’ve successfully installed, configured and created a graph in Grafana using Dataset data!
172206
0 commit comments