您好,登錄后才能下訂單哦!
icinga2監控netapp、ubuntu、windows的traffic流量
注:在Grafana上單位選data rate ——kilobits/sec (顯示為b,除8為大B值)
插件下載網址: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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。