INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / RSS / GPG

Zabbix: notifications to Telegram

№ 9548 В разделе Sysadmin от November 15th, 2018,
В подшивках: , ,

To receive and forward messages to Telegram you need to install my Telegram-post-bot or use docker image. After this you can create script /usr/lib/zabbix/alertscripts/telegram.sh with this content:

#!/bin/bash
source /etc/profile

json_escape () {
    printf '%s' "$1" | python -c 'import json,sys; print(json.dumps(sys.stdin.read()).strip("\""))'
}

chat_id="-763495760089" # your channel id
post_title=$(json_escape "$1")
post_body=$(json_escape "$2")

echo "{\"chatID\":\"${chat_id}\",\"message\":\"${post_title}\n\n${post_body}\"}" | nc -U /run/telegram-GrapeBlessedBot.sock

You can get your account, group or channel id easily using @get_id_bot.

Now you ready to add new Media type (Administration -> Media types)

Add new media to your account

That’s all folks!

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Облачная платформа
Яндекс.Метрика

Fortune cookie: There once was a young man from France Who waited ten years for his chance; Then he muffed it...