zabbix如何使用自定义的脚本来获取数据并展示
启用配置:
[[email protected] zabbix]# pwd /etc/zabbix [[email protected] zabbix]# cat zabbix_agentd.conf |grep -i include Include=/etc/zabbix/zabbix_agentd.conf.d/ [[email protected] zabbix]# ls zabbix_agentd.conf zabbix_agentd.conf.d [[email protected] zabbix]# cat zabbix_agentd.conf.d/ecqun_disk.conf UserParameter=userdef.dev.io[*], /usr/local/bin/zbx_disk_io.sh $1 $2
对应的脚本:
[[email protected] zabbix]# cat /usr/local/bin/zbx_disk_io.sh #!/bin/bash # case $1 in tps) iostat -d -m |grep $2 |awk '{print $2}' ;; read) iostat -d -m |grep $2 |awk '{print $3}' ;; write) iostat -d -m |grep $2 |awk '{print $4}' ;; *) echo $"Usage: $0 {tps|read|wirte} {sda|sdb..}" exit 2 esac [[email protected] zabbix]# ll /usr/local/bin/zbx_disk_io.sh -rwxr-xr-x 1 zabbix zabbix 319 Mar 17 19:13 /usr/local/bin/zbx_disk_io.sh
对应的zabbix frontend配置:
转载于:https://blog.51cto.com/nosmoking/1621566