Prometheus Juju Exporter

Canonical Publisher Verified account Verified account

Install latest/stable of Prometheus Juju Exporter

Ubuntu 16.04 or later?

Make sure snap support is enabled in your Desktop store.


Install using the command line

sudo snap install prometheus-juju-exporter

Don't have snapd? Get set up for snaps.

Channel Version Published

Prometheus exporter for Juju machine statuses

Overview

Prometheus Juju Exporter is a snap that collects statistics about machines deployed by a juju controller and exports them as Prometheus metrics.

The snap runs as a daemon service, crawling through every Juju model it finds and collecting information about deployed machines. Resulting metrics contain numeric representation 1 (UP) or 0 (DOWN) for each machine deployed by the controller. In addition, each machine (metric) has labels that help to uniquely identify it:

  • hostname - hostname of the machine as reported by Juju
  • juju_model - name of the model in which the machine is deployed
  • cloud_name - name of the cloud that hosts the model
  • customer - name of the customer/organization that owns the controller
  • type - Distinguishes various host types
  • metal - Physical machine
  • kvm - Virtual Machine
  • lxd - LXD container

Compatibility matrix

Due to the limitations of libjuju's cross-version support, channels and versions are used in the snap to accommodate different juju controller versions. Generally speaking, install the snap channel that matches the version of the Juju controller.

For example, in a Juju cloud with a version 2.9 controller, users must install the snap from the 2.9/stable channel:

 sudo snap install --channel 2.9/stable prometheus-juju-exporter

A more exhaustive version mapping table is available in the project's README file.

Configuration

To configure the snap for your own environment, create a config.yaml file in the $SNAP_DATA (refer to Snap Environment Variables linked below) directory.

Example configuration:

 customer: # information about the targeted cloud
   name: "example_customer"
   cloud_name: "example_cloud"

 juju: # these are usually found under ~/.local/share/juju

   # The endpoint and CA certificate of the targeted controller 
   controller_endpoint: ""
   controller_cacert: "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n"

   # Credentials of a juju user. The minimum privileges of the user should be:
   # `login` access to the controller and `admin` access to its model, as well as
   # `admin` access to any other model monitored by this exporter
   username: "example_user"
   password: "example_password"

 exporter:
   port: 9748 # optional, defaults to 5000
   collect_interval: 15

 # parameters affecting the detection of machine types (physical or virtual)
 detection: 
   # Interface names to consider when detecting machine type.
   # Takes a single regex string as input. The default value '' is
   # equivalent to '.*'.
   match_interfaces: ''^(en[os]|eth)\d+|enp\d+s\d+|enx[0-9a-f]+”
   # The list of MAC address prefixes to be considered as virtual machines.
   virt_macs: ["52:54:00", "fa:16:3e", "06:f1:3a", "00:0d:3a", "00:50:56"]

The machine type detection algorithm will classify a machine as virtual if any MAC address included in the virt_macs prefix list matches the MAC address of any of the interfaces selected by the match_interfaces regex. If no such match is found, the machine is considered to be a physical machine.

View metrics

The exported Prometheus metrics can be viewed directly by accessing the port specified in config.yaml of the machine on which the charm is deployed. For example, curl http://192.168.5.10:5000

With a successful Prometheus integration, the exported metrics will be scraped from the endpoint and displayed as time series data.

Links

libjuju https://github.com/juju/python-libjuju/

Project README file https://github.com/canonical/prometheus-juju-exporter?tab=readme-ov-file#juju-version-compatibility

Snap Environment Variables https://snapcraft.io/docs/environment-variables

Project Repository https://github.com/canonical/prometheus-juju-exporter/issues

Details for Prometheus Juju Exporter

License
  • unset

Last updated
  • 12 April 2023 - latest/stable
  • 16 April 2024 - latest/edge

Share this snap

Generate an embeddable card to be shared on external websites.


Install Prometheus Juju Exporter on your Linux distribution

Choose your Linux distribution to get detailed installation instructions. If yours is not shown, get more details on the installing snapd documentation.


Where people are using Prometheus Juju Exporter

Users by distribution (log)

Ubuntu 20.04
Ubuntu 18.04
Ubuntu 22.04

Is there a problem with Prometheus Juju Exporter? Report this app