matrix-org / matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.
https://matrix-org.github.io/matrix-hookshot/
Apache License 2.0
283 stars 68 forks source link

Create alertmanager.js #808

Closed HarHarLinks closed 1 year ago

HarHarLinks commented 1 year ago

Signed-off-by: Kim Brose 2803622+HarHarLinks@users.noreply.github.com

erebion commented 1 year ago

@HarHarLinks Could you please add some spaces and a slash for improved formatting?

image

This is how it looks.

image

This is how an alarm looks with spaces and a slash added.

HarHarLinks commented 1 year ago

@erebion thanks for the screenshots. I agree with your sentiment. However I'm not actively using this (just copy-pasted from the hookshot channel), I'm not even running Alertmanager, yet... I think it'd be best if you could suggest changes via code review?

erebion commented 1 year ago

@HarHarLinks Sure, I modified this slightly to look better so I can tell you what I did.

erebion commented 1 year ago

Screenshot_2023-08-09_19-34-16

This is how it looks like with the changes, had to purposefully crash Grafana, lol

HarHarLinks commented 1 year ago

I refactored @erebion's suggestions slightly, and kept to a bit more compact message. please resolve the review threads if you're happy with that?

Looks like: image

Fallback looks something like: image

erebion commented 1 year ago

I'm happy, will give @erebion a bit of time to respond.

Looks okay, though I'd be a bit happier with an additional line break after [WARNING - FIRING] and before the source and silence link for improved readability and accessibilty.

Many people struggle to read such messages if they are a wall of text and have a much easier time if there's a line break.

Also, I think it looks a bit better.

HarHarLinks commented 1 year ago
"formatted_body": "<p><font color='green'><b>[RESOLVED]</b></font></p><p><b>HostSystemdServiceCrashed</b>: SystemD service crashed<br/>  VALUE = 1<br/>  LABELS: map[__name__:node_systemd_unit_state instance:localhost:9100 job:host_node_exporter name:grafana.service state:failed type:simple]</p><p><a href=\"http://erebion-matrix:9090/graph?g0.expr=node_systemd_unit_state%7Bstate%3D%22failed%22%7D+%3D%3D+1&g0.tab=1\">source</a> | <a href=\"http://localhost:9093#silences/new?filter={alertname%3D%22HostSystemdServiceCrashed%22,instance%3D%22localhost%3A9100%22,job%3D%22host_node_exporter%22,name%3D%22grafana.service%22,severity%3D%22warning%22,state%3D%22failed%22,type%3D%22simple%22}\">silence</a></p>"

looks like image

could someone who is actually running this please test if my replaceAll works properly?