Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix alarm mode

2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1. Email alarm

Using the mutt tool, the script:

Echo "$3" | mutt-s "$2" $1

Note: for python script, please refer to: http://strongit.github.io/2016/05/01/zabbix-email/

2. SMS alarm

Python script calls SMS API:

#-*-coding: utf-8-*-"send_sms_notify~ calls the SMS gateway API to send alarm messages." Import sysimport jsonimport requestsSMS_GATE_URL = 'SMS gateway interface' def send_sms_notify (to, params): data= {'to': to,'type':' warn_notify','params': params} headers = {'Content-Type':' application/json'} requests.post (SMS_GATE_URL, data=json.dumps (data)) Headers=headers) if _ name__ ='_ main__':if not len (sys.argv) = 4: print 'Usage: python send_sms_notify.py "phone"ip"host"msg"' sys.exit (- 1) to = sys.argv [1] params = {'ip': sys.argv [2],' host': sys.argv [2], 'msg': sys.argv [3]} send_sms_notify (to, params)

3. Wechat calls the police.

Git address: written by https://github.com/strongit/WeiXin-Private-API php, personally tested.

Python script:

Import sysimport jsonimport urllib2import requestsCorpID = "*" Secret = "key" Access_token_url = "https://**api.weixin.qq.com/*******"req_token = urllib2.Request (Access_token_url) response = urllib2.urlopen (req_token) access_token = json.load (response) ['access_token'] post_url =" https://**8api.weixin.qq.com/******"%access_ Tokendef send_wechat (msg): data = {"touser": "@ all" "toparty": "2", "totag": "," msgtype ":" text "," agentid ": 1," text ": {" content ": msg} "safe": "0"} headers = {'Connection':' keep-alive','Content-Type': 'application/json Charset=utf-8'} requests.post (post_url,data=json.dumps (data), headers=headers) if _ _ name__ = ='_ main__':if not len (sys.argv) = = 4: print "Usage: python wechat.py 'wechat_id'' title' 'context'" sys.exit (- 1) wechat = sys.argv [1] title = sys.argv [2] msg = sys.argv [3] send_wechat (msg)

4. Call the police

Haven't used it yet

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report