A small Bash utility script to validate all installed Munin plugins on a host and capture basic diagnostics when a plugin fails. The script iterates through /etc/munin/plugins, runs each plugin with munin-run, logs success/failure, and, when failures reference systemd-run, appends recent munin-node journal entries for easier troubleshooting.
Note: This repository is intentionally minimal and contains a single script file: munin-test.sh
- Language: Bash (POSIX shell with Bash-specific features)
- Frameworks/Libraries: None
- Package manager: None
- Entry point: ./munin-test.sh
- Operating system: Linux (tested with systemd-based distros)
- Installed tools:
- bash
- munin-run (typically provided by munin-node package)
- journalctl (from systemd; used only for additional diagnostics)
- tee, grep, date (coreutils)
- Access/permissions:
- Read access to /etc/munin/plugins (default Munin plugin symlink directory)
- Ability to execute munin-run for each plugin
- Write access to /var/log/munin/plugin_test.log (default log path)
- journalctl access for the munin-node unit (usually requires root or membership in the systemd-journal group)
If your environment differs (custom plugin directory, different log path, or a non-systemd init system), you may need to adjust the script or run it with appropriate privileges.
-
Clone or copy this repository onto the target machine where Munin plugins are installed.
wget https://raw.githubusercontent.com/janu-software/munin-test/refs/heads/master/munin-test.sh -O munin-test.sh -
Ensure the script is executable:
chmod +x munin-test.sh -
Consider running as root (sudo) so that:
- munin-run can access all plugins as needed
- The script can write to /var/log/munin/plugin_test.log
- journalctl can read the munin-node logs
Run the script from the repository directory:
./munin-test.sh
What it does:
- Logs start/end timestamps
- Iterates all entries in /etc/munin/plugins
- For each plugin NAME, invokes: munin-run NAME
- On success (exit code 0): prints and logs a ✅ NAME OK line
- On failure (non-zero exit): prints/logs ❌ NAME FAILED and the command output
- If the failure output mentions systemd-run, the script appends the last 10 journal lines for the munin-node unit to the log for context
Where the log goes:
- Default log file: /var/log/munin/plugin_test.log
Sample output snippet:
=== Munin plugin test started at 2025-10-22 13:02 ===
--- Testing plugin: cpu ---
✅ cpu OK
--- Testing plugin: df ---
❌ df FAILED (exit code: 1)
...
--- systemd-run journal details ---
Oct 22 13:00:00 host munin-node[...]: ...
--- end of journal ---
=== Munin plugin test finished at 2025-10-22 13:05 ===
The script currently uses hard-coded defaults inside the file:
- LOGFILE="/var/log/munin/plugin_test.log"
- PLUGINDIR="/etc/munin/plugins"
Environment overrides are not implemented in the script at this time.
- TODO: Add support for overriding LOGFILE and PLUGINDIR via environment variables or CLI flags (e.g., LOGFILE=/path/to/log ./munin-test.sh).
- munin-test.sh: main and only script. No additional helper scripts.
There are no automated tests in this repository.
-
Manual verification procedure:
- Ensure munin-node and munin-run are installed; verify a couple of plugins exist in /etc/munin/plugins
- Run: sudo ./munin-test.sh
- Confirm exit messages for each plugin and check the log at /var/log/munin/plugin_test.log
- Intentionally break a plugin (or simulate failure) to see diagnostic behavior and journal excerpt collection
-
TODO: Add a simple test harness that mocks munin-run and journalctl to simulate success/failure cases without requiring system services.
Free to use and modify. No warranty. Use at your own risk.
- This utility does not modify plugin configuration; it only runs munin-run for each plugin and records outcomes.
- The presence of emojis in log output is primarily cosmetic; logs will still be readable in plain text.