Skip to content

Commit

Permalink
Update Readme and Description
Browse files Browse the repository at this point in the history
  • Loading branch information
margau committed Aug 21, 2021
1 parent 3266835 commit 8795b04
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ This project provides an textfile-based exporter for apt-repositories.
At the moment, the packages installed and upgradable are exported per repository as gauge. The label set depends on the packet manager type.

```
# HELP pkg_installed Installed Packages from this package origin
# HELP pkg_installed Installed packages per origin
# TYPE pkg_installed gauge
pkg_installed{archive="stable",component="main",label="Debian",origin="Debian",site="deb.debian.org",trusted="True"} 293.0
# HELP pkg_upgradable Upgradable packages in this package origin
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="stable",component="main",label="Debian",origin="Debian",site="deb.debian.org",trusted="True"} 0.0
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
```

Expand All @@ -24,13 +30,13 @@ Feel free to contribute improvements, as well as support for non-apt based syste

## Installation

The easiest installation method is downloading the prebuilt binary from the github relase site.
The easiest installation method is downloading the prebuilt binary from the github release site.

Alternatively, the scripts and requirements in the repositoriy may be installed manually.
Alternatively, the scripts and requirements in the repository may be installed manually.

### apt-based systems

Currently, only apt-based systems are supported.
Currently, only apt-based systems are supported. `python3-apt` needs to be installed on the system.

## Configuration and Usage

Expand All @@ -39,7 +45,7 @@ The node exporter needs to be configured for textfiles using the `--collector.te
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 script `texfile.py` or the binary shall be executed in a appropriate interval, e.g. using cron or systemd timers.
The script `textfile.py` 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.
Expand Down
16 changes: 8 additions & 8 deletions src/pkgmanager/apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
class AptPkgManager:
def __init__(self):
self.metricDict = {}
self.metricDict["installed"] = {"description": "Installed packages \
per origin"}
self.metricDict["upgradable"] = {"description": "Upgradable packages \
per origin"}
self.metricDict["auto_removable"] = {"description": "Auto-removable \
packages per origin"}
self.metricDict["broken"] = {"description": "Broken packages per \
origin"}
self.metricDict["installed"] = \
{"description": "Installed packages per origin"}
self.metricDict["upgradable"] = \
{"description": "Upgradable packages per origin"}
self.metricDict["auto_removable"] = \
{"description": "Auto-removable packages per origin"}
self.metricDict["broken"] = \
{"description": "Broken packages per origin"}
self.metricsByOrigin = {}
self.cache = apt.Cache()
self.cache.open(None)
Expand Down

0 comments on commit 8795b04

Please sign in to comment.