a Python client to easily query, register and delete targets with Prometheus Registration.
pip install promregapi
from promregapi import PromRegApi
hostname = "hostname of your Prometheus Registration Server"
api_token = "secret"
promreg = PromRegApi(hostname, api_token)
Parameter | Type | Description |
---|---|---|
protocol |
string |
http or https (default http) |
port |
int |
(default 12321) |
basepath |
string |
uri prefix for targets. (default targets/) |
comment |
string |
comment (default "added by promregapi") |
promreg.get(uri="")
Parameter | Type | Description |
---|---|---|
uri |
string |
hostname or ip and port of target. Returns all targets if called without parameter |
promreg.register(target, comment=None, labels=None)
Parameter | Type | Description |
---|---|---|
target |
string |
the hostname or ip and port of target |
comment |
string |
comment describing this target |
labels |
object |
prometheus labels |
promreg.delete(target)
Parameter | Type | Description |
---|---|---|
target |
string |
the hostname or ip and port of target |
promreg.update(target, comment=None, labels=None)
Parameter | Type | Description |
---|---|---|
target |
string |
the hostname or ip and port of target |
comment |
string |
comment describing this target |
labels |
object |
prometheus labels |