Skip to content

Afaque-Anwar-Azad/sensu-dynamic-event-mutator

Repository files navigation

Sensu Bonsai Asset Go Test goreleaser

sensu-dynamic-event-mutator

Table of Contents

Overview

The Sensu dynamic event mutator enriches the event payload by seamlessly incorporating details of both labels and annotations. These specific labels and annotations data are sourced from the associated entity, enriching the overall contextual information of the event payload.

Key enhancements to the event payload are on event.Entity.Labels and event.Entity.Annotations

Usage examples

Usage: sensu-dynamic-event-mutator [command]

example commands:

  1. sensu-dynamic-event-mutator --add-labels
  2. sensu-dynamic-event-mutator --add-annotations
  3. sensu-dynamic-event-mutator --add-all

Environment variables

Argument Environment Variable
--api-url SENSU_API_URL
--api-key SENSU_API_KEY

Security Note: Care should be taken to not expose the API key or access token for this handler by explicitly specifying either on the command line or by directly setting the environment variable(s) in the handler definition. It is suggested to make use of secrets management to provide the API key or access token as environment variables.

Configuration

Asset registration

Sensu Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 with Sensu Backend 5.13 or later, you can use the following command to add the asset:

sensuctl asset add Afaque-Anwar-Azad/sensu-dynamic-event-mutator

If you're using an earlier version of sensuctl, you can find the asset on the [Bonsai Asset Index][https://bonsai.sensu.io/assets/Afaque-Anwar-Azad/sensu-dynamic-event-mutator].

Mutator definition

Example mutator definition for adding labels :

---
type: Mutator
api_version: core/v2
metadata:
  name: sensu-dynamic-event-mutator
  namespace: default
spec:
  command: sensu-dynamic-event-mutator --add-labels
  runtime_assets:
  - Afaque-Anwar-Azad/sensu-dynamic-event-mutator

Example mutator definition for adding both labels and annotations :

---
type: Mutator
api_version: core/v2
metadata:
  name: sensu-dynamic-event-mutator
  namespace: default
spec:
  command: sensu-dynamic-event-mutator --add-all
  runtime_assets:
  - Afaque-Anwar-Azad/sensu-dynamic-event-mutator

Dynamically mutated event output payload :

---
check: {}
entity:
  entity_class: agent
  system: {}
  subscriptions: {}
  last_seen: ""
  deregister: false
  deregistration: {}
  user: agent
  metadata:
    name: ip-172-31-0-1.eu-west-1.compute.internal
    namespace: default
    labels:
      availabilityzone: eu-west-1b
      awsregion: eu-west-1b
      instancetype: 172.31.0.1
    annotations:
      availabilityzone: eu-west-1b
      awsregion: eu-west-1b
      instancetype: 172.31.0.1
  sensu_agent_version: ""
  keepalive_handlers: ""
id: XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX
metadata: {}
time: '2222-12-13T11:49:34Z'

Installation from source

The preferred way of installing and deploying this plugin is to use it as an Asset. If you would like to compile and install the plugin from source or contribute to it, download the latest version or create an executable script from this source.

From the local path of the sensu-dynamic-event-mutator repository:

go build

Additional notes

Contributing

For more information about contributing to this plugin, see Contributing.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages