18 lines
508 B
Python
18 lines
508 B
Python
from prometheus_client import CollectorRegistry, Gauge, push_to_gateway
|
|
|
|
# Config
|
|
PUSHGATEWAY_URL = "https://pushgateway.cato447.de"
|
|
JOB_NAME = "test_push"
|
|
|
|
# Create a new registry for the job
|
|
registry = CollectorRegistry()
|
|
test_metric = Gauge('test_metric_value', 'Just a test metric', registry=registry)
|
|
|
|
# Set the metric value (e.g., random or fixed)
|
|
test_metric.set(42)
|
|
|
|
# Push to the gateway
|
|
push_to_gateway(PUSHGATEWAY_URL, job=JOB_NAME, registry=registry)
|
|
print("Pushed test metric to Pushgateway.")
|
|
|