Skip to content

Commit 0387a86

Browse files
authored
Merge pull request #19 from Elompenta/curl-timeout-breaking-all-other-notifies
Fix "no overall checkmk notifications anymore" if curl timeout happens
2 parents 077e4ce + 57994b0 commit 0387a86

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Edit your user and enter your Group/Chat-ID
186186

187187
## TROUBLESHOOTING
188188
For more details and troubleshooting with parameters please check:
189-
* Check_MK notification logfile: /omd/sites/{sitename}/var/log/notify.log
189+
* Check_MK notification logfile: ```tail -f /omd/sites/{sitename}/var/log/notify.log```
190190
* [Check_MK Manual > Notifications > Chapter: 11.3. A simple example](https://docs.checkmk.com/latest/en/notifications.html#H1:Real)
191191
* [[Feature-Request] Multiple Alert Profiles](https://github.com/filipnet/checkmk-telegram-notify/issues/3)
192192

check_mk_telegram-notify.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ MESSAGE+="%0AIPv4: ${NOTIFY_HOST_ADDRESS_4} %0AIPv6: ${NOTIFY_HOST_ADDRESS_6}%0A
102102
MESSAGE+="${NOTIFY_SHORTDATETIME} | ${OMD_SITE}"
103103

104104
# Send message to Telegram bot
105-
response=$(curl -S -s -q -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" -d chat_id="${CHAT_ID}" -d text="${MESSAGE}")
105+
response=$(curl -S -s -q --connect-timeout 5 -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" -d chat_id="${CHAT_ID}" -d text="${MESSAGE}")
106106
if [ $? -ne 0 ]; then
107107
echo "Not able to send Telegram message" >&2
108108
echo $response >&2
109109
exit 2
110110
else
111+
echo "Telegramm message send sucessfull" >&2
111112
exit 0
112113
fi

0 commit comments

Comments
 (0)