1.請安裝好Go的環境,參考上一篇open-falcon的安裝博文git
2.安裝 mail-providergithub
https://github.com/open-falcon/mail-provider
安裝方法express
cd $GOPATH/src mkdir github.com/open-falcon/ -p cd github.com/open-falcon/ git clone https://github.com/open-falcon/mail-provider.git cd mail-provider go get ./... ./control build
編譯成功以後,修改cfg.json文件相關信息,使用json
./control start
在cfg.json裏面使用的163郵箱的smtp服務,須要開啓客戶端受權碼,若是提示:發送數量超過配額,請過24小時再請求手機驗證碼bash
使用curl命令,驗證是否能發郵件,返回success的話就是成功了curl
curl http://127.0.0.1:4000/sender/mail -d "tos=你的郵箱&subject=報警測試&content=這是一封測試郵件" success
3.安裝 senderide
https://github.com/open-falcon-archive/sender
編譯和安裝測試
# set $GOPATH and $GOROOT mkdir -p $GOPATH/src/github.com/open-falcon cd $GOPATH/src/github.com/open-falcon git clone https://github.com/open-falcon/sender.git cd sender go get ./... ./control build # vi cfg.json modify configuration ./control start
將cfg.json中的配置改爲ui
"mail": "http://127.0.0.1:4000/sender/mail"
4.在open-falcon的portal的expression中配置報警表達式,以下圖url
記住配置報警接受人的組,這決定了誰的郵箱將會收到報警
5.模擬報警環境,而後將會收到郵件,同時在alarm-dashboard中也能看到報警