Pi-hole SNMP script

Helllo. I’m trying to setup the pi-hole app script and I amrunning into a small issue, which maybe an issue with the script itself but I thought it would be best to start here.The issue is when you run the script it spits out the error below:

jq: error (at :0): Cannot index array with string “domains_being_blocked”

I’ve ran the scripts debug and posted it’s output below, The only thing that stand out to me is the URL_QUERY_Type not being set. I’ve installed the script as per the doctumention. Downloaded the scrtip, moved it to SNMP with executable bit enable and updated snmpd.conf. I’m assuming the error is due to the script not being able to query pi-hole and thus has noting to output.

If I’m simply missing a step please let me know. I’ve also posted the start of the script just to make sure it matches what others may have and nothing odd is about it minus my Auth key of course though wtih that said it should be what is posted to GIT-HUB

[ok] tr bin
[ok] jq bin
[ok] curl bin
[ok] API_URL is set
[ok] API_AUTH_KEY is set
[ok] URL_READ_ONLY is set
[ok] URL_QUERY_TYPE not set
[ok] Pi-Hole config file exists, DHCP stats will be captured if scope active
[ok] DHCP lease file exists, DHCP stats will be captured if scope active

#!/usr/bin/env bash
set -euo pipefail
IFS=$‘\n\t’

CONFIGFILE=‘/etc/snmp/pi-hole.conf’

API_AUTH_KEY=
API_URL=“localhost/admin/api.php”
URL_READ_ONLY=“?summaryRaw”
URL_QUERY_TYPE=“?getQueryTypes&auth=”
PICONFIGFILE=‘/etc/pihole/setupVars.conf’
DHCPLEASEFILE=‘/etc/pihole/dhcp.leases’

if [ -f $CONFIGFILE ]; then
# shellcheck disable=SC1090
. $CONFIGFILE
fi

update same day:

So apperently I missed this post in the issue tracket that was posted just five days ago. Covers the issue we are seeing here. It has a fix to get this running,

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.