*: add Procfile for example setup
This add a Procfile that can be run with `goreman start`. It starts three Alertmanagers and one webhook receiver. The webhook receiver simply reflects sent messages. The send_alerts.sh script simulates a set of alerts sent by a Prometheus server to all Alertmanagers at once.
This commit is contained in:
parent
c59f39557b
commit
26b6eac6e1
|
@ -0,0 +1,5 @@
|
|||
a1: ./alertmanager -log.level=debug -storage.path=$TMPDIR/a1 -web.listen-address=:9093 -mesh.hardware-address=00:00:00:00:00:01 -mesh.nickname=a -mesh.listen-address=:8001 -config.file=examples/ha/alertmanager.yaml
|
||||
a2: ./alertmanager -log.level=debug -storage.path=$TMPDIR/a2 -web.listen-address=:9094 -mesh.hardware-address=00:00:00:00:00:02 -mesh.nickname=b -mesh.listen-address=:8002 -mesh.peer=127.0.0.1:8001 -config.file=examples/ha/alertmanager.yaml
|
||||
a3: ./alertmanager -log.level=debug -storage.path=$TMPDIR/a3 -web.listen-address=:9095 -mesh.hardware-address=00:00:00:00:00:03 -mesh.nickname=c -mesh.listen-address=:8003 -mesh.peer=127.0.0.1:8001 -config.file=examples/ha/alertmanager.yaml
|
||||
wh: ./examples/ha/webhook.py
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
alerts1='[
|
||||
{
|
||||
"labels": {
|
||||
"alertname": "DiskRunningFull",
|
||||
"dev": "sda1",
|
||||
"instance": "example1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"labels": {
|
||||
"alertname": "DiskRunningFull",
|
||||
"dev": "sda2",
|
||||
"instance": "example1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"labels": {
|
||||
"alertname": "DiskRunningFull",
|
||||
"dev": "sda1",
|
||||
"instance": "example2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"labels": {
|
||||
"alertname": "DiskRunningFull",
|
||||
"dev": "sdb2",
|
||||
"instance": "example2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"labels": {
|
||||
"alertname": "DiskRunningFull",
|
||||
"dev": "sda1",
|
||||
"instance": "example3"
|
||||
}
|
||||
}
|
||||
]'
|
||||
curl -XPOST -d"$alerts1" http://localhost:9093/api/v1/alerts
|
||||
curl -XPOST -d"$alerts1" http://localhost:9094/api/v1/alerts
|
||||
curl -XPOST -d"$alerts1" http://localhost:9095/api/v1/alerts
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env python
|
||||
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
|
||||
# Written by Nathan Hamiel (2010)
|
||||
|
||||
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
|
||||
from optparse import OptionParser
|
||||
|
||||
class RequestHandler(BaseHTTPRequestHandler):
|
||||
|
||||
def do_GET(self):
|
||||
|
||||
request_path = self.path
|
||||
|
||||
print("\n----- Request Start ----->\n")
|
||||
print(request_path)
|
||||
print(self.headers)
|
||||
print("<----- Request End -----\n")
|
||||
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
|
||||
def do_POST(self):
|
||||
|
||||
request_path = self.path
|
||||
|
||||
print("\n----- Request Start ----->\n")
|
||||
print(request_path)
|
||||
|
||||
request_headers = self.headers
|
||||
content_length = request_headers.getheaders('content-length')
|
||||
length = int(content_length[0]) if content_length else 0
|
||||
|
||||
print(request_headers)
|
||||
print(self.rfile.read(length))
|
||||
print("<----- Request End -----\n")
|
||||
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
|
||||
do_PUT = do_POST
|
||||
do_DELETE = do_GET
|
||||
|
||||
def main():
|
||||
port = 5001
|
||||
print('Listening on localhost:%s' % port)
|
||||
server = HTTPServer(('', port), RequestHandler)
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.usage = ("Creates an http-server that will echo out any GET or POST parameters\n"
|
||||
"Run:\n\n"
|
||||
" reflect")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
main()
|
Loading…
Reference in New Issue