The Prometheus Configurer Charmed Operator provides an HTTP-based API for managing Prometheus alerting rules.
This charm has been designed to supplement the
prometheus-k8s charm. It leverages the prometheus_remote_write interface, provided by the
prometheus-k8s, to send over the alerting rules to the Prometheus Server inside the
Juju relation data bag.
Full description of the API is available in github.
NOTE: This charm is only compatible with Juju 3.x!
The Prometheus Configurer Charmed Operator may be deployed using the Juju command line as in:
juju deploy prometheus-configurer-k8sjuju deploy prometheus-k8s
juju relate prometheus-configurer-k8s prometheus-k8s:receive-remote-writePrometheus Configurer exposes an HTTP API which allows managing Prometheus's alerting rules.
The API is available at port 9100 on the IP address of the charm unit. This unit and its IP address
may be determined using the juju status command.
Full description of Prometheus Configurer's API is available in
github.
By default, Prometheus Configurer supports multitenancy, hence all alerting rules added using
Prometheus Configurer will be augmented with the tenant_id passed in the endpoint URL.
Example:
alert: CPUOverUse
expr: process_cpu_seconds_total > 0.12
for: 0m
labels:
severity: Low
annotations:
summary: "Rule summary."
description: "Rule description."Adding above rule using Prometheus Configurer can be done by running below POST:
curl -X POST http://<PROMETHEUS CONFIGURER CHARM UNIT IP>:9100/v1/<TENANT_ID>/alert
-H 'Content-Type: application/json'
-d '{"alert": "CPUOverUse", "expr": "process_cpu_seconds_total > 0.12", "for": "0m", "labels": {"severity": "Low"}, "annotations": {"summary": "Rule summary.", "description": "Rule description."}}'To get tenant's alert rules:
curl -X GET http://<PROMETHEUS CONFIGURER CHARM UNIT IP>:9100/v1/<TENANT_ID>/alertTo delete tenant's alert rule:
curl -X DELETE http://<PROMETHEUS CONFIGURER CHARM UNIT IP>:9100/v1/<TENANT_ID>/alert/<ALERT_NAME>