zabbix-agent监控多核CPU

#!/bin/bash

diskarray=(`cat /proc/cpuinfo | grep "process"|awk -F: '{print $2}'`)

length=${#diskarray[@]}

printf "{\n"

printf  '\t'"\"data\":["

for ((i=0;i<$length;i++))

do

        printf '\n\t\t{'

        printf "\"{#CPU_NUM}\":\"${diskarray[$i]}\"}"

        if [ $i -lt $[$length-1] ];then

                printf ','

        fi

done

printf  "\n\t]\n"

printf "}\n"


你可能感兴趣的:(cpu,多核,zabbix)