Prometheus

  • By Balbir Thomas
Channel Version Revision Published Runs on
latest/candidate 55 55 08 Aug 2022
Ubuntu 20.04
latest/beta 55 55 08 Aug 2022
Ubuntu 20.04
latest/edge 70 70 22 Sep 2022
Ubuntu 20.04
juju deploy prometheus-k8s --channel candidate
Show information

Platform:

Prometheus Operator for Kubernetes

The Prometheus Charmed Operator for Juju provides a monitoring solution using Prometheus, which is an open-source systems monitoring and alerting toolkit. Besides it handles instantiation, scaling, configuration, and Day 2 operations specific to Prometheus.

This Charm is also part of the Canonical Observability Stack and deploys only the monitoring component of Prometheus in a Kubernetes cluster. An alerting service for Prometheus is offered through a separate Charm.

Getting Started

Basic Deployment

Create a Juju model for your operator, say “observability”

juju add-model observability

The Prometheus Charmed Operator may now be deployed using the Juju command line as in

juju deploy prometheus-k8s --channel=beta

Checking deployment status

Progress of the Prometheus charm deployment and its current status may be viewed anytime using the Juju command line

juju status --color --relations

Once the Prometheus charm deployments completes, you may expect to see a status result such as

$ juju status --relations

Model          Controller  Cloud/Region        Version  SLA          Timestamp
observability  charm-dev   microk8s/localhost  2.9.32   unsupported  10:14:11-03:00

App             Version  Status  Scale  Charm           Channel  Rev  Address        Exposed  Message
prometheus-k8s           active      1  prometheus-k8s  beta      51  10.152.183.88  no

Unit               Workload  Agent  Address      Ports  Message
prometheus-k8s/0*  active    idle   10.1.157.92

Relation provider                Requirer                         Interface         Type  Message
prometheus-k8s:prometheus-peers  prometheus-k8s:prometheus-peers  prometheus_peers  peer

Accessing the Prometheus User Interface

Prometheus provides a user interface that let us explore the data that has collected such as metrics and associated alerts. This UI is accessed on port 9090 at the Prometheus charm’s ingress address. This assumes the Prometheus host address is accessible from the host your browser is running on. For example the Juju status message shown above is from a microk8s cluster, hence navigating to http://10.152.183.88:9090, you will see the following:

Adding scrape targets

When Prometheus is deployed it will only scrape metrics from itself. This is the default behavior of Prometheus. Additional metrics endpoints may be added to the Prometheus charm through relations with other charms. Currently the following charms are supported

  • Any charm that uses the prometheus_scrape interface to provide a metrics endpoint and optionally alert rules for Prometheus.
  • The Prometheus Scrape Target charm may be used to scrape metrics endpoint that are not part of any Juju Model.
  • The Prometheus Scrape Config charm may be used to scrape metrics endpoints across different Juju models. The charm also support overriding some of the scrape job configurations provided by metrics endpoints.

OCI Images

This charm by default uses the latest version of the ubuntu/prometheus image.


Help us improve this documentation

Most of this documentation can be collaboratively discussed and changed on the respective topic in the doc category of the Charmhub forum. See the documentation guidelines if you’d like to contribute.

Last updated a month ago. Help improve this document in the forum.