Commit 09de6c53 authored by Benjamin Graillot's avatar Benjamin Graillot

Ajout d'un webhook Prometheus

parent 8c980d4c
import json
from flask import Flask, request
import source
app = Flask(__name__)
def foo():
notif ='utf-8')
notif =
data = json.loads(notif)
push_update = app.config['push_update']
push_update(data['commonLabels']['instance'], '\x0310{alertname}\x03 \x033{instance}\x03 {job}\x03'.format(**data['commonLabels']))
for alert in data['alerts']:
push_update(alert['labels']['instance'], '\x0310{alertname}\x03 \x033{instance}\x03 {job}\x03'.format(**alert['labels']))
return "OK"
class Prometheus(source.Source):
def __init__(self):
source.Source.__init__(self, 'prometheus', '')
def loop(self, *args, **kwargs):
app.config['push_update'] = self.push_update'' , port=5000)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment