zabbix增加手機簡訊監控的注意要點

來源:互聯網
上載者:User

標籤:sys   level   監控   decode   urllib   dia   string   table   中文   

1、簡訊介面文檔:

URLhttp://xxx.com/interfaces/sendMsg.htmMethodPOSTDescription文字簡訊調用介面Request Param List
Name Identifier Type Remark
簡訊簽名 sign string 格式為 【某某平台】 中文括弧不可少
資訊內容 msg string  
手機號 phoneNumber string  
Response Param List
Name Identifier Type Remark
傳回值   string 提交失敗 {"msg":"","success":"F"} 提交成功 {"msg":"","success":"T"}

2、自訂連接埠post方式以及python指令碼:

#!/usr/bin/env python#-*- coding:utf-8 -*-#Author:lzdimport sysimport urllib.requestimport urllib.parse#請求msg = sys.argv[2]phoneNumber = sys.argv[1]data = {‘msg‘:msg,‘phoneNumber‘:phoneNumber,}data = urllib.parse.urlencode(data).encode(‘utf-8‘)resu = urllib.request.urlopen(‘http://xxx.com/interfaces/sendVoice.htm‘, data = data)#指定編碼請求#print(resu.read().decode(‘utf-8‘))a=open(‘/tmp/abc.log‘,‘a‘)a.write(sys.argv[1]+resu.read().decode(‘utf-8‘)+‘\n‘ )a.close()

3、將sms2.py拷貝到路徑/usr/lib/zabbix/alertscripts

4、設定sms2.py的許可權為chmod 777 sms2.py

5、注意sms2.py在centos一定要可以直接執行,而不是python sms2.py這種方式直接。後面加兩個參數手機號碼+內容

6、設定zabbix裡的triggers

7、設定media type,注意這裡的三個變數一定要加進去。

 

8、最後設定動作:actions

當triggers名稱為,或者安全層級為什麼的時候就觸發動作,直接傳送簡訊,選擇對應的人和動作!

zabbix增加手機簡訊監控的注意要點

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.