The Prometheus scrape config operator is an adapter charm that enables you to apply a set of configurations to the scrape jobs provided by its upstream charms, and forward the modified scrape jobs downstream to one or more consumers that will actually perform the scraping. For a detailed explanation of the deployment scenario, see the integration doc.
First, deploy the prometheus and the charm you want to be monitored with a modified configuration.
$ juju deploy prometheus-k8s prometheus
$ juju deploy your-charm
Then, deploy the prometheus-scrape-configuration
charm, specifying a
custom scrape interval valid only for the scrape job forwarded to prometheus-k8s
through its relation with this charm.
$ juju deploy \
prometheus-scrape-config-k8s \
scrape-interval-config \
--config scrape_interval=20s
Relate the charms together.
$ juju relate your-charm scrape-interval-config
$ juju relate scrape-interval-config:metrics-endpoint prometheus
blocked
stateIf you relate prometheus-scrape-config-k8s
only to prometheus
,
the charm will be in blocked
state until any other charm relates to it.
This is expected and doesn't mean the environment is in a wrong state.
Unit Workload Agent Address Ports Message
prometheus-scrape-config-k8s/0* blocked idle missing metrics provider (relate to upstream charm?)
prometheus/0* active idle
your-charm/0* active idle
After a prometheus_scrape
relation is added, the charm will go
into active
state.
$ juju relate your-charm:metrics-endpoint prometheus-scrape-config-k8s:configurable-scrape-jobs
$ juju status
(...)
Unit Workload Agent Address Ports Message
prometheus-scrape-config-k8s/0* active idle
prometheus/0* active idle
your-charm/0* active idle
configurable-scrape-jobs
relation with any Charm that uses the
MetricsEndpointProvider
to implement the prometheus_scrape
interface.metrics-endpoint
relation with one or more Charms that implement the
MetricsEndpointConsumer
, such as the Prometheus charm.This charm is workloadless, in the sense that it does not use any OCI images to spawn additional workloads.
Please see the Juju SDK docs as well as
CONTRIBUTING.md
for more information on how to
contribute to this charm.