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

发布时间:2020-07-04 02:57:40 作者:yangzhimingg
来源:网络 阅读:631


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


推荐阅读:
  1. nagios监控linux网卡流量(check_traffic.sh)
  2. 如何进行check_traffic_eth监控间隔问题的分析

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

traffic check sh

上一篇:剑指Offer之旋转数组中的最小数字(题8)

下一篇:golang 函数一 (定义、参数、返回值)

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》