prometheus-xmpp-alerts icon indicating copy to clipboard operation
prometheus-xmpp-alerts copied to clipboard

support OMEMO

Open jelmer opened this issue 6 years ago • 8 comments

It would be great to support OMEMO. This depends on support in slixmpp: https://lab.louiz.org/poezio/slixmpp/merge_requests/1

jelmer avatar Oct 28 '18 21:10 jelmer

Hello, added omemo support here https://github.com/ichthyx/prometheus-xmpp-alerts I'll do a pr when I have time

ichthyx avatar Jul 01 '23 13:07 ichthyx

@ichthyx: Any news on it? :)

Neustradamus avatar Dec 24 '23 20:12 Neustradamus

It's on my todo list but for now I lack of time sorry. If you in a hurry, you can get a working version in some branch, but code was not perfect.

ichthyx avatar Feb 28 '24 16:02 ichthyx

@jelmer is master supposed to work?

I have a bunch of error like

    help=argparse.HIDDEN)
         ^^^^^^^^^^^^^^^
AttributeError: module 'argparse' has no attribute 'HIDDEN'
UnboundLocalError: cannot access local variable 'text' where it is not associated with a value

in render_alert

and recipients bugs user@domain become 'u'

btw here an example with the new omemo plugin from Syndace

https://github.com/ichthyx/prometheus-xmpp-alerts/tree/omemo

ichthyx avatar Sep 14 '24 13:09 ichthyx

Yeah, not sure how that regressed. I've fixed it up and added some tests for the argument parsing.

jelmer avatar Sep 14 '24 21:09 jelmer

btw here an example with the new omemo plugin from [Syndace] (https://github.com/Syndace/slixmpp-omemo)

https://github.com/ichthyx/prometheus-xmpp-alerts/tree/omemo

Neat!

jelmer avatar Sep 14 '24 21:09 jelmer

@jelmer with latest master if curl http://127.0.0.1:9199/test

Traceback (most recent call last):
  File "/home/user/DEV/xmppprom/venv/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/DEV/xmppprom/venv/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/DEV/xmppprom/prometheus-xmpp-alerts/prometheus_xmpp/__main__.py", line 249, in serve_test
    text, html = await render_alert(
                 ^^^^^^^^^^^^^^^^^^^
  File "/home/user/DEV/xmppprom/prometheus-xmpp-alerts/prometheus_xmpp/__main__.py", line 283, in render_alert
    return text, html
                 ^^^^
UnboundLocalError: cannot access local variable 'html' where it is not associated with a value

config is

# HTML message template as jinja2:
# html_template: |
#  <strong>{{ status.upper() }}</strong>: <i>{{ labels.alertname }}</i>
#  {% if labels.host or labels.instance %} at {{ labels.host or labels.instance }}{% endif %}
#  {% if annotations.message %}<br/>{{ annotations.message.replace("\n", "<br/>") }}{% endif %}
#  {% if annotations.description %}<br/>{{ annotations.description }}{% endif %}
#  <br/><a href="{{ generatorURL }}">Alert link</a>

# Text message template as jinja2; defaults to html_template with tags stripped.
text_template: |
 {{ status.upper() }}: *{{ labels.alertname }}* at {{ labels.host or labels.instance }}:\
 {{ annotations.message }}. {{ generatorURL }}

ichthyx avatar Sep 19 '24 14:09 ichthyx

(for those following just this issue, that last bug is now fixed in master)

jelmer avatar Sep 27 '24 19:09 jelmer