aboutsummaryrefslogtreecommitdiff
path: root/prometheus_pacman_exporter/metrics.py
diff options
context:
space:
mode:
authorDennis Fink2026-09-19 19:16:20 +0200
committerDennis Fink2026-09-19 19:16:20 +0200
commit37e62c47973e7d1e9a9d43e7480e9f393dc77a0e (patch)
treedd1967ae36fc7c94c50d142eb29144cf42c5c4a6 /prometheus_pacman_exporter/metrics.py
downloadprometheus-pacman-exporter-37e62c47973e7d1e9a9d43e7480e9f393dc77a0e.tar.gz
prometheus-pacman-exporter-37e62c47973e7d1e9a9d43e7480e9f393dc77a0e.zip
feat: add initial pacman Prometheus exporterv1.0.0
Add the first production-ready release of prometheus-pacman-exporter for collecting pacman package statistics through the node exporter textfile collector. Collect installed, explicit, dependency, unrequired, foreign, native, orphan, and updateable package metrics. Support checkupdates as an alternative update source and optional AUR update collection through a configurable command. Add the Click-based CLI, Prometheus metric definitions, package metadata, dependency lockfile, README, licensing metadata, and development configuration.
Diffstat (limited to '')
-rw-r--r--prometheus_pacman_exporter/metrics.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/prometheus_pacman_exporter/metrics.py b/prometheus_pacman_exporter/metrics.py
new file mode 100644
index 0000000..f8a99fd
--- /dev/null
+++ b/prometheus_pacman_exporter/metrics.py
@@ -0,0 +1,51 @@
+# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+"""Prometheus metric definitions for the pacman exporter."""
+
+from prometheus_client import CollectorRegistry, Gauge
+
+REGISTRY = CollectorRegistry(auto_describe=True)
+
+INSTALLED_PACKAGES = Gauge(
+ "pacman_installed_packages",
+ "The current number of installed packages",
+ registry=REGISTRY,
+)
+UPDATEABLE_PACKAGES = Gauge(
+ "pacman_updateable_packages",
+ "The current number of updateable packages",
+ registry=REGISTRY,
+)
+EXPLICIT_PACKAGES = Gauge(
+ "pacman_explicit_packages",
+ "The current number of explicitly installed packages",
+ registry=REGISTRY,
+)
+DEPENDS_PACKAGES = Gauge(
+ "pacman_depends_packages",
+ "The current number of packages installed as dependencies",
+ registry=REGISTRY,
+)
+UNREQUIRED_PACKAGES = Gauge(
+ "pacman_unrequired_packages",
+ "The current number of unrequired packages",
+ registry=REGISTRY,
+)
+FOREIGN_PACKAGES = Gauge(
+ "pacman_foreign_packages",
+ "The current number of foreign packages",
+ registry=REGISTRY,
+)
+NATIVE_PACKAGES = Gauge(
+ "pacman_native_packages", "The current number of native packages", registry=REGISTRY
+)
+ORPHAN_PACKAGES = Gauge(
+ "pacman_orphan_packages", "The current number of orphan packages", registry=REGISTRY
+)
+AUR_UPDATEABLE_PACKAGES = Gauge(
+ "pacman_aur_updateable_packages",
+ "The current number of updates packages from the AUR",
+ registry=REGISTRY,
+)