ICINGA2 Monitor traffic traffic for NetApp, Ubuntu, and Windows
Plugin Download URL: 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
Explanation: The reason why in and out, is for the back of the image, the default script only displays the image of the interval indicator, but it is not used, need to after the image (need to have an image), the final script
$Echo "$MSG" "-" the traffic in was "$uIn" ${unit_1}${unit_2}, Out was "$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
Switch
$Echo "$MSG" "-" the traffic in was "$uIn" ${unit_1}${unit_2}, Out was "$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
It is also recommended to make adjustments to Min_interval and Max_interval
Min_interval=0 (default is 30s, which is 30s to perform the 2nd time)
max_interval=5800 (default = 1800, no NetApp will error)
If you do not want to set warning, crit and other alarm (here is not much significance, mainly to the image, can be in the script about OK, warning, crit and other if statements deleted)
Use:
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 above for EM 1, previously referred to as ETH0,-V is the version of 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 refers to the stored NIC,- K-b is not added)
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 refers to local connection 1)
Example (netapp,ubuntu,windows reference adjustment can be, eth0, local connection 2, etc. to get a separate 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
This article is from the "Linux" blog, so be sure to keep this source http://yangzhiming.blog.51cto.com/4849999/1877848
ICINGA2 Monitor traffic traffic for NetApp, Ubuntu, and Windows