diff options
| author | Tobias Wiese <tobias@tobiaswiese.com> | 2023-09-10 18:28:48 +0200 |
|---|---|---|
| committer | Tobias Wiese <tobias@tobiaswiese.com> | 2023-09-10 18:28:48 +0200 |
| commit | 6a2eaec670dc4e427e927821eed4a64a0bfb75d5 (patch) | |
| tree | 0cade65031be0995caf8b78a2cb56343570d694c | |
| parent | f8e6874e6047ad7fabf12842d55bc055e3419b5e (diff) | |
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.
| -rwxr-xr-x | scripts/telegram-host-notification.sh | 9 | ||||
| -rwxr-xr-x | 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 |
