Path : /proc/2/root/proc/2/root/var/lib/zabbix/ |
Current File : //proc/2/root/proc/2/root/var/lib/zabbix/pdns_back_discovery.sh |
#!/bin/bash host=$1 port=$2 apikey=$3 first=1 IFS=$'\n' list=$(curl "$host:$port/api/v1/servers/localhost" --header "X-API-Key: $apikey" 2>/dev/null | jq -r '.servers[] | "\(.name)"') echo -ne "{ \"data\" : [\n"; for LINE in $list { if [ $first == 0 ]; then echo -ne ",\n"; fi first=0 echo -ne "{" echo -ne " \"{#BACKNAME}\" : \"$LINE\" "; echo -ne " }" } echo -ne " ]"; echo -ne " }\n";