zabbix 服務器網口流量監控
獲取流量監控網口
[root@k8s-master01 ~]# cat /usr/local/zabbix/shell/Interface_monitor_flow.sh
#!/bin/bash
##############################################
#Author: hanye
#Email: [email protected]
#Last modified: 2021/01/18/16:14
#Filename: Interface_monitor_flow.sh
#Revision: 0.1
#Description:
#crontab: * * * * * Interface_monitor_flow.sh
#Website: www.1fangxin.net
#License: GPL
##############################################
interface=($(ls /sys/class/net|grep -vE "lo|br*|docker*"))
printf '{\n'
printf '\t"data":[\n'
for((i=0;i<${#interface[@]};++i))
{
num=$(echo $((${#interface[@]}-1)))
if [ "$i" != ${num} ];
then
printf "\t\t{ \n"
printf "\t\t\t\"{#INTERFACE}\":\"${interface[$i]}\"},\n"
else
printf "\t\t{ \n"
printf "\t\t\t\"{#INTERFACE}\":\"${interface[$num]}\"}]}\n"
fi
}
zabbbix_agented.conf配置添加
#網口流量監控
UserParameter=interface.discovery,/usr/local/zabbix/shell/Interface_monitor_flow.sh
模板文件
鏈接:https://pan.baidu.com/s/1tMdRXIUJjXRUdqYMjsQGEQ
提取碼:rxlo
導入模板 在主機裏面添加 監控模板