zabbix下實現MSN機器人報警
zabbix下實現MSN機器人報警的具體步驟如下!
首先下載phpmsnclass_1.9z,下載地址為:http://code.google.com/p/phpmsnclass/downloads/list
使用如下方法進行安裝
1. Create some folders like:
mkdir /var/spool/msnbot
mkdir /var/spool/msnbot/log
mkdir /var/spool/msnbot/spool
2. Change the attribute for spool folder:
chmod 777 /var/spool/msnbot/spool
chmod o+t /var/spool/msnbot/spool
3. Put msnbot.php, config.php and msn.class.php to /var/spool/msnbot/, and make msnbot.php executable:
chmod +x /var/spool/msnbot/msnbot.php
4. change the setting in config.php
5. Use msnbot.sh as your startup script to execute msnbot after system boot.
6. Change processMsg function in msnbot.php to do whatever you want.
7. If you need to send message to someone, just create a file under /var/spool/msnbot/spool, the filename like ‘*.msn’,
and the format like test.msn, first line is TO: email1,email2, and the other lines is the message.
After create the file, just change the attribute to 0666, then msnbot will try to send it.
NOTICE: file encoding should be UTF-8 if included non-English word.
#p#
注:完成上述安裝后,一定要記得設置config.php,我的設置如下:
1.進入zabbix的WEB管理頁面,在’管理’—’告警方式類型’,新建一個告警方式類型,描述欄填寫’MSN’,類型欄選擇’腳本’,Script name欄填寫’sendmsn.php’.單擊保存按鈕.
2.進入zabbix的WEB管理頁面,在’管理’—’用戶’,選擇一個用戶,設置告警方式為’MSN’,在send to欄中設置接收報警的msn帳號,點擊保存.
3.創建相應的動作,當觸發事件后,發送報警到相應的zabbix用戶.
4.登錄您的linux監控服務器,進入到zabbix的安裝目錄下的bin目錄下.新建一個sendmsn.php文件,編寫調用phpmsnclass功能發送msn報警的程序.
5.最后,在監控服務器上使用命令登錄MSN,OK,全部完成,趕緊去測試一下吧
1[root@localhost ~]# sh /var/spool/msnbot/msnbot.sh start
安裝上面的方法,我們可以在zabbix下實現MSN機器人報警!希望對你們有用!
【編輯推薦】