Skip to main content

prometheus-pacman-exporter

A Prometheus metrics exporter for pacman, designed to be run via a systemd timer and consumed by the node exporter textfile collector.

Requirements

  • Python 3.12+
  • pacman
  • checkupdates (optional)
  • An AUR helper or other update command (optional)

Installation

pip install prometheus-pacman-exporter

Usage

Usage: prometheus-pacman-exporter [OPTIONS]

  Collect pacman package metrics and export them for Prometheus.

  Queries pacman for installed package statistics and available updates, then
  writes them to a .prom file for consumption by the Prometheus node exporter
  textfile collector.

  By default, updateable packages are determined using pacman --query
  --upgrades. Use --use-checkupdates to query updates with checkupdates
  instead. AUR update metrics can optionally be collected by providing --aur
  together with --aur-command.

Options:
  --textfile-collector-dir DIRECTORY
                                  Directory where the Prometheus collector
                                  textfile will be written.
                                  [default: /var/lib/prometheus/node-exporter]
  --use-checkupdates              Use checkupdates instead of pacman --query
                                  --upgrades to check for available updates.
  --aur                           Include AUR updates.
  --aur-command TEXT              Command used to check for AUR updates.
  --color [auto|always|never]     Colorize the output. A bare --color is the
                                  same as --color=always.
                                  [default: auto]
  --no-color                      Disable colorization (alias of
                                  --color=never).
  -q, --quiet                     Suppress all non-error output.
  -v, --verbose                   Enable verbose output.
  --version                       Show version information and exit.
  -h, --help, -?                  Show this message and exit.

Checking for updates

By default, available repository updates are determined using:

pacman --query --upgrades

This only reports updates already known to the local package database.

Use --use-checkupdates to instead use checkupdates, which checks for available updates without modifying the system's package database:

prometheus-pacman-exporter --use-checkupdates

AUR updates

AUR updates can be included with --aur. An update command must also be provided with --aur-command:

prometheus-pacman-exporter \
    --aur \
    --aur-command "paru --query --upgrades --aur"

The AUR command may use any AUR helper or custom program, provided its standard output contains exactly one available package update per line. The exporter counts the number of output lines; it does not interpret the contents of those lines.

For example, output such as:

package-one 1.2.3-1 -> 1.2.4-1
package-two 4.5.6-1 -> 4.6.0-1

is interpreted as two available AUR updates.

Diagnostic or informational messages from the command should therefore be written to standard error rather than standard output.

The value of --aur-command is split into command-line arguments and executed directly. It is not executed through a shell, so shell features such as pipes, redirections, variable expansion, and command substitution are not available.

Metrics

Metric Description
pacman_installed_packages Total number of installed packages
pacman_explicit_packages Number of explicitly installed packages
pacman_depends_packages Number of packages installed as dependencies
pacman_unrequired_packages Number of packages not required by another package
pacman_foreign_packages Number of packages not present in sync databases
pacman_native_packages Number of packages present in sync databases
pacman_orphan_packages Number of orphaned dependency packages
pacman_updateable_packages Number of available repository package updates
pacman_aur_updateable_packages Number of available AUR package updates

The AUR update metric is only collected when --aur is enabled.

License

BSD-3-Clause. See LICENSE for details.

Metadata

Release files for prometheus-pacman-exporter 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prometheus-pacman-exporter 1.0.0
File Size Uploaded
prometheus_pacman_exporter-1.0.0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prometheus-pacman-exporter 1.0.0
File Interpreter ABI Platform
prometheus_pacman_exporter-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / prometheus_pacman_exporter-1.0.0.tar.gz

Download URL prometheus_pacman_exporter-1.0.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9e1be316465723dc5f8f8808d33920f21c2ffb7b51e1ef129177465db431b9fb
BLAKE2b-256 checksum
How to use checksums
78fc594df76ee85807f5faf29e11c290a7c7fe47f37823ba68b23b46e6773a08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / prometheus_pacman_exporter-1.0.0-py3-none-any.whl

Download URL prometheus_pacman_exporter-1.0.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f12d1d5d6f8e98b5a7c05b111bbf209354aee8a946e88d9f6059ac21bb97b333
BLAKE2b-256 checksum
How to use checksums
f8e53408586345e16cf5ed10a656f61185181db20ecb2a5bd13b8c9df5afcd80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

This release

1.0.0 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page