zabbix下實(shí)現(xiàn)MSN機(jī)器人報(bào)警
zabbix下實(shí)現(xiàn)MSN機(jī)器人報(bào)警的具體步驟如下!
首先下載phpmsnclass_1.9z,下載地址為:http://code.google.com/p/phpmsnclass/downloads/list
使用如下方法進(jìn)行安裝
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#
注:完成上述安裝后,一定要記得設(shè)置config.php,我的設(shè)置如下:
1.進(jìn)入zabbix的WEB管理頁(yè)面,在’管理’—’告警方式類型’,新建一個(gè)告警方式類型,描述欄填寫’MSN’,類型欄選擇’腳本’,Script name欄填寫’sendmsn.php’.單擊保存按鈕.
2.進(jìn)入zabbix的WEB管理頁(yè)面,在’管理’—’用戶’,選擇一個(gè)用戶,設(shè)置告警方式為’MSN’,在send to欄中設(shè)置接收?qǐng)?bào)警的msn帳號(hào),點(diǎn)擊保存.
3.創(chuàng)建相應(yīng)的動(dòng)作,當(dāng)觸發(fā)事件后,發(fā)送報(bào)警到相應(yīng)的zabbix用戶.
4.登錄您的linux監(jiān)控服務(wù)器,進(jìn)入到zabbix的安裝目錄下的bin目錄下.新建一個(gè)sendmsn.php文件,編寫調(diào)用phpmsnclass功能發(fā)送msn報(bào)警的程序.
5.最后,在監(jiān)控服務(wù)器上使用命令登錄MSN,OK,全部完成,趕緊去測(cè)試一下吧
1[root@localhost ~]# sh /var/spool/msnbot/msnbot.sh start
安裝上面的方法,我們可以在zabbix下實(shí)現(xiàn)MSN機(jī)器人報(bào)警!希望對(duì)你們有用!
【編輯推薦】