From 3831ee7774ad7e4e6f191aff308c2f6ba4a1b226 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Fri, 16 Jun 2023 15:03:52 +0000 Subject: [PATCH] Tune RDS messages --- app.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index d1ec084..1f2e5bb 100644 --- a/app.py +++ b/app.py @@ -264,8 +264,14 @@ def handler(event, context): elif "Event Source" in msg and msg['Event Source'] == "db-instance": try: title = msg["Event Message"] - body = "for instance <{}|{}> - <{}|Event docs>".format( - msg["Identifier Link"], msg["Source ID"], msg["Event ID"]) + try: + name = " ({}).".format( + msg["Tags"]["aws:cloudformation:stack-name"]) + except (KeyError, IndexError): + name = "" + + body = "RDS Instance: <{}|{}>{}\n<{}|Event docs>".format( + msg["Identifier Link"], msg["Source ID"], name, msg["Event ID"]) except KeyError: msg_type = apprise.NotifyType.WARNING body = sns["Message"]