Bootstrap

zabbix监控客户端本地网络的延时状态

配置zabbix客户端配置文件

vim /etc/zabbix/zabbix_agentd.conf

添加  Include=/etc/zabbix/zabbix_agentd.d/

添加脚本对服务器所在网络设备通过ping来获取延时数值

 cat patent_box_ping.sh 
#!/bin/bash

#设置环境变量
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
export PATH

while getopts "c:i:" opt; do
    case $opt in
        c)
            count=$OPTARG
            ;;
        i)
            ips=$OPTARG
            ;;
        \?)
            ;;
    esac
done

tmp_fifofile="/tmp/ping.fifo"
mkfifo $tmp_fifofile
exec 6<>$tmp_fifofile
rm $tmp_fifofile

for ((i=0;i<20;i++));do
    echo
done >&6

for ip in `echo $ips |awk -F'|' '{  for(i=1;i<=NF;i++) {print $i} }'`
do
read -u 6
{
    rtt=`ping -c $count $ip |grep rtt |awk '{print $4}' |awk -F'/' '{print $2}'`
    rtt=${rtt:-'0'}
    echo  $rtt
}&
echo >&6
done

wait
exec 6>&-

 

在/etc/zabbix/zabbix_agentd.d目录下的配置文件添加

[root@z zabbix_agentd.d]# cat  weifeng.conf 

UserParameter=patent_box_ping_101,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.101 
UserParameter=patent_box_ping_102,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.102 
UserParameter=patent_box_ping_103,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.103 
UserParameter=patent_box_ping_104,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.104 
UserParameter=patent_box_ping_105,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.105 
UserParameter=patent_box_ping_106,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.106 
UserParameter=patent_box_ping_107,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.107 
UserParameter=patent_box_ping_108,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.108 
UserParameter=patent_box_ping_109,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.109 
UserParameter=patent_box_ping_110,sudo /etc/zabbix/scripts/patent_box_ping.sh -c 1 -i 10.8.8.110 

 

zabbix 客户端重新启动 zabbix-agent

[root@compute zabbix_agentd.d]# systemctl restart zabbix-agent

 

在 zabbix server 端添加 相应的item  

 

添加相应的graphs

 

配置成功后的 出图如下:

;