Monit Service Governance
Monit automatically monitors SafeSquid and restarts it if it crashes or becomes unresponsive. It also performs housekeeping tasks like log rotation and temporary file cleanup. Why you need this: Without Monit, a SafeSquid crash requires manual intervention. In production, this means downtime until someone notices and restarts the service.Prerequisites
:::note Before You Start- Linux host with systemd
- Root or sudo access
- SafeSquid installed and running
- Log storage capacity for Monit logs
Installation and Configuration
1. Install Monit
Debian/Ubuntu:2. Enable Monit Service
active and enabled.
3. Configure Monit HTTP Interface (Local Only)
Edit/etc/monit/monitrc:
4. Add SafeSquid Process and Port Checks
Create/etc/monit/conf.d/safesquid:
- Monitors SafeSquid process via PID file
- Checks port 8080 for HTTP responsiveness
- Auto-restarts if port check fails
- Alerts if SafeSquid restarts 3+ times in 5 cycles (possible persistent issue)
Running and OK.
5. Add Housekeeping Checks
Log Rotation Trigger: Create/etc/monit/conf.d/safesquid-logs:
/tmp. Adjust the path and age to match your environment to avoid deleting needed files.
:::
Reload:
6. Add Update Orchestration (Optional)
If you want Monit to trigger SafeSquid upgrades when an upgrade flag file appears: Create/etc/monit/conf.d/safesquid-upgrade:
/usr/local/bin/safesquid-upgrade script separately.
7. Reload and Validate All Checks
monit summaryshows all checksmonit statusshows all checks asRunningandOK
Verify Monit is Working
Test Auto-Restart
Simulate SafeSquid crash:View Monit Dashboard
From the SafeSquid server:http://localhost:2812
Expected: Monit dashboard showing SafeSquid status as green/running.
Troubleshooting
Still not working?
-
Check Monit configuration syntax:
Should return:
Control file syntax OK -
Check Monit logs:
-
Verify SafeSquid PID file location:
If PID file doesn’t exist, update the Monit check to use process name instead.
Source register
Next Steps
- BIND — Configure local DNS resolver
- NTP — Ensure accurate time synchronization
- Audit & Forensics — Monitor SafeSquid logs and events
- Troubleshooting — Common issues and fixes

