Kaptain.
Telegram /
LinkedIn /
Email /
GIT /
RSS /
GPG /
Заказ печатных плат

№ 9548 В разделе
Sysadmin
от November 15th, 2018,
В подшивках: Monitoring, Telegram, Zabbix
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!
Fortune cookie: There was a young man from Boston Who rode around in an Austin. There was room for his ass And a gallon of gas, But his balls hung out and he lost 'em.
Leave a Reply