Skip to content

Commit

Permalink
updated usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Hailey committed May 28, 2021
1 parent 58778a5 commit 4d673f2
Showing 1 changed file with 123 additions and 3 deletions.
126 changes: 123 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,150 @@
## Overview

Event-based Sensu entity management for automated service-discovery (add/remove subscriptions) and other automation workflows.
The Sensu Entity Manager works with any check plugin or event producer that generates one instruction per line in any of the following formats:
The Sensu Entity Manager works with any check plugin or event producer that generates one instruction per line of `event.check.output` in any of the following formats:

- **Subscriptions (one string per line):**

Example check output:

```
system/linux
postgres
```


Example event payload:

```json
{
"metadata": {},
"entity": {},
"check": {
"metadata": {
"name": "example",
"labels": {},
"metadata": {}
},
"handlers": [
"subscription-manager"
],
"output": "system/linux\npostgres",
"status": 0,
"...": "..."
},
"metrics": {},
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1234567890
}
```

Example handler definition:

```yaml
---
type: Handler
api_version: core/v2
metadata:
name: subscription-manager
spec:
command: sensu-entity-manager --add-subscriptions
...: ...
```

- **Labels and Annotations (one `key=value` pair per line):**

Example check output:

```
region=us-west-2
application_id=1001
```


Example event payload:

```json
{
"metadata": {},
"entity": {},
"check": {
"metadata": {
"name": "example",
"labels": {},
"metadata": {}
},
"handlers": [
"label-manager"
],
"output": "region=us-west-2\napplication_id=1001",
"status": 0,
"...": "..."
},
"metrics": {},
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1234567890
}
```

Example handler definition:

```yaml
---
type: Handler
api_version: core/v2
metadata:
name: label-manager
spec:
command: sensu-entity-manager --add-labels
...: ...
```

- **Commands (one space-separated `command argument` pair per line):**

Example check output:

```
add-subscription system/linux
add-subscription postgres
add-label region=us-west-2
add-annotation application_id=1001
```

Example event payload:

```json
{
"metadata": {},
"entity": {},
"check": {
"metadata": {
"name": "example",
"labels": {},
"metadata": {}
},
"handlers": [
"entity-manager"
],
"output": "add-subscription system/linux\nadd-subscription postgres\nadd-label region=us-west-2\nadd-annotation application_id=1001",
"status": 0,
"...": "..."
},
"metrics": {},
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1234567890
}
```

Example handler definition:

```yaml
---
type: Handler
api_version: core/v2
metadata:
name: entity-manager
spec:
command: sensu-entity-manager --add-all
...: ...
```

## Usage examples

Expand Down

0 comments on commit 4d673f2

Please sign in to comment.