Exports patch status in Prometheus-compatible format.
Project description
This queries the current patch status of the system from Zypper and exports it in a format compatible with the Prometheus Node Exporter’s textfile collector.
Usage
# HELP zypper_applicable_patches The current count of applicable patches # TYPE zypper_applicable_patches gauge zypper_applicable_patches{category="security",severity="critical"} 0 zypper_applicable_patches{category="security",severity="important"} 2 zypper_applicable_patches{category="security",severity="moderate"} 0 zypper_applicable_patches{category="security",severity="low"} 0 zypper_applicable_patches{category="security",severity="unspecified"} 0 zypper_applicable_patches{category="recommended",severity="critical"} 0 zypper_applicable_patches{category="recommended",severity="important"} 0 zypper_applicable_patches{category="recommended",severity="moderate"} 0 zypper_applicable_patches{category="recommended",severity="low"} 0 zypper_applicable_patches{category="recommended",severity="unspecified"} 0 zypper_applicable_patches{category="optional",severity="critical"} 0 zypper_applicable_patches{category="optional",severity="important"} 0 zypper_applicable_patches{category="optional",severity="moderate"} 0 zypper_applicable_patches{category="optional",severity="low"} 0 zypper_applicable_patches{category="optional",severity="unspecified"} 0 zypper_applicable_patches{category="feature",severity="critical"} 0 zypper_applicable_patches{category="feature",severity="important"} 0 zypper_applicable_patches{category="feature",severity="moderate"} 0 zypper_applicable_patches{category="feature",severity="low"} 0 zypper_applicable_patches{category="feature",severity="unspecified"} 0 zypper_applicable_patches{category="document",severity="critical"} 0 zypper_applicable_patches{category="document",severity="important"} 0 zypper_applicable_patches{category="document",severity="moderate"} 0 zypper_applicable_patches{category="document",severity="low"} 0 zypper_applicable_patches{category="document",severity="unspecified"} 0 zypper_applicable_patches{category="yast",severity="critical"} 0 zypper_applicable_patches{category="yast",severity="important"} 0 zypper_applicable_patches{category="yast",severity="moderate"} 0 zypper_applicable_patches{category="yast",severity="low"} 0 zypper_applicable_patches{category="yast",severity="unspecified"} 0 # HELP zypper_service_needs_restart Set to 1 if service requires a restart due to using no-longer-existing libraries. # TYPE zypper_service_needs_restart gauge zypper_service_needs_restart{service="nscd"} 1 zypper_service_needs_restart{service="dbus"} 1 zypper_service_needs_restart{service="cups"} 1 zypper_service_needs_restart{service="sshd"} 1 zypper_service_needs_restart{service="cron"} 1 # HELP zypper_product_end_of_life Unix timestamp on when support for the product will end. # TYPE zypper_product_end_of_life gauge zypper_product_end_of_life{product="openSUSE"} 1606694400 zypper_product_end_of_life{product="openSUSE_Addon_NonOss"} 1000000000000001 # HELP zypper_needs_rebooting Whether the system requires a reboot as core libraries or services have been updated. # TYPE zypper_needs_rebooting gauge zypper_needs_rebooting 0 # HELP zypper_scrape_success Whether the last scrape for zypper data was successful. # TYPE zypper_scrape_success gauge zypper_scrape_success 1
To get this picked up by the Prometheus Node Exporter’s textfile collector dump the output into a zypper.prom file in the textfile collector directory. You can utilise the --output-file parameter to have the exporter write directly to that file.:
> zypper-patch-status-collector --output-file /var/lib/node_exporter/collector/zypper.prom
Installation
Running this requires Python.
Install as any Python software via pip:
pip install zypper-patch-status-collector
It also requires the reboot advisory and the lifecycle plug-in for zypper to be installed:
zypper install zypper-needs-restarting zypper-lifecycle-plugin
Tests
The tests are based on pytest. Just run the following in the project root:
pytest
The default configuration requires the following Python packages to be available:
pytest
pytest-cov
pytest-mock
License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You can find a full version of the license in the LICENSE file. If not, see https://www.gnu.org/licenses/.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file zypper-patch-status-collector-0.3.1.tar.gz
.
File metadata
- Download URL: zypper-patch-status-collector-0.3.1.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb94962017c4ffd373ab9f0520f50a4b6766cfbbd323171d177cf79226131a96 |
|
MD5 | 9b4d6c0069a935d0866ae983cb37738e |
|
BLAKE2b-256 | 7060b8c15bcf52a6e743ebed0756110de56e82e80aa96aaf3b5a103402a0c3b0 |
File details
Details for the file zypper_patch_status_collector-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: zypper_patch_status_collector-0.3.1-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a8cf6c73b83c759f1e7b69a5aa781a28680daf867064b4a79b2b0204cbd0396 |
|
MD5 | 580c57579c7d1d24607bf18274d00500 |
|
BLAKE2b-256 | 7a969d98b9ab0e096c960bf0ba462e61344e6f557b533545dd6e36b1cb49a5c9 |