搞定微信告警-工具篇

https://github.com/OneOaaS/weixin-alert

weixin-alert

本項目是一個企業微信消息發送的程序,可以作爲運維告警使用,支持任意可調用的運維繫統,包括Zabbix,Nagios,shell腳本

支持Zabbix的告警,使用方法見微信公衆號 http://url.cn/4A37R4z

Zabbix告警的使用方法

腳本位置:

wget https://raw.githubusercontent.com/OneOaaS/weixin-alert/master/weixin_linux_amd64
cp weixin_linux_amd64 /etc/zabbix/alertscripts/weixin
chmod 755 /etc/zabbix/alertscripts/weixin
chown zabbix:zabbix /etc/zabbix/alertscripts/weixin

腳本測試

/etc/zabbix/alertscripts/weixin --corpid=wxee***********81aa --corpsecret=Mm0mHwI8iVsjA*JUGySxOFMIlbosoVEkWIEiw --msg="您好</br>告警測試" --user=oneoaas --agentid=1000003
返回數據:
{"errcode":0,"errmsg":"ok","invaliduser":""}

查看幫助

./weixin_linux_amd64 --help
Usage of ./weixin_linux_amd64:
  -agentid string
    	agentid
  -author string
    	http://www.oneoaas.com
  -corpid string
    	corpid
  -corpsecret string
    	corpsecret
  -msg string
    	Send Message
  -user string
    	which user to send msg

支持羣組發送

Usage of weixin_linux_amd64_toparty:
  -agentid string
        agentid
  -author string
        http://www.oneoaas.com
  -corpid string
        corpid
  -corpsecret string
        corpsecret
  -msg string
        Send Message
  -toparty string
        which toparty to send msg
  -totag string
        which totag to send msg
  -user string
        which user to send msg

        其中toparty,totag,user三個參數任選其一發送即可


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章