zabbix 监控json 格式api脚本

#!/bin/sh
 
if [ ! -n "$1" ] ;then
    echo "you have not input a word!"
elif [[ "$1" == "minThreads" || "$1" == "maxThreads" || "$1" == "queueSize" || "$1" == "currentThreads" || "$1" == "idleThreads" || "$1" == "busyThreads" ]];then  
    input=$1
    api_info=`curl -s 'http://localhost:4567/api/v1/threadPoolInfo' |sed -e  's/\([,]\)\s*/\1\n/g' -e 's/[{}]/\n/g' -e 's/[",]//g' |grep $input |awk -F: '{print $2}'`
    echo "$api_info"
else
    echo "the word you input must be minThreads/maxThreads/queueSize/currentThreads/idleThreads/busyThreads"
fi

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 🙂
  • 😯
  • 🙁
  • 🙄
  • 😛
  • 😳
  • 😮
  • emoji-mrgree
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • 😕
  • 67 queries in 0.203 seconds