prometheus-salt-exporter
Prometheus Exporter for Salt highstate metrics run from the Salt master. The exporter must have permissions to execute commands locally.
Note: Python 2 is not supported. Instead use Python 3.8 or higher.
Inspired by BonnierNews/saltstack_exporter
Prerequisites
Install salt
Be on the salt master node
Installation
pip install prometheus-salt-exporter
Configuration and Usage
usage: prometheus_salt_exporter [-h] [--listen-addr LISTEN_ADDR] [--listen-port LISTEN_PORT] [--highstate-interval HIGHSTATE_INTERVAL] [--wait-on-error-interval WAIT_ON_ERROR_INTERVAL]
[--batch-size BATCH_SIZE] [--salt-target SALT_TARGET] [--log-level LOG_LEVEL]
options:
-h, --help show this help message and exit
--listen-addr LISTEN_ADDR
Address to bind to. IPv4 and IPv6 addresses can be specified. (default: ::)
--listen-port LISTEN_PORT
Port to bind to (default: 9175)
--highstate-interval HIGHSTATE_INTERVAL
Seconds between each highstate test run (default: 300)
--wait-on-error-interval WAIT_ON_ERROR_INTERVAL
Seconds to wait when an error occurs (e.g. salt-master not responding in time) (default: 300)
--batch-size BATCH_SIZE
Batch size to use in salt (default: 10)
--batch-wait BATCH_WAIT
Seconds to wait after a minion returns, before sending the command to a new minion (default: 10)
--salt-target SALT_TARGET
Salt target to be used (default: *)
--log-level LOG_LEVEL
log level (default: 30)
Metrics
Currently, the exporter exposes metrics for highstate conformity only:
Metric |
Description |
|---|---|
saltstack_states_total
|
Number of states which apply to the minion
in highstate
|
saltstack_nonhigh_states
|
Number of states which would change on
state.highstate
|
saltstack_error_states
|
Number of states which returns an error on
highstate dry-run
|
saltstack_highstate_error |
Error in trying to apply highstate |
saltstack_last_highstate
|
Timestamp of the last highstate test run
|
Output
# HELP saltstack_last_highstate_total Timestamp of the last highstate test run
# TYPE saltstack_last_highstate_total counter
saltstack_last_highstate_total 1.674730426e+09
# HELP saltstack_states_total Number of states which apply to the minion in highstate
# TYPE saltstack_states_total gauge
saltstack_states_total{minion="1.minion"} 271.0
# HELP saltstack_nonhigh_states Number of states which would change on state.highstate
# TYPE saltstack_nonhigh_states gauge
saltstack_nonhigh_states{minion="1.minion"} 13.0
# HELP saltstack_error_states Number of states which returns an error on highstate dry-run
# TYPE saltstack_error_states gauge
saltstack_error_states{minion="1.minion"} 0.0
# HELP saltstack_highstate_error Error in trying to apply highstate
# TYPE saltstack_highstate_error gauge
saltstack_highstate_error{minion="1.minion"} 0.0
# HELP saltstack_states_total Number of states which apply to the minion in highstate
# TYPE saltstack_states_total gauge
saltstack_states_total{minion="2.minion"} 197.0
# HELP saltstack_nonhigh_states Number of states which would change on state.highstate
# TYPE saltstack_nonhigh_states gauge
saltstack_nonhigh_states{minion="2.minion"} 6.0
# HELP saltstack_error_states Number of states which returns an error on highstate dry-run
# TYPE saltstack_error_states gauge
saltstack_error_states{minion="2.minion"} 0.0
# HELP saltstack_highstate_error Error in trying to apply highstate
# TYPE saltstack_highstate_error gauge
saltstack_highstate_error{minion="2.minion"} 0.0
Troubleshooting
Resource issues
If you encounter resource issues (e.g. your salt-master cannot keep up with providing the highstate), please consider using a combination of --batch-wait and --batch-size by decreasing the batch size and increasing the waiting time between requests.
Metadata
Release files for prometheus-salt-exporter 0.1.4
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 | |
|---|---|---|---|---|
| prometheus-salt-exporter-0.1.4.tar.gz | 7.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prometheus_salt_exporter-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / prometheus-salt-exporter-0.1.4.tar.gz
| Download URL | prometheus-salt-exporter-0.1.4.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86d0270b87b2fd7c09a0d6c73edc9e2ee3ac0a88753ea4bdde169ddb0baa3cf7
|
|
BLAKE2b-256 checksum How to use checksums |
eacaa32b15d8f1cc10cff95b75e044f7716a959bb4a05991718c6b12370598af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
|
Release files / prometheus_salt_exporter-0.1.4-py3-none-any.whl
| Download URL | prometheus_salt_exporter-0.1.4-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5ce46bb2911c6f0596de8405cf0df8d2e275631014701c6955a57403b652b17
|
|
BLAKE2b-256 checksum How to use checksums |
342b3d79e2d4ed3395061ddb90c7c8879f8095eb077cb960872c46047139b7b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
|
Security for prometheus-salt-exporter 0.1.4
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.