telegram.sh #!/bin/sh CHAT_ID="$1" TOKEN="$4" SUBJECT="$2" MESSAGE="$3" NL=" " curl --silent -X POST --retry 5 --retry-delay 0 --retry-max-time 60 --data-urlencode \ "chat_id=${CHAT_ID}" --data-urlencode "text=Subject: ${SUBJECT}${NL}${NL}${MESSAGE}" \ "https://api.telegram.org/bot${TOKEN}/sendMessage?disable_web_page_preview=true" \ | grep -q '"ok":true'zabbix media type 裡面增加一個新的
Type 選 script Script name 填 telegram.sh Script parameters {ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE} {TOKEN}User 裡面的 media 把 telegram 的 groupid 填到 send to
Reference:https://gist.github.com/KostyaEsmukov/1d49b04eaed1b8de3c8d378943fc1647
0 意見:
張貼留言