PING Server 工具系統

參考網站http://www.ichiayi.com/wiki/opensource/opensvn/pingserver

  • 說明 : 設定一份 server IP 清單, PING Server 工具系統會自動依據設定參數去 ping 這清單內的 IP, 並將 ping 完每個 IP的結果產生一個統計圖,若持續在 x 分鐘內 ping 該 IP 沒有回應, 將會發出通知 sysadmin 的 e-Mail.
  • 設定參數檔內容:
    1. Server IP 清單
    2. 每次 Ping 的次數 1-59
    3. 容許 x 分鐘沒回應
    4. 告警通知 e-Mail
  • 原則是採用 crontab 每 5 分鐘來執行監控程式一次
b51b2bdaf9e85b03e2ada9717b2f14bf.media.400x307
PING Server 程式運作概念圖

安裝程序

先裝好svn程式即可下載安裝yum -y install svn

su - root
cd /opt
svn co http://svn.ichiayi.com/opensvn/opentrysoft/pingserver
cd pingserver
chmod a+x *.pl

設定程序

  • 建立設定檔 Exp. trysoft.conf.pl

    cp user.conf.pl.sample trysoft.conf.pl
    vi trysoft.conf.pl
    • 將要監控的 Server IP/Domain Name 加入 @g_arr_ping_sites 內
    • 更改寄信者的 E-Mail → $g_alert_from_email
    • 更改當發生異常時通知的 E-Mail → $g_alert_to_email
    • 將 $g_send_warning_email 設為 1 才會寄出警告信件
    • 更改當偵測到可能異常時警告的 E-Mail → $g_warning_to_email
    • 預設產生的 *.html 的目錄是在 /opt/pingserver/webdir , 如果要修改可增加 $g_url_dir
    • 預設產生的 *.rrd 的目錄是在 /opt/pingserver/rrd , 如果要修改可增加 $g_rrd_dir
    • 預設產生的偵測紀錄 *.status/*.alert/*.warning/*.error 的目錄是在 /opt/pingserver/status , 如果要修改可增加 $g_status_dir
  • 手動執行一次確認正確性, Exp.

    /opt/pingserver/pingserver.pl /opt/pingserver/trysoft.conf.pl > /opt/pingserver/webdir/errmsg.html
  • 設定每5分鐘執行一次, Exp.

    vi /etc/crontab
    :
    */5 * * * * root /opt/pingserver/pingserver.pl /opt/pingserver/trysoft.conf.pl > /opt/pingserver/webdir/errmsg.html
    service crond restart
    

By tony

自由軟體愛好者~喜歡不斷的思考各種問題,有新的事物都會想去學習嘗試 做實驗並熱衷研究 沒有所謂頂天的技術 只有謙虛及不斷的學習 精進專業,本站主要以分享系統及網路相關知識、資源而建立。 Github http://stnet253.github.io

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料