项目作者: sykezz

项目描述 :
Simple script to send CloudMonitor alarms to Telegram from Alibaba Cloud via HTTP Callback.
高级语言: PHP
项目地址: git://github.com/sykezz/cloudmonitor-telegram.git
创建时间: 2019-09-05T08:32:33Z
项目社区:https://github.com/sykezz/cloudmonitor-telegram

开源协议:

下载


Alibaba Cloud - Cloud Monitor Notification

Send Alibaba Cloud’s Cloud Monitor notifications to Telegram.

Host on your own server:

  • Clone
  • composer install
  • Copy .env.example to .env
  • Enter your Telegram bot API key (TG_API_KEY) and chat ID (TG_CHAT_ID) into .env file
  • Add http://your-domain.com/cloudmonitor-telegram/threshold_alarm.php into the HTTP Callback field in the threshold alarm rule.
  • Add http://your-domain.com/cloudmonitor-telegram/event_alarm.php into the URL callback field in the event alarm rule. Do note that, HTTPS is not supported in this callback URL.

Host on Alibaba Cloud Function Compute

  • Clone
  • composer install
  • Create a Function on Alibaba Cloud
    • Runtime: php7.2
    • Triggers: http
    • Memory: 128 MB
  • Configure Environment Variables in your Function Properties (use Key Value for easy editing):
    | Key | Value |
    | —- | —- |
    | SIGNATURE | <random string> (use a generator) |
    | TG_API_KEY | <your Telegram Bot API key> |
    | TG_CHAT_ID | <your Telegram Chat ID> |
  • Zip and upload the code (including vendor folder) to the Function
  • Get your Function’s HTTP URL from the Triggers tab
  • Go to Cloud Monitor and create a new Alert Contact:
    • Name: Telegram
    • Webhook: <your function http url>/?signature=<your random string>
  • Set your Cloud Monitor alerts to send notification to Telegram contact.