Checkpoint with prometheus
Monitoring Integration with Prometheus and Alert.
Introduction
1: Installing Dependencies
pip install requests prometheus_clientStep 1.1: Create the Monitoring Script
import requests
from prometheus_client import start_http_server, Gauge
import time
missing_signers_gauge = Gauge('missing_signers', 'Number of missing signers')
target_signer = "<YOUR-SIGNER>"
target_id = "<YOUR-IDVALIDATOR>"
def fetch_missing_signers():
url = 'https://monitor.vn.stakepool.dev.br/missing_signers'
try:
response = requests.get(url)
response.raise_for_status()
try:
data = response.json()
return data
except ValueError:
print(f"Error decoding JSON: Malformed response. Content: {response.text}")
return []
except requests.exceptions.HTTPError as err:
print(f"Error HTTP: {err}")
except requests.exceptions.RequestException as err:
print(f"Error request: {err}")
return []
def update_metrics():
missing_signers = fetch_missing_signers()
if isinstance(missing_signers, list):
target_found = any(
signer['signer'] == target_signer and signer['ID'] == target_id
for signer in missing_signers
)
if target_found:
missing_signers_gauge.set(1)
else:
missing_signers_gauge.set(0)
else:
print("Invalid response format. Expected a list.")
if __name__ == "__main__":
start_http_server(8000)
while True:
update_metrics()
time.sleep(60)
2: Install and Configure Prometheus
Step 2.1: Configure Prometheus to Scrape Metrics
3: Configure Prometheus Alerting Rule
Step 3.1: Update Prometheus Configuration to Include Alerts
4. Creating a New Panel
Steps:
Steps:

Last updated