Skip to content

Teszko/promreg-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

promregapi Python client

a Python client to easily query, register and delete targets with Prometheus Registration.

Installation

pip install promregapi

Usage

Initialization

from promregapi import PromRegApi

hostname = "hostname of your Prometheus Registration Server"
api_token = "secret"

promreg = PromRegApi(hostname, api_token)

PromRegApi optional parameters

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")

Get registered targets

promreg.get(uri="")
Parameter Type Description
uri string hostname or ip and port of target. Returns all targets if called without parameter

register target

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

delete registered target

promreg.delete(target)
Parameter Type Description
target string the hostname or ip and port of target

update registered 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

About

Python Client for Prometheus Registration REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages