Zabbix automatic discovery of hard disk scripts disk_discovery.py
[email protected] etc]$ cat disk_discovery.py#/usr/bin/pythonimport subprocessimport jsonargs= "Cat/proc/diskstats | Grep-e ' \ssd[a-z]\s|\sxvd[a-z]\s|\svd[a-z]\s ' |awk ' {print $} ' |sort|uniq 2>/dev/null ' t=subprocess. Popen (args,shell=true,stdout=subprocess. PIPE). Communicate () [0] disks=[] for disk in T.split (' \ n '): If Len (disk)! = 0:disks.append ({' {#DISK_NAME} ':d ISK}) Print json.dumps ({' Data ':d isks},indent=4,separators= (', ', ': '))
Zabbix Monitoring HDD Status script
[[Email protected] etc]$ cat disk_status.sh #/bin/sh device=$1item=$2 case $item  IN         RRQM) /usr/bin/iostat -dx |grep $device |awk ' { Print $2} ';;          WRQM) /usr/bin/iostat -dx |grep $device |awk ' {print $3} ';; rps) /usr/bin/iostat -dx |grep $device |awk ' {print $4} ‘;; wps) /usr/bin/iostat -dx |grep $device |awk ' {print $5} ‘;; rkbps) /usr/bin/iostat -dx |grep $device |awk ' {print $6} ';; wkbps) /usr/bin/iostat -dx |grep $device |awk ' {print $7} ';;      AVGRQ-SZ) /usr/bin/iostat -dx |grep $device |awk ' {print $8} ';;      AVGQU-SZ) /usr/bin/iostat -dx |grep $device |awk ' {print $9} ';; await) /usr/bin/iostat -dx |grep $device |awk ' {PRINT $10} ';;         SVCTM) /usr/bin/iostat -dx |grep $device |awk ' {print $11} ';; util) /usr/bin/iostat -dx |grep $device |awk ' {print $12} ';; Esac
Modify the Zabbix_agentd.conf file
[Email protected] etc]$ Tail-2 zabbix_agentd.confuserparameter=disk.discovery,/usr/bin/python/usr/local/zabbix/ Etc/disk_discovery.pyuserparameter=disk.status[*],/usr/local/zabbix/etc/disk_status.sh $ $2# Instructions for automatic discovery script Disk_ Discovery.py returned to Zabbix server {#DISK_NAME}$2-bit options to monitor
Monitoring TCP connection Status
[Email protected] etc]$ tail-1 Zabbix_agentd.confuserparameter=tcp[*],netstat-an |grep-c $
This article is from the "ly36843" blog, please be sure to keep this source http://ly36843.blog.51cto.com/3120113/1782408
Zabbix Monitoring HDD metrics, TCP connection status