#!/usr/bin/env bash APPRISE_USERNAME="Naemon" APPRISE_USERICON="https://assets.immae.eu/monitoring.png" APPRISE_URLS=$(echo "$2" | sed -e "s/{username}/$APPRISE_USERNAME/g" -e "s@{image_url}@$APPRISE_USERICON@g") if [ "$SERVICESTATE" = "CRITICAL" ]; then ICON="❗" elif [ "$SERVICESTATE" = "WARNING" ]; then ICON="⚠️:" elif [ "$SERVICESTATE" = "OK" ]; then ICON="✅" elif [ "$SERVICESTATE" = "UNKNOWN" ]; then ICON="❓" elif [ "$HOSTSTATE" = "UP" ]; then ICON="✅" elif [ "$HOSTSTATE" = "DOWN" ]; then ICON="❗" elif [ "$HOSTSTATE" = "UNKNOWN" ]; then ICON="❓" elif [ "$HOSTSTATE" = "UNREACHABLE" ]; then ICON="❓" else ICON="◻" fi if [ "$1" = "host" ]; then apprise --title "${ICON} ${NOTIFICATIONTYPE} ${HOST} is ${HOSTSTATE}" --body "$HOSTOUTPUT" $APPRISE_URLS else apprise --title "${ICON} ${NOTIFICATIONTYPE} ${SERVICEDESC} on ${HOST} is ${SERVICESTATE}" --body "$SERVICEOUTPUT" $APPRISE_URLS fi