Skip to content

Commit 219e42c

Browse files
authored
updates README after sever mode addition (#22)
1 parent 4ece822 commit 219e42c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,23 @@ The reason behind admin rights is that the plugins endpoint returns all plugins
3131
Then, create a service account token for the newly created service account and set it to the `GRAFANA_TOKEN` env var.
3232

3333
## Usage
34+
The detect-angular-dashboards binary supports two modes of operation. A CLI mode which can be used on demand, as well as a server mode which periodically quries Grafana for the current set of dashboards and generates a JSON response on the `/detections` endpoint with a list of dashboards that were detected to be using Angular. This endpoint can be linked directly with Grafana by leveraging the [Infinity Datasource](https://grafana.com/grafana/plugins/yesoreyeram-infinity-datasource/).
3435

35-
### Readable output
36+
### Server Mode
37+
> Pass flag `-server` to run the program in server mode. Value must be a valid listen address ex. "0.0.0.0:8080".
38+
> Pass optional flag `-max-concurrency` to the program to limit the max concurrency when downloading dashboards from Grafana, otherwise default value is used.
39+
> Pass optional flag `-interval` to the program to set the detection refresh interval when running in server mode, otherwise default value is used.
40+
41+
```bash
42+
GRAFANA_TOKEN=glsa_aaaaaaaaaaa ./detect-angular-dashboards -server "0.0.0.0:8080" -max-concurrency=10 http://my-grafana.example.com/api
43+
INFO: 2024/09/11 16:59:04 Running detection every 5m0s
44+
INFO: 2024/09/11 16:59:04 Detecting Angular dashboards
45+
INFO: 2024/09/11 16:59:04 Listening on 0.0.0.0:8080
46+
INFO: 2024/09/11 16:59:34 Updating Output Data
47+
INFO: 2024/09/11 16:59:34 Updating readiness probe to ready
48+
```
49+
50+
### CLI Mode - Readable output
3651

3752
```bash
3853
GRAFANA_TOKEN=glsa_aaaaaaaaaaa ./detect-angular-dashboards http://my-grafana.example.com/api
@@ -46,7 +61,7 @@ GRAFANA_TOKEN=glsa_aaaaaaaaaaa ./detect-angular-dashboards http://my-grafana.exa
4661
2023/08/17 11:17:14 Found angular panel "My panel" ("akumuli-datasource")
4762
```
4863

49-
### JSON output
64+
### CLI Mode - JSON output
5065

5166
> Pass flag -j to the program to output in JSON format to stdout. All other messages will be sent to stderr.
5267
> The example below will produce a valid "output.json" file that can be used with other tools.

0 commit comments

Comments
 (0)