Ad Widget

Collapse

自定义监控传入命令参数执行失败【疑似BUG】

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zuhao.peng
    Junior Member
    • Jul 2020
    • 1

    #1

    自定义监控传入命令参数执行失败【疑似BUG】

    1.zabbix_agentd.conf
    UserParameter=custom.pathStrChkSum[*],/etc/zabbix/scripts/functions.sh $1 $2 $3 $4 $5 $6 $7 $8 $9

    2.function.sh
    function pathCmdChksum(){
    case $1 in
    str)
    cmd=${@:2}
    res=$(${@:2})
    echo "$res"| md5sum | awk '{print $1}'
    ;;
    esac
    }

    3.脚本执行结果
    [root@x2 scripts]# ./functions.sh pcc str crontab -l
    0580b09de901c361905977e4ba20ecda

    4.agent执行结果
    [root@x2 scripts]# zabbix_agentd -t custom.pathStrChkSum[pcc,str,crontab,-l]
    custom.pathStrChkSum[pcc,str,crontab,-l] [t|0580b09de901c361905977e4ba20ecda]

    5.server执行结果
    bash-5.0# zabbix_get -s 192.168.68.168 -k custom.pathStrChkSum[pcc,str,crontab,-l]
    68b329da9893e34099c7d8ad5cb9c940
Working...