Prometheus Juju Exporter

  • Canonical BootStack Charmers
Channel Revision Published Runs on
latest/stable 17 08 Aug 2024
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
latest/candidate 17 08 Aug 2024
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
latest/edge 21 20 Nov 2024
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04
juju deploy prometheus-juju-exporter --channel edge
Show information

Platform:

Ubuntu
22.04 20.04 18.04

Tutorial: Get started

The tutorial consists of the following steps:

  1. Prerequisites
  2. Deploy Prometheus Juju Exporter
  3. View the metrics
  4. Integrate with Prometheus
  5. Clean up the Environment

Prerequisites

In order to perform the steps of this tutorial, you need access to a Juju controller and a user account with sufficient permission (details can be found in Configure the charm).

Deploy Prometheus Juju Exporter

Add a new model to perform the deployments for the tutorial.

juju add-model pje-tutorial

As Prometheus Juju Exporter is a subordinate charm, it requires deployment in conjunction with a principal application. For this tutorial, we can use the ubuntu charm for this purpose.

juju deploy prometheus-juju-exporter
juju deploy ubuntu
juju relate prometheus-juju-exporter ubuntu

At this point the unit of prometheus-juju-exporter should be in Blocked state as it’s missing values for the following mandatory configuration options:

  • customer
  • cloud-name
  • controller-url
  • juju-user juju-password

For guidance on configuring the charm and locating the necessary values for these configurations, visit Configure the charm).

View the metrics (without COS)

The exported Prometheus metrics can be viewed directly by accessing port 5000 of the machine on which the charm is deployed. E.g. If the IP address of the prometheus-juju-exporter unit is 192.168.5.10, then the metrics can be found at http://192.168.5.10:5000

$ curl http://192.168.5.10:5000
# HELP juju_machine_state Running status of juju machines
# TYPE juju_machine_state gauge
juju_machine_state{cloud_name="Test Cloud",customer="Test Org",hostname="juju-be56b1-0",job="prometheus-juju-exporter",juju_model="billing",type="metal"} 1.0
juju_machine_state{cloud_name="Test Cloud",customer="Test Org",hostname="juju-be56b1-1",job="prometheus-juju-exporter",juju_model="billing",type="metal"} 1.0
juju_machine_state{cloud_name="Test Cloud",customer="Test Org",hostname="juju-be56b1-2",job="prometheus-juju-exporter",juju_model="billing",type="metal"} 1.0
juju_machine_state{cloud_name="Test Cloud",customer="Test Org",hostname="juju-d53a52-0",job="prometheus-juju-exporter",juju_model="controller",type="metal"} 1.0

Integrate with COS

For a more real-world use case, Prometheus Juju Exporter can be used alongside COS. The Prometheus charm inside the COS bundle will scrape the exported metrics from the endpoint and display them on a Grafana Dashboard.

Read more about it on Integrate with COS.

Clean up the Environment

Once you have finished playing around with the setup, the tutorial model can be cleaned up.

juju destroy-model pje-tutorial

Congratulations! Now you have a basic idea about the workings of the Prometheus Juju Exporter charm.


Help improve this document in the forum (guidelines). Last updated 7 months ago.