I read that using LLD i can return multiple values
this is my custom script:
script output:
Job "aa" failed
I have another same script which monitors another job (different parameter), how to avoid creating multiple keys and triggers ?
I read i need to create item prototype,but i'm confused what should be specified in Userparameters, what name i should specify for key and what changes in script should be specified ?
this is my custom script:
Code:
#!/bin/bash
curl -s -H "Accept: application/json" -X GET "http://172.30.61.82:4440/api/20/project/demo/executions?authtoken=ZP9znayUp3Ktp26uQjSQGnEfTzDvqPDA" | python -m json.tool > /tmp/1.json
jq -r '.|[.executions[] | select(.job.name != null) ] select(.job.name|contains("test")) | sort_by(.id) | reverse | .[0] | [.status, .job.name, ."date-started".date, ."date-ended".date, .job.project] | @csv' /tmp/1.json > /tmp/1.csv
sed 's/,/ /g' /tmp/1.csv>/tmp/st.txt
while read -r status name startdate enddate project; do
startdate=${startdate//\"/}
stime=$(date -d "${startdate/T/ }" +%s)
enddate=${enddate//\"/}
etime=$(date -d "${enddate/T/ }" +%s)
let elapsed=etime-stime
if [ "$status" == "\"aborted\"" ] && [ "$elapsed" -gt 300 ]; then echo $project"-"$name-"Long-Run"
elif [ "$status" == "\"aborted\"" ] && [ "$elapsed" -lt 300 ]; then echo $project"-"$name " Aborted"
elif [ "$status" == "\"failed\"" ]; then echo $project"-"$name "failed-Demo"
elif [ "$status" == "\"succeeded\"" ]; then echo $project"-"$name "success"
elif [ "$status" == "\"succeeded\"" ] && [ "$elapsed" -gt 300 ]; then echo $project"-"$name" Takes too long"
fi
done</tmp/st.txt
script output:
Job "aa" failed
I have another same script which monitors another job (different parameter), how to avoid creating multiple keys and triggers ?
I read i need to create item prototype,but i'm confused what should be specified in Userparameters, what name i should specify for key and what changes in script should be specified ?
copied script to /usr/lib/zabbix/externalscripts but don't know what jobs.list contains)
Comment