sensu-go-elasticsearch

command module
v0.0.0-...-ac38171 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2020 License: MIT Imports: 13 Imported by: 0

README

Sensu Go Elasticsearch metric handler plugin

Bonsai Asset BadgeGo TestGo Lintgoreleaser

Table of Contents

Overview

sensu-go-elasticsearch is a Sensu Handler for pushing metric data and full event bodies into Elasticsearch for visualization in Kibana.

Usage Examples

Help:

The Sensu Go handler for metric and event logging in elasticsearch
Required:  Set the ELASTICSEARCH_URL env var with an appropriate connection url (https://user:pass@hostname:port)

Usage:
  sensu-go-elasticsearch [flags]
  sensu-go-elasticsearch [command]

Available Commands:
  help        Help about any command
  version     Print the version number of this plugin

Flags:
  -d, --dated_index                 Should the index have the current date postfixed? ie: metric_data-2019-06-27
  -f, --full_event_logging          send the full event body instead of isolating event metrics
  -h, --help                        help for sensu-go-elasticsearch
  -i, --index string                index to use
  -s, --insecure-skip-verify        skip TLS certificate verification (not recommended!)
  -p, --point_name_as_metric_name   use the entire point name as the metric name
  -t, --trusted-ca-file string      TLS CA certificate bundle in PEM format

Use "sensu-go-elasticsearch [command] --help" for more information about a command.

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 nixwiz/sensu-go-elasticsearch

If you're using an earlier version of sensuctl, you can find the asset on the Bonsai Asset Index

Handler definition
For metrics only
---
type: Handler
api_version: core/v2
metadata:
  name: sensu-go-elasticsearch
  namespace: default
spec:
  command: sensu-go-elasticsearch -i sensu --dated_index
  type: pipe
  runtime_assets:
    - nixwiz/sensu-go-elasticsearch
  secrets:
    - name: ELASTICSEARCH_URL
      secret: elasticsearch_url
  filters:
    - has_metrics
For full event data
---
type: Handler
api_version: core/v2
metadata:
  name: sensu-go-elasticsearch
  namespace: default
spec:
  command: sensu-go-elasticsearch -i sensu --dated_index --full_event_logging
  type: pipe
  runtime_assets:
    - nixwiz/sensu-go-elasticsearch
  secrets:
    - name: ELASTICSEARCH_URL
      secret: elasticsearch_url
Environment Variables

The handler requires the ELASTICSEARCH_URL environment variable. Given that the username/password may be included in this URL, it is suggested to make use of secrets management to surface it. The handler definitions above reference it as a secret. Below is an example secret definition that makes use of the built-in env secrets provider.

---
type: Secret
api_version: secrets/v1
metadata:
  name: elasticsearch_url
spec:
  provider: env
  id: ELASTICSEARCH_URL
Proxy support

This handler supports the use of the environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (or the lowercase versions thereof). HTTPS_PROXY takes precedence over HTTP_PROXY for https requests. The environment values may be either a complete URL or a "host[:port]", in which case the "http" scheme is assumed.

Annotations

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/elasticsearch/config.

Examples

To change the index argument for a particular entity, in that entity's agent.yml add the following:

[...]
annotations:
  sensu.io/plugins/elasticsearch/config: "dev_index"
[...]

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 from this source.

From the local path of the sensu-go-elasticsearch repository:

go build

Contributing

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
lib

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL