A POSIX sh + jq CLI for controlling M/Monit host monitoring state.
Executable command: mmonitctl
- Stop all hosts:
stop-all(status=2= Ignored) - Start all hosts:
start-all(status=0= Active) - Interactive host selection:
stop/start - Group target by name or ID:
stop-group <group>/start-group <group> - Interactive group selection (from menu)
- Alert check command:
check- Uses
GET /api/2/reports/events/list?active=1&state=1 - Exits
1when at least one active alert event exists
- Uses
- Parallel updates (
MMONIT_CONCURRENCY, default8)
- POSIX-compatible
sh curljqawk,mktemp,stty
make installDefault install path: /usr/local/bin/mmonitctl
On first run, the CLI prompts for:
- M/Monit Base URL
- Username
- Password
Saved config path:
- macOS:
~/Library/Application Support/mmonitctl/config.json - Linux:
~/.config/mmonitctl/config.json
Reconfigure:
mmonitctl config# Open menu
mmonitctl
# Stop/start all hosts
mmonitctl stop-all
mmonitctl start-all
# Select hosts to stop/start
mmonitctl stop
mmonitctl start
# Stop/start specific group (name or id)
mmonitctl stop-group web
mmonitctl start-group web
mmonitctl stop-group 94
mmonitctl start-group 94
# Check active alert events
mmonitctl check
# Invert exit code (alert=0, no-alert=1)
mmonitctl check --invert-exitCompatibility flags (accepted):
mmonitctl stop-all --yes
mmonitctl start-all --non-interactive- Stop all hosts
- Start all hosts
- Select hosts to stop
- Select hosts to start
- Select groups to stop
- Select groups to start
- Check host errors (exit status)
- Cancel
| Key | Action |
|---|---|
k / ↑ / Ctrl-P |
Move up |
j / ↓ / Ctrl-N |
Move down |
Space |
Toggle selection and move cursor to next item |
A |
Select all currently visible items |
/ |
Enter filter input mode |
Enter |
Run action with selected items (or exit filter input mode) |
Backspace |
Delete one character in filter input mode |
Esc |
Clear active filter (does not close selector) |
q |
Cancel selector |
MMONIT_BASE_URLMMONIT_USERNAMEMMONIT_PASSWORDMMONIT_CONFIG_DIRMMONIT_CONCURRENCY(default:8)NO_COLOR=1
MMONIT_BASE_URL, MMONIT_USERNAME, and MMONIT_PASSWORD override saved config.
GET /api/2/session/get(CSRF token)GET /api/2/admin/hosts/listGET /api/2/admin/hosts/get?id=<id>POST /api/2/admin/hosts/updateGET /api/2/admin/groups/listGET /api/2/reports/events/list?active=1&state=1(check)
For hosts/update, values from hosts/get are preserved and sent together with status.
make lint
make test