Zabbix-add脚本参数触发

时间:2018-04-03 22:46:11

标签: linux monitoring zabbix

我创建了一个监控rundeck Jobs状态的脚本,将rundeck添加到Zabbix,我想从rundeck服务器运行这个脚本并在Zabbix仪表板中显示状态, 这是脚本:

#!/bin/bash

 curl -s -H "Accept: application/json" -X GET "http://172.30.61.88:4440/api/20/project/demo/executions?authtoken=ZP9znayUp3Ktp26uQjSQGnEfTzDvqPDA"  | python -m json.tool > 1.json

jq -r '.|[.executions[] | select(.job.name != null)]  | sort_by(.id)  | reverse  | .[0]  | [.status, .job.name, ."date-ended".date] | @csv' 1.json > 1.csv

sed 's/,/ /g' 1.csv>st.txt
while read status name date; do
case "$status" in
"\"aborted\"")
echo -1
;;
 "\"failed\"")
echo -1 +  $name
;;
 "\"succeeded\"")
echo 0
;;
*) echo 0 + $name
esac
exit 0
done<st.txt

如何添加脚本输出参数$ name(作业名称)以触发

enter image description here

1 个答案:

答案 0 :(得分:0)

我通过在触发器名称字段

中添加{ITEM.VALUE}来解决它