make json zabbix ready

This commit is contained in:
2026-03-31 22:00:16 +02:00
parent 4e695e2594
commit 5f682bc1a0
+3 -3
View File
@@ -16,11 +16,11 @@ for datastore in $(echo "${datastores}" |jq --raw-output '.data[].store'); do
for namespace in $(echo "${namespaces}" |jq --raw-output '.data[].ns'); do for namespace in $(echo "${namespaces}" |jq --raw-output '.data[].ns'); do
backups=$(wget --header="Authorization: PBSAPIToken=${TOKENID}:${TOKENSECRET}" --content-on-error -q -O - "https://${HOST}:${PORT}/api2/json/admin/datastore/${datastore}/snapshots?ns=${namespace}") backups=$(wget --header="Authorization: PBSAPIToken=${TOKENID}:${TOKENSECRET}" --content-on-error -q -O - "https://${HOST}:${PORT}/api2/json/admin/datastore/${datastore}/snapshots?ns=${namespace}")
backups_json=$(echo "${backups}" |jq '.data') backups_json=$(echo "${backups}" |jq '.data')
ret_namespaces="${ret_namespaces}{\"${namespace}\":{\"backups\":${backups_json}}}," ret_namespaces="${ret_namespaces}{\"${namespace}\":${backups_json}},"
done done
ret_datastores="${ret_datastores}{\"${datastore}\":{\"namespaces\":[${ret_namespaces::-1}]}}," ret_datastores="${ret_datastores}{\"${datastore}\":[${ret_namespaces::-1}]},"
done done
ret="{\"datastores\":[${ret_datastores::-1}]}" ret="[${ret_datastores::-1}]"
echo $ret echo $ret