This release is a pre-release and may not be stable for production use.
Prometheus PKG Exporter
This project provides an textfile-based exporter for apt-repositories.
The Project is in its early development phases. Interfaces may change without notice. Compatibility and Stability do vary.
For the changelog, use the Releases-Section on GitHub
Exported Metrics
At the moment, the packages installed, upgradable, broken and autoremovable are exported per repository as gauge. The label set depends on the packet manager type.
Additionally, pkg_reboot_required is exported to indicate that an reboot is needed.
# HELP pkg_reboot_required Node Requires an Reboot
# TYPE pkg_reboot_required gauge
pkg_reboot_required 1.0
# HELP pkg_update_start_time timestamp of last apt update start
# TYPE pkg_update_start_time gauge
pkg_update_start_time 1.641382890503045e+09
# HELP pkg_update_end_time Timestamp of last apt update finish
# TYPE pkg_update_end_time gauge
pkg_update_end_time 1.641382892755024e+09
# HELP pkg_update_time_available Availability of the apt update timestamp
# TYPE pkg_update_time_available gauge
pkg_update_time_available 1.0
# HELP pkg_installed Installed packages per origin
# TYPE pkg_installed gauge
pkg_installed{archive="focal-updates",component="main",label="Ubuntu",origin="Ubuntu",site="ftp.fau.de",trusted="True"} 672.0
# HELP pkg_upgradable Upgradable packages per origin
# TYPE pkg_upgradable gauge
pkg_upgradable{archive="focal-updates",component="main",label="Ubuntu",origin="Ubuntu",site="ftp.fau.de",trusted="True"} 7.0
# HELP pkg_auto_removable Auto-removable packages per origin
# TYPE pkg_auto_removable gauge
pkg_auto_removable{archive="focal-updates",component="main",label="Ubuntu",origin="Ubuntu",site="ftp.fau.de",trusted="True"} 6.0
# HELP pkg_broken Broken packages per origin
# TYPE pkg_broken gauge
pkg_broken{archive="focal-updates",component="main",label="Ubuntu",origin="Ubuntu",site="ftp.fau.de",trusted="True"} 0.0
Contributing
Feel free to contribute improvements, as well as support for non-apt based systems.
Installation
Global pip installation
Run pip3 install pkg-exporter.
Install from source
Clone the repository and run poetry install from the main directory.
You can also use other standard installation methods for python packages, like directly installing from this git repository.
The pyinstaller-based binary is not provided any more.
pipx
If a global pip installation is not possible (e.g. from debian 12 onwards), you can use pipx, either for install, and/or for running pkg-exporter ad hoc:
pipx run --system-site-packages pkg-exporter
--system-site-packages is necessary to provide access to the system python3-apt lib.
apt-based systems
Currently, only apt-based systems are supported. python3-apt needs to be installed on the system.
Configuration and Usage
The node exporter needs to be configured for textfiles using the --collector.textfile.directory option. This exporter needs to write the exported metrics into this directory.
The default path is /var/prometheus/pkg-exporter.prom, and may be changed via the PKG_EXPORTER_FILE-Environment Variable.
If the directory is not already present, it will be created by the exporter.
The command pkg_exporter provided by the package or the binary shall be executed in a appropriate interval, e.g. using cron or systemd timers.
The exporter needs to be executed with appropriate privileges, which are not necessarily root privileges.
An example configuration will be provided in this repository in the future.
apt hook
To enable monitoring for apt update calls, place the file under docs/00-pve-exporter in /etc/apt/apt.conf.d on your system.
It will place files under /tmp. To customize the filepath of the timestamp files, the the environment variables PKG_EXPORTER_APT_PRE_FILE & PKG_EXPORTER_APT_POST_FILE may be used.
You can see the success of monitoring the apt update timestamps if the following metric is 1: pkg_update_time_available 1.0
Please not that the presence of an timestamp does not mean that all repositories were updated without issues.
Alerting
Example alerting rules will be provided in the future.
Roadmap
- Support for other pkg managers
- Deployment as dpkg-Packet
Metadata
Release files for pkg-exporter 0.2.8.dev166
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pkg_exporter-0.2.8.dev166.tar.gz | 49.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pkg_exporter-0.2.8.dev166-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.3 kB
Release files / pkg_exporter-0.2.8.dev166.tar.gz
| Download URL | pkg_exporter-0.2.8.dev166.tar.gz |
|---|---|
| Size | 49.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fe7a47f9fe0f2fce3f4f6d63d3fb75376bc4261e2ec25c613fcaea0957aca14
|
|
BLAKE2b-256 checksum How to use checksums |
d2acf2c7ebac10263daa5720eae3d269a8c10a86b0026e4cbd31eb8d8e2c8efa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.24.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pkg_exporter-0.2.8.dev166-py3-none-any.whl
| Download URL | pkg_exporter-0.2.8.dev166-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92f20e80dc57ac8a35ada6bf4164d45568066d12bd9e6a33a5aa1400d634c2ec
|
|
BLAKE2b-256 checksum How to use checksums |
cc825c1425e73f02e23d873f9d4ec3d49adfaef39eb8d697148c27412c906e9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.24.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pkg-exporter 0.2.8.dev166
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.