Skip to content

Commit

Permalink
Updated README for using templates in check annoations
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Campbell <todd@sensu.io>
  • Loading branch information
Todd Campbell committed Dec 15, 2020
1 parent 88e12e7 commit 2d21c81
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed
- Updated README for specifying templates in check annotations

## 2.1.0 - 2020-10-29

### Changed
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,27 @@ All arguments for this handler are tunable on a per entity or check basis based
on annotations. The annotations keyspace for this handler is
`sensu.io/plugins/sensu-pagerduty-handler/config`.

**NOTE**: Due to [check token substituion][10], supplying a template value such
as for `details-template` as a check annotation requires that you place the
desired template as a [golang string literal][11] (enlcosed in backticks)
within another template definition. This does not apply to entity annotations.

###### Examples

To change the token argument for a particular check, for that checks's metadata
To change the `--details-template` argument for a particular check, and taking
into account the note above regarding templates, for that check's metadata add
the following:

```yml
type: CheckConfig
api_version: core/v2
metadata:
annotations:
sensu.io/plugins/sensu-pagerduty-handler/config/details-template: "{{`{{.Check.Output}}`}}"
[...]
```

To change the `--token` argument for a particular check, for that checks's metadata
add the following:

```yml
Expand Down Expand Up @@ -215,3 +233,5 @@ See https://github.com/sensu/sensu-go/blob/master/CONTRIBUTING.md
[7]: https://bonsai.sensu.io/sensu/sensu-pagerduty-handler
[8]: https://docs.sensu.io/sensu-go/latest/guides/secrets-management/
[9]: https://docs.sensu.io/sensu-go/latest/guides/secrets-management/#use-env-for-secrets-management
[10]: https://docs.sensu.io/sensu-go/latest/observability-pipeline/observe-schedule/checks/#check-token-substitution
[11]: https://golang.org/ref/spec#String_literals

0 comments on commit 2d21c81

Please sign in to comment.