From 33adc12c2b85673229c3e4b99dade17f1e28ea94 Mon Sep 17 00:00:00 2001 From: Sean Porter Date: Tue, 11 Feb 2020 09:19:16 -0800 Subject: [PATCH] updated readme to use the new template Signed-off-by: Sean Porter --- README.md | 132 ++++++++++++++++-------------------------------------- 1 file changed, 39 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index f3255d3..b1cc48e 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ -[![Bonsai Asset Badge](https://img.shields.io/badge/Sensu%20Prometheus%20Collector-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu/sensu-prometheus-collector) [![Build Status](https://travis-ci.org/sensu/sensu-prometheus-collector.svg?branch=master)](https://travis-ci.org/sensu/sensu-prometheus-collector) -## Sensu Prometheus Collector +[![Bonsai Asset Badge](https://img.shields.io/badge/Sensu%20Prometheus%20Collector-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu/sensu-prometheus-collector) +# Sensu Prometheus Collector + +## Table of Contents - [Overview](#overview) - [Usage examples](#usage-examples) - [Configuration](#configuration) - - [Sensu Go](#sensu-go) - - [Asset definition](#asset-definition) - - [Check definition(s)](#check-definitions) - - [Sensu Core](#sensu-core) - - [Check definition](#check-definition) - - [Handler definition](#handler-definition) -- [Installation from source and contributing](#installation-from-source-and-contributing) + - [Asset registration](#asset-registration) + - [Resource definition](#resource-definition) +- [Installation from source](#installation-from-source) +- [Contributing](#contributing) -### Overview +## Overview The Sensu Prometheus Collector is a Sensu Check Plugin that collects metrics from a Prometheus exporter or the Prometheus query API. The @@ -26,14 +25,12 @@ one or more time-series databases, for example InfluxDB and/or Graphite! Instrument your applications with the Prometheus libraries and immediately begin collecting your metrics with Sensu! -### Usage examples - +## Usage examples Help: ``` -$ sensu-prometheus-collector -h -Usage of ./sensu-prometheus-collector: +Usage of sensu-prometheus-collector: -exporter-authorization string Prometheus exporter Authorization header. -exporter-password string @@ -77,115 +74,64 @@ $ sensu-prometheus-collector -prom-url http://localhost:9090 -prom-query up up,instance=localhost:9090,job=prometheus value=1 1506991495 ``` -### Asset registration - -Assets are the best way to make use of this handler. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset: - -`sensuctl asset add sensu/sensu-prometheus-collector` - -If you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai Asset Index page](https://bonsai.sensu.io/assets/sensu/sensu-prometheus-collector). +## Configuration -### Configuration +### Asset registration -#### Sensu Go +[Sensu Assets][10] 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: -##### Asset definition -```yaml ---- -type: Asset -api_version: core/v2 -metadata: - name: sensu-prometheus-collector_linux_amd64 - labels: - annotations: - io.sensu.bonsai.url: https://bonsai.sensu.io/assets/sensu/sensu-prometheus-collector - io.sensu.bonsai.api_url: https://bonsai.sensu.io/api/v1/assets/sensu/sensu-prometheus-collector - io.sensu.bonsai.tier: Supported - io.sensu.bonsai.version: 1.1.6 - io.sensu.bonsai.namespace: sensu - io.sensu.bonsai.name: sensu-prometheus-collector - io.sensu.bonsai.tags: check -spec: - url: https://assets.bonsai.sensu.io/ef812286f59de36a40e51178024b81c69666e1b7/sensu-prometheus-collector_1.1.6_linux_amd64.tar.gz - sha512: a70056ca02662fbf2999460f6be93f174c7e09c5a8b12efc7cc42ce1ccb5570ee0f328a2dd8223f506df3b5972f7f521728f7bdd6abf9f6ca2234d690aeb3808 - filters: - - entity.system.os == 'linux' - - entity.system.arch == 'amd64' +``` +sensuctl asset add sensu/sensu-prometheus-collector ``` -##### Check definition +If you're using an earlier version of sensuctl, you can find the asset on the [Bonsai Asset Index][https://bonsai.sensu.io/assets/sensu/sensu-prometheus-collector]. -```yaml +### Resource definition + +```yml --- type: CheckConfig api_version: core/v2 metadata: name: sensu-prom-metrics - namespace: default spec: - check_hooks: null command: sensu-prometheus-collector -exporter-url http://localhost:9182/metrics output_metric_format: influxdb_line output_metric_handlers: - influxdb runtime_assets: - sensu/sensu-prometheus-collector - stdin: false - subdue: null subscriptions: - linux timeout: 5 ttl: 0 ``` -#### Sensu Core - -##### Check definition - -``` -{ - "checks": { - "prometheus_metrics": { - "type": "metric", - "command": "sensu-prometheus-collector -exporter-url http://localhost:8080/metrics", - "subscribers": ["app_tier"], - "interval": 10, - "handler": "influx" - } - } -} -``` - -##### Handler definition +## Installation from source -``` -{ - "handlers": { - "influx": { - "type": "udp", - "mutator": "only_check_output", - "socket": { - "host": "influx.example.com", - "port": 8189 - } - } - } -} -``` - - -## Installation from source and contributing - -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 of the sensu-CHANGEME from [releases][1] +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-prometheus-collector repository: ``` -go build -o /usr/local/bin/sensu-prometheus-collector main.go +go build ``` -If you'd like to contribute to this plugin, see https://github.com/sensu/sensu-go/blob/master/CONTRIBUTING.md +## Contributing + +For more information about contributing to this plugin, see [Contributing][1]. -[1]: https://github.com/sensu/sensu-prometheus-collector/releases -[2]: #asset-registration +[1]: https://github.com/sensu/sensu-go/blob/master/CONTRIBUTING.md +[2]: https://github.com/sensu-community/sensu-plugin-sdk +[3]: https://github.com/sensu-plugins/community/blob/master/PLUGIN_STYLEGUIDE.md +[4]: https://github.com/sensu-community/check-plugin-template/blob/master/.github/workflows/release.yml +[5]: https://github.com/sensu-community/check-plugin-template/actions +[6]: https://docs.sensu.io/sensu-go/latest/reference/checks/ +[7]: https://github.com/sensu-community/check-plugin-template/blob/master/main.go +[8]: https://bonsai.sensu.io/ +[9]: https://github.com/sensu-community/sensu-plugin-tool +[10]: https://docs.sensu.io/sensu-go/latest/reference/assets/