https://github.com/mapi68/pihole-script
Scripts to customize the number of displayed queries in Pi-hole's dashboard (v5/v6)
https://github.com/mapi68/pihole-script
pi-hole raspberry-pi
Last synced: about 2 months ago
JSON representation
Scripts to customize the number of displayed queries in Pi-hole's dashboard (v5/v6)
- Host: GitHub
- URL: https://github.com/mapi68/pihole-script
- Owner: mapi68
- License: mit
- Created: 2021-11-08T05:53:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-31T05:40:09.000Z (about 1 year ago)
- Last Synced: 2025-03-31T06:27:22.513Z (about 1 year ago)
- Topics: pi-hole, raspberry-pi
- Language: Shell
- Homepage:
- Size: 276 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🛠️ Pi-hole Scripts Collection
A collection of utility scripts to extend and customize your Pi-hole installation.
Overview •
Scripts •
Install •
Usage •
Troubleshooting
---
A growing collection of Bash scripts to manage, customize, and extend Pi-hole beyond its default capabilities — including dashboard tweaks, cron job management, and live system monitoring.
---
### 📊 1. Pi-hole Query Number Modifier
Modify how many entries are displayed in the Pi-hole dashboard (Top Permitted Domains, Top Blocked Domains, Top Clients).
#### Features
| Feature | Description |
|---|---|
| 🔄 **Reset** | Restore default values (10 queries) |
| ⚡ **Optimal Mode** | Predefined values tuned for medium-sized servers |
| 🎛️ **Manual Mode** | Custom configuration from 10 to 99 queries |
| 🎨 **Color Output** | Color-coded terminal interface |
| 🖥️ **Interactive UI** | User-friendly guided setup |
#### Configuration
**Optimal Mode** — Sets Top Domains to 15 entries and Top Clients to 30 entries.

**Manual Mode** — Full control over all query number settings (10–99).

---
### ⏰ 2. Pi-hole Cron Manager
Manage Pi-hole scheduled tasks from an interactive menu. Applies, removes, and monitors cron jobs for Pi-hole — with no manual editing of cron files required.
#### Features
| Feature | Description |
|---|---|
| ✅ **Apply / Restore** | Writes the default schedule to `/etc/cron.d/pihole_custom` and restarts cron |
| 🗑️ **Remove** | Deletes the cron file with confirmation |
| 📋 **Show Log** | Displays the last 30 lines of the updateGravity log |
| ▶️ **Run Now** | Runs `updateGravity` immediately with live output |
| 🖥️ **Interactive UI** | Menu-driven with return-to-menu after each action |
#### Default Schedule
```
5 5 * * 1-6 root pihole updateGravity > /var/log/pihole_updateGravity.log
```
> **updateGravity** runs Monday through Saturday at **05:05**, with output saved to `/var/log/pihole_updateGravity.log`.

---
### 📡 3. Pi-hole Status Report
A live terminal dashboard that auto-refreshes every 10 seconds, showing a full overview of your Pi-hole instance — functionality not available natively in Pi-hole.
#### Features
| Feature | Description |
|---|---|
| 🔄 **Live Refresh** | Auto-updates every 10 seconds |
| 📦 **Versions** | Pi-hole and FTL current version |
| ⏱️ **Uptime** | System uptime at a glance |
| ⚙️ **Services** | Status of pihole-FTL and cron |
| 📊 **Queries Today** | Total queries, blocked count, block rate with visual bar |
| 🌍 **Gravity** | Number of domains in the gravity database |
| 💾 **Resources** | RAM and disk usage with visual bars |
| 🚫 **Top Blocked Domains** | Top 5 domains blocked today |
| 🖥️ **Top Clients** | Top 5 clients by query count |
#### Notes
- Uses the Pi-hole REST API (`/api/`) for all data
- Authenticates automatically via `/etc/pihole/cli_pw`
- Press `Ctrl+C` to exit cleanly

---
- Root access to your Pi-hole server
- Running Pi-hole installation
- Basic command line knowledge
---
### Option 1 — Clone with Git
```bash
git clone https://github.com/mapi68/pihole-script.git
cd pihole-script
chmod +x *.bash
```
### Option 2 — Download ZIP
```bash
wget https://github.com/mapi68/pihole-script/archive/refs/heads/master.zip
unzip master.zip
rm master.zip
cd pihole-script-master
chmod +x *.bash
```
---
### Query Number Modifier
```bash
sudo ./pihole-change-queries-number.bash
```
### Cron Manager
```bash
sudo ./pihole-cron-manager.bash
```
### Status Report
```bash
sudo ./pihole-status-report.bash
```
Press `Ctrl+C` to exit the live dashboard.
---
- The query modifier script automatically re-downloads the original `index.js` from the Pi-hole repository before applying changes
- Error messages are color-coded for easy identification
- Invalid inputs are handled gracefully with clear error messages
- The cron manager shows the current active schedule at startup before any action is taken
- The status report authenticates automatically via `/etc/pihole/cli_pw`
### Reverting Query Number Changes
Run the script again and choose to exit after the reset step — this restores the default value of 10.
### Reverting Cron Changes
Run `pihole-cron-manager.bash` and choose option **2 (Remove)** to delete the custom cron file, or option **1 (Apply)** to restore the default schedule.
---
## 📄 License
This project is licensed under the [MIT License](LICENSE).
---
## 👤 Author
- [@mapi68](https://github.com/mapi68)
If you encounter any issues or have questions, please [open an issue](https://github.com/mapi68/pihole-script/issues) on GitHub. Contributions and Pull Requests are welcome!
---
## ☕ Support
---
Made with ❤️ for the Raspberry Pi community