Comparison

mod_pubsub_alertmanager/mod_pubsub_alertmanager.lua @ 4627:adda872fa9e1

mod_pubsub_alertmanager: Include status booleans in template input For easier conditionals, e.g. {firing&oh no} or {resolved&okay then}
author Kim Alvefur <zash@zash.se>
date Sun, 18 Jul 2021 00:21:35 +0200
parent 4626:285efde5e8a5
child 5485:67190744b1eb
comparison
equal deleted inserted replaced
4626:285efde5e8a5 4627:adda872fa9e1
77 module:hook("pubsub-summary/urn:uuid:e3bec775-c607-4e9b-9a3f-94de1316d861:v4", function(event) 77 module:hook("pubsub-summary/urn:uuid:e3bec775-c607-4e9b-9a3f-94de1316d861:v4", function(event)
78 local payload = event.payload; 78 local payload = event.payload;
79 79
80 local data = { 80 local data = {
81 status = payload.attr.status, 81 status = payload.attr.status,
82 firing = "firing" == payload.attr.status,
83 resolved = "resolved" == payload.attr.status,
82 annotations = {}, 84 annotations = {},
83 labels = {}, 85 labels = {},
84 endsAt = payload:find("ends/@at"), 86 endsAt = payload:find("ends/@at"),
85 startsAt = payload:find("starts/@at"), 87 startsAt = payload:find("starts/@at"),
86 }; 88 };