icinga2監控netapp、ubuntu、windows的traffic流量

來源:互聯網
上載者:User

標籤:traffic   check   sh   


icinga2監控netapp、ubuntu、windows的traffic流量


外掛程式下載網址:https://github.com/cloved/check_traffic/blob/master/check_traffic.sh


# mv check_traffic.sh /usr/lib64/nagios/plugins/

# chmod +x /usr/lib64/nagios/plugins/check_traffic.sh

# cd /usr/lib64/nagios/plugins/

# cp check_traffic.sh check_traffic_in.sh

# cp check_traffic.sh check_traffic_out.sh


說明:之所以弄in和out出來,是為了後面出映像,預設該指令碼只顯示Interval指標的映像,不過沒什麼用,需在出映像後(需先有映像出來),將指令碼最後的

$Echo "$Msg" "-" The Traffic In is "$uIn"${Unit_1}${Unit_2}, Out is "$uOut"${Unit_1}${Unit_2}, Total is "$uTotal"${Unit_1}${Unit_2}. The Check Out is "$Interval"s \|In\=${uIn}${Unit_1}${Unit_2}\;${W1}\;${C1}\;0\;0 Interval\=${uOut}${Unit_1}${Unit_2}\;${W2}\;${C2}\;0\;0 Total\=${uTotal}${Unit_1}${Unit_2}\;${Wt}\;${Ct}\;0\;0 Interval\=${Interval}s\;1200\;1800\;0\;0

改為

$Echo "$Msg" "-" The Traffic In is "$uIn"${Unit_1}${Unit_2}, Out is "$uOut"${Unit_1}${Unit_2}, Total is "$uTotal"${Unit_1}${Unit_2}. The Check Out is "$Interval"s \|In\=${uIn}${Unit_1}${Unit_2}\;${W1}\;${C1}\;0\;0 Interval\=${uOut}${Unit_1}${Unit_2}\;${W2}\;${C2}\;0\;0 Total\=${uTotal}${Unit_1}${Unit_2}\;${Wt}\;${Ct}\;0\;0 In\=${uIn}${Unit_1}${Unit_2}\;1200\;1800\;0\;0


另建議對Min_Interval和Max_Interval做下調整

Min_Interval=0  (預設為30s,即隔30s才能執行第2次)

Max_Interval=5800  (預設為1800,不修改netapp會報錯)


另如不想設warning、crit等警示(在此處沒多大意義,主要是要映像,可將指令碼裡關於OK、warning、crit等if語句刪掉)


 

使用:

 

Ubuntu:

# /usr/lib64/nagios/plugins/check_traffic_in.sh -V 2c -H 10.0.0.88 -C public -N em1 -w 1,50 -c 180,200  (Ubuntu 14.04以上為em1,之前為eth0,-V是指snmp的版本)



Netapp:

# /usr/lib64/nagios/plugins/check_traffic.sh -V 2c -H 10.0.1.10 -C public -N vif1 -w 1,50 -c 180,200 -K -B  (vif1是指儲存的網卡,-K -B可不加)


Windows:

# /usr/lib64/nagios/plugins/check_traffic_in.sh -V 2c -H 172.16.0.3 -C public -I 1 -w 1,50 -c 180,200   (1是指本地串連1)




樣本(netapp,ubuntu,windows參考調整即可,eth0、本地串連2等單獨弄個services.conf項即可)

 

# vi/etc/icinga2/conf.d/templates.conf

 

object CheckCommand "nas-traffic-in" {

  import "plugin-check-command"

  command = [ PluginDir + "/check_traffic_in.sh" ]

  arguments = {

  "-H" = "$address$"

  "-C" = "$snmp$"

  "-V" = "$version$"

  "-I" = "$eth$"

  "-w" = "$warn$"

  "-c" = "$crit$"

}

}

:wq

 

# vi/etc/icinga2/conf.d/services.conf

 

apply Service "nas_traffic_in" {

  import "generic-service"

  check_command = "nas-traffic-in"

  vars.snmp="public"

  vars.eth="vif1"

  vars.version="2c"

  vars.warn="1,150"

  vars.crit="180,200"

  vars.perf = true

  assign where host.vars.os == "netapp" 

}

:wq

 


# service icinga2 restart


本文出自 “linux” 部落格,請務必保留此出處http://yangzhiming.blog.51cto.com/4849999/1877848

icinga2監控netapp、ubuntu、windows的traffic流量

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.