Skip to content

Commit

Permalink
doc: explain bin/grafana import --labels (#2032)
Browse files Browse the repository at this point in the history
* doc: explain bin/grafana import --labels

Fixes: #1991
  • Loading branch information
cgrinds authored May 2, 2023
1 parent 6862979 commit b0f9af3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Binary file added docs/assets/grafana/importLabels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions docs/dashboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,38 @@ $ bin/harvest grafana export --addr my.grafana.server:3000 --directory /path/to/

By default, the dashboards are connected to the `Prometheus` datasource defined in Grafana. If your datasource has a
different name, use the `--datasource` flag during import/export.

### CLI

The `bin/harvest grafana` tool includes CLI help when passing the `--help` command line argument flag like so:

```bash
bin/harvest grafana import --help
```

The `labels` argument requires more explanation.

#### Labels

The grafana import `--labels` argument goes hand-in-hand with a poller's `Labels` section described [here](https://netapp.github.io/harvest/latest/configure-harvest-basic/#labels).
`Labels` are used to add additional key-value pairs to a poller's metrics.

When you run `bin/harvest grafana import`, you may optionally pass a set of labels like so:

`bin/harvest grafana import --labels org --labels dept`

This will cause Harvest to do the following for each dashboard:
1. Parse each dashboard and add a new variable for each label passed on the command line
2. Modify each dashboard variable to use the new label variable(s) in a chained query.

Here's an example:

```
bin/harvest grafana import --labels "org,dept"
```

This will add the `Org` and `Dept` variables, as shown below, and modify the existing variables as shown.

Results in

![Import Labels](assets/grafana/importLabels.png)

0 comments on commit b0f9af3

Please sign in to comment.