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