What you’ll see
Pi-hole
Whether ad blocking is on is in Details, with a note from Pi-hole when there is one, which opens Servers. The health card turns orange while Pi-hole has a note. A pause doesn’t count as a problem. The page opens with the queries and blocked queries in the last 24 hours, with how many clients are active beside the query rate. In the corner of Last 24 hours is a Pause menu (5 minutes, 30 minutes, 1 hour or 8 hours), or Resume blocking while it’s paused. Below them are allowed and blocked queries for each of the last 12 complete hours, and the most blocked and most allowed domains. Explore opens the other four pages and Pi-hole’s own web interface.
Queries
The query rate and the blocked count, then the latest queries in three tabs: blocked, all, and blocked for this Mac. Each row shows the domain, the client and how it was answered, and can be copied.
Clients
How many clients are active and which is busiest, the top clients’ allowed and blocked queries as a flow, each one’s share blocked, and the devices Pi-hole has seen on the network.
Local DNS
Your local DNS records: the names with their addresses, and the aliases (CNAME records).
Servers
Where answers came from (cache, blocklist or upstream), how fast each upstream server answers, and any notes from Pi-hole. In the corner of Upstream response is an Upstream DNS menu, titled with the preset Pi-hole uses now (Cloudflare, Quad9 or Google), and a pencil for up to three servers of your own, such as 127.0.0.1#5335 for Unbound. Its form opens on the servers Pi-hole uses now. Either one replaces Pi-hole’s whole list of upstream servers. Closed sections hold your blocklists with the domains each gives, and the host: versions, uptime, CPU, memory and the upstreams configured.
Status
- Watches ad blocking and Pi-hole’s notes.
- Orange while Pi-hole has a note.
- Pausing blocking never counts as a problem.
- Notifies you when it turns orange or red.
How it connects
Every page signs in to Pi-hole with the same app password, and one session serves all five. The requests go from your Mac straight to your Pi-hole: nothing passes through Legato’s servers, and the password is sent only to the Pi-hole’s address.
Requests it makes on its own 21
- POST
/api/authSigns in with the app password. Pi-hole answers with a session ID, which Legato sends as the
X-FTL-SIDheader and reuses.DELETE /api/authreleases it when Legato signs out.All fiveWhen a session is needed
- GET
/api/dns/blockingWhether blocking is on, and how long a pause has left.
Pi-holeEvery minute
- GET
/api/stats/summaryQueries, blocked queries, the rate, active clients and the blocklist’s size.
Pi-hole, Queries, Clients, ServersEvery minute; every 15 minutes on Servers
- GET
/api/historyAllowed and blocked queries over time, grouped into hours.
Pi-holeEvery minute
- GET
/api/info/messagesNotes from Pi-hole.
Pi-hole, ServersEvery minute
- GET
/api/stats/top_domains?count=5 The most allowed domains.
Pi-holeEvery minute
- GET
/api/stats/top_domains?blocked=true &count=5 The most blocked domains.
Pi-holeEvery minute
- GET
/api/queries?length=8 The latest queries.
QueriesEvery minute
- GET
/api/queries?length=8 &upstream=blocklist The latest blocked queries.
QueriesEvery minute
- GET
/api/queries?length=8 &upstream=blocklist &client_ip=192.0.2.10 The latest blocked queries from this Mac. Put your Mac’s address in place of
192.0.2.10.QueriesEvery minute
- GET
/api/stats/top_clients?count=6 The busiest clients.
ClientsEvery minute
- GET
/api/stats/top_clients?blocked=true &count=50 Each client’s blocked queries.
ClientsEvery minute
- GET
/api/network/devices?max_devices=20 &max_addresses=1 Devices Pi-hole has seen, with an address and when each was last seen.
ClientsEvery minute
- GET
/api/config/dns/hostsYour local names and their addresses.
Local DNSEvery 15 minutes
- GET
/api/config/dns/cnameRecordsYour aliases.
Local DNSEvery 15 minutes
- GET
/api/stats/upstreamsWhere answers came from, and each upstream server’s response time.
ServersEvery minute
- GET
/api/config/dns/upstreamsThe upstream servers set now, which tick the Upstream DNS menu.
ServersEvery minute
- GET
/api/listsYour blocklists and the domains each gives.
ServersEvery 15 minutes
- GET
/api/info/versionCore, FTL, web and Docker image versions, and the latest of each.
ServersEvery 15 minutes
- GET
/api/info/systemUptime, CPU and memory.
ServersEvery 15 minutes
- GET
/api/config/dns/upstreamsThe upstream servers configured, for the Host section.
ServersEvery 15 minutes
Requests it makes when you act 2
- POST
/api/dns/blockingPause sends
{"blocking": false, "timer": 300}, with the seconds you picked; Resume sends{"blocking": true, "timer": null}.Pi-holeWhen you pick a length from Pause, or press Resume blocking
- PATCH
/api/configSends the servers you picked in
{"config": {"dns": {"upstreams": […]}}}, with three slots for a preset (Quad9 goes as["9.9.9.9", "149.112.112.112", ""]; Pi-hole drops the empty one). Pi-hole uses them at once.ServersWhen you pick from Upstream DNS, or press Save in the pencil’s form
Sources and buttons explains each part of a page.
Set it up
- Make an app password. In Pi-hole’s web interface, open Settings → Web interface / API and create an app password. Legato needs it to sign in, and it’s safer to give out than your admin password. Pi-hole lets an app password read its settings but not change them, so the Upstream DNS menu and its pencil answer with an error until you allow it (see Can I change the upstream DNS servers?). Pause, Resume and every reading work without that.
- Add the pages. Paste the prompt into your agent, or download the five pages and run
/Applications/Legato.app/Contents/Helpers/legato set pihole pihole.json, then the same forpihole-queries,pihole-clients,pihole-dnsandpihole-servers. Keep those page IDs: the overview opens the others by them, so with another ID, change the matchinglegato://page/link. Don’t replace an existing page without reading it first. - Point them at your Pi-hole. The pages use
http://pi.hole, which works when your Mac uses Pi-hole for DNS. Otherwise, change each source’surlto your Pi-hole’s address, such ashttp://192.168.1.2; Servers has two sources. The links to Pi-hole’s web interface usepi.holetoo: change them to match. The three on Queries, Local DNS and Servers open over HTTPS, as Legato opens a card’s link only over HTTPS. For HTTPS with the certificate Pi-hole makes itself, use its IP address, such ashttps://192.168.1.2, and trust the certificate once when Legato shows it. If your Pi-hole answers only over HTTP on its own port, such ashttp://192.168.1.2:8080, those three won’t open; the web interface row in the overview’s Explore list still does. - Set this Mac’s address on Queries, in place of
192.0.2.10, or remove the This Mac tab.ipconfig getifaddr en0shows the address. - Save the password in Legato’s Settings → Secrets under the name
pihole, or link it from 1Password. From a shell, the app reads it from standard input, so it stays out of your history:
/Applications/Legato.app/Contents/MacOS/Legato secret set piholeThe cards fill within a minute while Legato is running and Pi-hole is reachable. The overview is in the sidebar; the other four pages open from it. The HTTP address sends credentials without transport encryption: use it only on a trusted local network, and prefer HTTPS when it’s set up.
Prompt for your agent
Add 5 Legato pages for Pi-hole, starting from https://legatobar.com/examples/pihole.json, https://legatobar.com/examples/pihole-queries.json, https://legatobar.com/examples/pihole-clients.json, https://legatobar.com/examples/pihole-dns.json, https://legatobar.com/examples/pihole-servers.json. Use the page IDs pihole, pihole-queries, pihole-clients, pihole-dns, pihole-servers if they’re free: the pages link to each other by those IDs, so with any other ID, change the matching legato://page/ links.
Change only the url of each source to my Pi-hole’s address (Servers has two sources) and keep the source and secret names. On Queries, replace 192.0.2.10 in the This Mac request with this Mac’s address on my network (ipconfig getifaddr en0), or remove that tab. I’ll save the app password as pihole in Settings → Secrets myself. Don’t press Pause, Resume or the Upstream DNS menu to test it.
Use the local Legato MCP tools or /Applications/Legato.app/Contents/Helpers/legato.
Use list_pages first and choose an unused page ID. Do not overwrite an existing page. If I explicitly ask to update one, read its full body with get_page, preserve unrelated cards and settings, and use if_match with that version. On version_mismatch, read again before merging.
Ask me only for non-secret setup details that are missing. Never ask me to paste a password, token or API key into chat, page JSON or command arguments. Tell me to save it in Settings → Secrets for the service host, or link it from 1Password there.
Use the downloadable page, not the illustration’s sample data. Never invent readings. Fix any invalid_page paths and verify that the page loads. Do not press buttons that change the service or real devices to test it.Download the pages
Questions
Does it work with Pi-hole v5?
No. The pages use the REST API that Pi-hole added in version 6. Pi-hole v5’s api.php works differently, so update Pi-hole first.
Can I pause ad blocking from the menu bar?
Yes. Pick 5 minutes, 30 minutes, 1 hour or 8 hours from the Pause menu, and Pi-hole turns blocking back on when the timer ends, even if your Mac is asleep. Resume blocking turns it back on sooner. To offer other lengths, change the choices on the Pause button: each value is seconds.
Can I change the upstream DNS servers?
Yes, on Servers. Pick Cloudflare, Quad9 or Google from the Upstream DNS menu, or press the pencil and enter up to three servers of your own, with #port when it isn’t 53. Pi-hole switches straight away, and every device using it follows. The menu doesn’t ask first, and Spotlight lists each preset as a button, so a pick there changes your DNS too. If none of the servers you pick answers, Pi-hole can’t look up anything it hasn’t cached until you pick others.
Pi-hole only takes this change from an app password once its webserver.api.app_sudo setting is on. On the Pi-hole, pihole-FTL --config webserver.api.app_sudo true turns it on. That lets anything holding the app password change any of Pi-hole’s settings, so turn it on only if you want the menu. To offer other presets, change the choices on the Upstream DNS button: each value is up to three addresses separated by spaces, such as 9.9.9.9 149.112.112.112.
Is “Last 24 hours” since midnight?
No. Pi-hole keeps the last 24 hours in memory and answers from that window, so the count rolls forward with the clock rather than starting again at midnight.
How often do the pages update?
Every minute. Local DNS, and the blocklists, versions and host on Servers, every 15 minutes, since they rarely change. A press of a button fetches again at once, so the card shows the new state. After an upstream change the Host section can show the old servers for up to 15 minutes; the menu shows the new ones at once, and each server gets a bar in Upstream response once it has answered a query.
Why is the This Mac tab empty?
The tab asks Pi-hole for blocked queries from one address. If it’s still 192.0.2.10, or your Mac’s address has changed, it finds none: put the current address in the Queries page.
Where is the password kept?
In your Mac’s Keychain, or in 1Password if you link it from there. Legato sends it only to the Pi-hole’s address, and the page files hold just the name pihole, so they’re safe to share.
Do I need to keep a browser or script running?
No. Legato fetches the data itself while it’s running. To keep pages current with a script instead, see Scripts.