From 6a2eaec670dc4e427e927821eed4a64a0bfb75d5 Mon Sep 17 00:00:00 2001 From: Tobias Wiese Date: Sun, 10 Sep 2023 18:28:48 +0200 Subject: notifications: Simplify telegram message format Telegram notifications used to use the same message format as Mail notifications. This is not the most ideal format for display in the Telegram client. This changes the message in a way, that important information are in the first line for display in notifications and removes some not so important information. --- scripts/telegram-host-notification.sh | 9 ++------- scripts/telegram-service-notification.sh | 23 ++--------------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/scripts/telegram-host-notification.sh b/scripts/telegram-host-notification.sh index 5d42709..c550f5d 100755 --- a/scripts/telegram-host-notification.sh +++ b/scripts/telegram-host-notification.sh @@ -39,14 +39,9 @@ done ## Build the notification message NOTIFICATION_MESSAGE=`cat << EOF -***** Host Monitoring on $ICINGA2HOST ***** +[$HOSTSTATE] $HOSTDISPLAYNAME -$HOSTDISPLAYNAME is $HOSTSTATE! - -Info: $HOSTOUTPUT - -When: $DATE -Host: $HOSTNAME +$HOSTOUTPUT EOF ` diff --git a/scripts/telegram-service-notification.sh b/scripts/telegram-service-notification.sh index c5815ec..b0a6d61 100755 --- a/scripts/telegram-service-notification.sh +++ b/scripts/telegram-service-notification.sh @@ -1,5 +1,4 @@ #!/bin/sh -#!/bin/sh # (C) Tobias Wiese | GPLv2+ # This file is based on mail-service-notification.sh from Icinga used under GPLv2+ license # Except of function urlencode which is Copyright (C) by Brian White (brian@aljex.com) used under MIT license @@ -41,30 +40,12 @@ done ## Build the notification message NOTIFICATION_MESSAGE=`cat << EOF -***** Service Monitoring on $ICINGA2HOST ***** - -$SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE! - -Info: $SERVICEOUTPUT +[$SERVICESTATE] $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME -When: $DATE -Service: $SERVICENAME -Host: $HOSTNAME +$SERVICEOUTPUT EOF ` -## Check whether IPv4 was specified. -if [ -n "$ADDRESS" ] ; then - NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE -IPv4: $ADDRESS" -fi - -## Check whether IPv6 was specified. -if [ -n "$ADDRESS6" ] ; then - NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE -IPv6: $ADDRESS6" -fi - ## Check whether author and comment was specified. if [ -n "$COMMENT" ] ; then NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE -- cgit v1.2.3