Technical summary
This project turns /var/log/chkservd.log into actionable operational output. It aggregates checks across critical services (httpd, mysql, exim, named, imap, etc.), classifies status by check cycle, and reduces triage time on high-volume servers where log size often exceeds 100MB.
Technical origin and rationale
- Bash rewrite of the original
checksrvutility by Matthew Harris (HostGator, 2013). - Practical goals: remove Perl dependency, improve parsing speed, and standardize daily troubleshooting on modern Linux stacks.
- Keeps original intent (human-readable chkservd logs) while adding:
- detailed mode including healthy services, - color-coded output, - system context metrics (PID, uptime, log size), - check quantity control.
Implemented scope
- Efficient parsing of chkservd service-check blocks.
- Multi-mode execution (
default,-f,-a,-q N) for NOC/SRE workflows. - Failure-first analysis without loading the entire file in memory.
- Cron-friendly behavior for alert automation.
- cPanel/WHM-ready operation for real hosting environments.
Runtime commands
# default: recent failures (last 5 checks)
./checksrv.sh
# full mode (healthy + failed) with 2 cycles
./checksrv.sh -f -q 2
# extended scan from latest 5000 lines
./checksrv.sh -f -a
# last 10 cycles
./checksrv.sh -f -q 10
# minimal cron-friendly mode
./checksrv.sh -q 1
Cron integration example
*/5 * * * * /usr/local/bin/checksrv -q 1 || \
echo "Service failure detected on $(hostname)" | mail -s "Alert chkservd" [email protected]
Delivered operational diagnostics
- Consolidated service state per
Service Checkcycle. - Clear success/failure marks:
check/socketstatus visibility to separate process-level and socket-level issues.- Fast cycle-level summary (e.g., all 24 services OK).
- [✓] healthy service - [!] failed service
Performance optimizations
- Selective parsing with
grep,awk,sed, andtail. - Streaming-oriented processing for very large logs.
- No full-file parse overhead at each run.
- Practical speed gains versus legacy Perl on 100MB+ log files.
Deployment troubleshooting
# verify log file existence and permissions
ls -lah /var/log/chkservd.log
# verify daemon status
systemctl status chkservd || service chkservd status
# ensure execution permission
chmod +x checksrv.sh
# install into PATH
mv checksrv.sh /usr/local/bin/checksrv
Stack and tooling
- Shell Script / Bash
- cPanel/WHM
- Linux
- grep / awk / sed / tail
- cron + local mail
Operational tags
- Bash
- cPanel
- Monitoring
- chkservd
Operational outcome
- Faster service-incident triage on cPanel servers.
- Standardized health-check interpretation for support/on-call operations.
- Better predictability for immediate remediation (service restart, socket validation, dependency checks).