prometheus-alert-check
Table of Contents
Overview
The prometheus-alert-check is a Sensu Check that monitors alerts in Prometheus.
Usage examples
The command allows for the following arguments:
-u, --url, PROMETHEUS_URL
: The base path of the Prometheus API. Default: http://127.0.0.1:9090/
-i, --insecure-skip-verify, PROMETHEUS_SKIP_VERIFY
: Skip TLS certificate verification (not recommended!).
-T, --trusted-ca-file, PROMETHEUS_CACERT
: TLS CA certificate bundle in PEM format.
-t, --timeout, PROMETHEUS_TIMEOUT
: The number of seconds the test should wait for a response form the host (Default: 15).
-f, --firing
: If specified, the check will only look for firing alerts.
-p, --pending
: If specified, the check will only look for pending alerts.
-l, --label
: Filter alerts by labels using a RegEx. Can be specified more than once. E.g. --label myname=\"(Alert1|Alert2|^$)\"
will match 'Alert1', 'Alert2', and alerts with no label called 'myname'.
-a, --annotation
: Filter alerts by annotations using a RegEx. Can be specified more than once.
-w, --warning
: If specified, a failed check will result in a warning result.
-c, --critical
: If specified, a failed check will result in a critical result. Default
-F, --failure-level-label
: If specified, the result of a failed task will be determined by the specified Prometheus label. The label must have the value of 'warning' or 'critical'.
-v, --verbose
: If specified, output will be more verbose.
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 alasconnect/sensu-prometheus-alert-check
If you're using an earlier version of sensuctl, you can find the asset on the Bonsai Asset Index.
Check definition
---
type: CheckConfig
api_version: core/v2
metadata:
name: sensu-prometheus-alert-check
namespace: default
spec:
command: sensu-prometheus-alert-check --url http://localhost:9090/
subscriptions:
- system
runtime_assets:
- alasconnect/sensu-prometheus-alert-check
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-prometheus-alert-check repository:
go build
Contributing
For more information about contributing to this plugin, see Contributing.