]>
Commit | Line | Data |
---|---|---|
1a64deeb IB |
1 | #!/usr/bin/env bash |
2 | ||
3 | APPRISE_USERNAME="Naemon" | |
4 | APPRISE_USERICON="https://assets.immae.eu/monitoring.png" | |
5 | APPRISE_URLS=$(echo "$2" | sed -e "s/{username}/$APPRISE_USERNAME/g" -e "s@{image_url}@$APPRISE_USERICON@g") | |
6 | ||
7 | if [ "$SERVICESTATE" = "CRITICAL" ]; then | |
8 | ICON="❗" | |
9 | elif [ "$SERVICESTATE" = "WARNING" ]; then | |
10 | ICON="⚠️:" | |
11 | elif [ "$SERVICESTATE" = "OK" ]; then | |
12 | ICON="✅" | |
13 | elif [ "$SERVICESTATE" = "UNKNOWN" ]; then | |
14 | ICON="❓" | |
15 | elif [ "$HOSTSTATE" = "UP" ]; then | |
16 | ICON="✅" | |
17 | elif [ "$HOSTSTATE" = "DOWN" ]; then | |
18 | ICON="❗" | |
19 | elif [ "$HOSTSTATE" = "UNKNOWN" ]; then | |
20 | ICON="❓" | |
21 | elif [ "$HOSTSTATE" = "UNREACHABLE" ]; then | |
22 | ICON="❓" | |
23 | else | |
24 | ICON="◻" | |
25 | fi | |
26 | ||
27 | if [ "$1" = "host" ]; then | |
28 | apprise --title "${ICON} ${NOTIFICATIONTYPE} ${HOST} is ${HOSTSTATE}" --body "$HOSTOUTPUT" $APPRISE_URLS | |
29 | else | |
30 | apprise --title "${ICON} ${NOTIFICATIONTYPE} ${SERVICEDESC} on ${HOST} is ${SERVICESTATE}" --body "$SERVICEOUTPUT" $APPRISE_URLS | |
31 | fi |