This Python library serves as a common ground when composing Prometheus alerts into hierarchical trees in a form that can be best consumed by user interfaces and monitoring tools.
It features an optional helper to generate a command-line tool which helps with discovery of an existing tree, and provides an easy command to render a corresponding PrometheusRule manifest.
The library only has a handful of modules:
The main module you will use to build the desired hierarchy of alerts, through the use of ExistingAlert
and DerivedAlert
.
See the reference <tools-lib-alert-tree-ref-models>
.
Holds the data containers used to render accurate Prometheus configuration.
See the reference <tools-lib-alert-tree-ref-prometheus>
.
Provides some helpers for listing common existing alerts for some usual K8s objects (e.g. deployment_alerts
will list all alerts for a Deployment, given its name and namespace).
See the reference <tools-lib-alert-tree-ref-kubernetes>
.
Exposes the generate_cli
method, which can be used to define a Click entrypoint, with helpful subcommands for interacting with one or more alert trees.
See the reference <tools-lib-alert-tree-ref-cli>
.
install usage reference