FreeBSD Apinger 介绍

0.名稱Apinger - Alarm Pinger 1.敘述Alarm Pinger(apinger)是一個透過ICMP回應來監控多種IP設備的小工具,有許多其他的工具可以達到這個目的,但是它們大部分是shell或是perl script且當持續監控的狀況之下,他們需要產生較多的process,及消耗較多的CPU資源.Alarm Pinger是一個透過C寫出的程式,所以不需要太多的CPU資源.Alarm Pinger支援IPv4及IPv6.Alarm Pinger透過設定檔設定監控的目標及其他參數.apinger需要透過root權限才可以執行(用來創造raw socket),但是,一旦apinger開始送出或是接收封包,socket就會被丟棄. 2.安裝 補充:作者有寫了*些許*的說明檔,放在/usr/ports/net/apinger/work/之下,有興趣可以看看,前提是..你還沒有進行make clean啟動檔:/usr/local/etc/rc.d/apinger.sh設定檔:/usr/lcoal/etc/apinger.conf.sample--下載apinger設定檔(apinger的設定檔,複製更名為apinger.conf) 3.設定檔只列出可能需要修改的部分:紫色表示新增;棕色表示刪除# 設定當狀況符合時,送出訊息的程式位址## Mailer to use (default: "/usr/lib/sendmail -t")#mailer "/var/qmail/bin/qmail-inject"mailer "/usr/local/sbin/sendmail -t"# 定義相關的狀況輸出檔案(若不想要輸出,則維持註解狀況即可)#status {# ## 定義輸出的檔案位址# ## File where the status information whould be written to# file "/tmp/apinger.status"## ## 定義輸出的間隔時間 預設為5分鐘.# ## Interval between file updates# ## when 0 or not set, file is written only when SIGUSR1 is received# interval 5m#}# 定義警告相關設定alarm default {# 設定將警告訊息送給誰(預設是root). ## Mailbox where alarm report should be sent mailto "root@localhost" ## 設定信件的envelope-from(通常不用變動) ## What to put in the "From: " header mailfrom "root@localhost"## 設定信件的envelope sender(通常不用變動) ## What should be the envelope sender #mailenvfrom "root@localhost"## 設定信件的標題 ## 預設是原因 對於監測目標的敘述 ***警告的名稱*** 圖例:## Subject of the mail message (default: "%r: %T(%t) *** %a ***") #mailsubject "%s %r: %a: %T"參數代表意思: %t - 監測的IP位址 ; %T - 對於監測IP位址的敘述 %a - 警告的名稱; %A - 警告的形式("down"/"loss"/"delay")%r - 發出訊息的原因("ALARM"/"alarm canceled"/"alarm canceled (config reload)") %p - 送出的偵測數 ; %P - 收到的偵測數 %l - 最近平均遺失的封包 ;%d - 最近平均的延遲狀況 %s - 目前時間; %% - 表示%這個字元 ## 將所有訊息合併送出 ## Combine all alarms that are fired in the 5s interval ## so one report is send for all of them #combine 5s ## 設定警告訊息送出的間隔及次數 ## 預設是每隔5分鐘進行偵測一次,不停重複 ## Repeat alarm actions each 5 minutes, but max 10 times (0 whould mean no limit) #repeat 5m 10 ## 但是一直重複看了很煩..送出幾次就可以了 }## 定義關於"Down"的設定,預設是30秒沒有回應視為*沒有回應*## This alarm will be fired when target doesn"t respond for 30 seconds.alarm down "down" { time 30s}## 定義關於"Delay"(延遲)警告的設定## 當延遲超過200微秒時,會發出相關警告.延遲低於100微秒時,警告會取消## 題外話:當您覺得系統一直不停的送給你delay及cancel訊息,不妨調整一下## This alarm will be fired when responses are delayed more than 200ms## it will be canceled, when the delay drops below 100msalarm delay "delay" { delay_low 100ms delay_high 200ms}## 定義關於封包遺失(loss)的設定,當封包遺失超過20%時發出,低於10%時,警告取消## 題外話:當您覺得系統一直不停的送給你delay及cancel訊息,不妨調整一下## This alarm will be fired when packet loss goes over 20%## it will be canceled, when the loss drops below 10%alarm loss "loss" {percent_low 10percent_high 20}## 定義預設偵測值.## These parameters can be overriden in a specific target configurationtarget default { ## 定義送出偵測的時間間隔(預設是一秒) ## How often the probe should be sentinterval 1s## 定義有多少回應被用來評估平均的延遲值 ## How many replIEs should be used to compute average delay## for controlling "delay" alarms avg_delay_samples 10## 定義有多少偵測被用來評估平均的封包遺失值 ## How many probes should be used to compute average loss avg_loss_samples 50 ## 定義在遺失多少封包之後視為全部封包遺失(loss) ## The delay (in samples) after which loss is computed ## without this delays larger than interval would be treated as loss avg_loss_delay_samples 20 ## 定義對偵測目標要進行的測試 ## Names of the alarms that may be generated for the target alarms "down","delay","loss" ## (關於RRD繪圖的部分,目前不加以說明) ## Location of the RRD #rrd file "/tmp/apinger-%t.rrd" }## 定義要偵測的目標## 語法: target {

推荐阅读