cPanel CheckSrv COMPLETED

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 checksrv utility 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" admin@example.com

Delivered operational diagnostics

  • Consolidated service state per Service Check cycle.
  • Clear success/failure marks:
  • - [✓] healthy service - [!] failed service

  • check/socket status visibility to separate process-level and socket-level issues.
  • Fast cycle-level summary (e.g., all 24 services OK).

Performance optimizations

  • Selective parsing with grep, awk, sed, and tail.
  • 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).

GitHub progress (issues)

Real-time panel with latest repository issues.

abertas (amostra): -- fechadas (amostra): -- base: -- ultimas issues

carregando andamento...

Real results

Bash-based operational parser for /var/log/chkservd.log, optimized for large files and fast service-failure triage on cPanel/WHM.

Architecture and organization

Execution and operations

The project follows reproducible execution flow with technical validation in production-like environments.

Screenshots

Talk about this project

Apply this implementation pattern in your environment and accelerate delivery with technical consistency.