Show Pi-hole’s blocking stats in your Mac menu bar

Pi-hole v6 replaced the old api.php with a new API that needs a session. This recipe logs in, reads the summary and logs out again in one command, so it never piles up sessions, and shows the share of today’s queries Pi-hole blocked.

Recipe tested October 29, 2026 with Multimeter 1.1. Source: Script.

Preview: the Pie face and two alternatives, with sample values like the ones this recipe returns.

What you need

  • Multimeter for macOS 13 or later, $19.99 once.
  • The direct download version of Multimeter from this site (the Script source isn’t in the Mac App Store version).
  • Pi-hole v6 or later.
  • An app password: in the Pi-hole web interface, Settings, Web interface / API, Configure app password. It works even with two-factor login on.
  • jq for picking numbers out of JSON. It comes with macOS 15 and later; on macOS 13 or 14 run brew install jq.

Set it up

  1. Save the app password in your login Keychain, so it never sits in the command or a file. Run this in Terminal; it asks for the value and hides what you type.
    Terminal (once)
    security add-generic-password -U -a "$USER" -s pihole -w
  2. Run the command in Terminal, replacing http://pi.hole with your Pi-hole’s address if that name doesn’t resolve:
    Command
    B=http://pi.hole; P=$(security find-generic-password -s pihole -w); SID=$(curl -s -m 3 -X POST $B/api/auth -d "{\"password\":\"$P\"}" | jq -r .session.sid); curl -s -m 3 -H "X-FTL-SID: $SID" $B/api/stats/summary | jq '.queries.percent_blocked * 10 | round / 10'; curl -s -m 3 -X DELETE -H "X-FTL-SID: $SID" $B/api/auth >/dev/null
  3. Add a Script meter with it and refresh every minute.
  4. Set the range to 0 to 100 and the unit to %. A sudden drop to 0 means blocking stopped; alerts on Low values at 5 catch that.

Multimeter settings

In Customize This Meter… (from the meter’s menu):

Settings for this meter
SettingValue
SourceScript
Commandthe three-step curl line above
Refresh every1 minute
Range0 to 100
Unit%
AlertsLow values: warning 5, critical 1
LabelPIHOLE
FacePie, Ring or Level Bar

Tested: Run on October 29, 2026 against Pi-hole v6.5 in Docker: printed 25 (percent blocked) in about a second.

Script meters need the direct download version of Multimeter from this site, which is the one on sale now. How commands run, the PATH they see and the 10 second limit are in the Script meters guide.

Limits

  • Pi-hole allows a limited number of open sessions; the last curl in the command closes the session each time, which matters at a 1 minute refresh.

Variations

Queries blocked today (count)

Change the jq filter to .queries.blocked.

Total queries today

Use .queries.total.

Domains on the blocklist

Use .gravity.domains_being_blocked.

Troubleshooting

What the meter says, why, and what to do
SymptomCauseFix
The script didn’t print a numberThe command failed or printed an error message instead.Run the exact command in Terminal. If it works there, check for tools that live outside the meter’s PATH and use their full path (which tool).
The script took longer than 10 secondsA slow network call. Multimeter stops scripts after 10 seconds.Keep the -m timeout on curl, and refresh less often.
Scripts need the version from multimeterapp.comThis copy of Multimeter came from the Mac App Store, which can’t run scripts.Use the direct download version, or run the command from cron or launchd and point a File meter at its output.
Prints nullThe login failed, so there was no session.Check the app password: run the first curl alone and look for "valid": true.
API seats exceededEarlier tries left sessions open.They expire on their own after a few minutes. Keep the final logout curl in the command.

Questions

Does it work with Pi-hole v5?

No, this recipe uses the v6 API. Pi-hole v6 is the current version; update first.

Is it safe to keep the token in the Keychain?

It is the safest place on a Mac for it: encrypted, unlocked with your login, and never written into the command, a dotfile or your shell history. The meter reads it with the security tool each time it runs.

Does this work in the Mac App Store version?

Script meters need the direct download version from multimeterapp.com, because the App Store sandbox doesn’t let apps run your commands. Web Address, File and Sent Value meters work in every version.

Related

Put it in your menu bar

$19.99 one-time. No subscription. Needs macOS 13 Ventura or later.