Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more links in root page #87

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion prometheus_xmpp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ async def serve_alert(request):
except KeyError:
recipients = [(request.app['muc_jid'], 'groupchat')]

if request.content_type != "application/json":
raise web.HTTPUnsupportedMediaType(
text="Expected Content-Type: application/json"
)

alert_counter.inc()
try:
payload = await request.json()
Expand Down Expand Up @@ -291,8 +296,22 @@ async def serve_health(request):
return web.Response(body=b"ok")


INDEX = """\
<html>
<head>
<title>prometheus-xmpp alerts</title>
</head>
<body>
See <a href="/test">/test</a>, <a href="/health">/health</a>, <a href="/alert">/alert</a> or <a href="/metrics">/metrics</a>.
</body>
</html>
"""


async def serve_root(request):
return web.Response(body="See /test, /health, /alert or /metrics")
return web.Response(
content_type="text/html",
body=INDEX)


def main():
Expand Down
Loading