How to monitor Apache httpd
Monitor Apache httpd with an HTTP check per virtual host, then watch busy workers against MaxRequestWorkers through mod_status, the 5xx rate in the access log, AH00161 lines in the error log and the apache2 or httpd service. Vigil's agent parses Apache's access log automatically and can read the scoreboard with a one-line command.
What can go wrong with Apache httpd
- MaxRequestWorkers reached. Every worker is busy, new connections queue and then time out. The error log says
AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting. Slow PHP or a slow upstream is the usual cause, not too few workers. - Memory exhaustion with prefork. With the prefork MPM and mod_php every worker carries a full PHP interpreter. Raising MaxRequestWorkers without the RAM to match ends in swapping or the OOM killer.
- Config error on restart. A typo in a vhost passes unnoticed until the next restart, when Apache refuses to start at all.
- Backend errors behind mod_proxy. With mod_proxy in front of an app, a dead backend returns 502/503 while static pages keep working.
The signals that matter, with alert thresholds
| Signal | Alert when | Why it matters |
|---|---|---|
| HTTP status and latency per vhost | non-2xx/3xx, or p95 > 1 s | What users see. |
| BusyWorkers / MaxRequestWorkers | ≥ 80% for 5 min | Queueing starts at 100%. |
| AH00161 in the error log | any | Requests are being queued. |
| 5xx share of requests | > 5% over at least 20 requests | App or backend errors. |
| Memory used | ≥ 90% | Prefork workers outgrowing RAM. |
| apache2 / httpd service | not active | Down. |
Thresholds are starting points. Tune them after a week of data: an alert nobody acts on should be raised or removed.
How to check Apache httpd by hand
sudo apachectl configtest sudo apachectl -S
curl -s 'http://127.0.0.1/server-status?auto' | grep -E 'BusyWorkers|IdleWorkers|ReqPerSec'
sudo grep AH00161 /var/log/apache2/error.log | tail # RHEL: /var/log/httpd/error_log
apachectl -V | grep -i mpm
How to watch Apache httpd with Vigil
- In New monitor add an Uptime monitor per virtual host (SSL expiry included), or an API check with a
containsassertion when a page can return 200 with an error inside. - Add the host under Servers and run the one-line installer it shows (
curl -fsSL https://puzaricloud.in/install-server-agent.sh | sh -s -- --token <token>). The agent is one Python file with no dependencies; CPU, memory, disk, inode and load rules start working with the first report. Apache access logs at/var/log/apache2/access.logand/var/log/httpd/access_logare parsed automatically for the per-endpoint 5xx and p95 rules. - Add the scoreboard command and AH00161 watch below, with limits such as
apache_busy = 120(80% of MaxRequestWorkers 150) andlog:apache_maxworkers = 1. - Add
apache2(Debian/Ubuntu) orhttpd(RHEL) to the systemd services to watch.
{
"commands": {
"apache_busy": "curl -s 'http://127.0.0.1/server-status?auto' | awk '/^BusyWorkers/ {print $2}'"
},
"log_watch": [
{"name": "apache_maxworkers", "path": "/var/log/apache2/error.log", "pattern": "AH00161"}
]
}
Every alert goes to the channels you pick: email, Slack, Telegram, Discord, Microsoft Teams, Pushover, webhooks or on-call paging. Failures are confirmed by a second check before anyone is woken up.
Apache httpd monitoring FAQ
Should I just raise MaxRequestWorkers?
Only if there is RAM for it. Measure the average resident size of a worker (ps -ylC apache2) and divide free memory by it. If workers are busy because the app is slow, more workers just queue the same slow work.
How do I enable mod_status safely?
Load mod_status, set ExtendedStatus On, and restrict the location to localhost with Require local. The agent reads it from 127.0.0.1.
Does this work with WordPress on Apache?
Yes. Add a keyword monitor for text that only appears when the page renders fully, so a "database connection error" page that returns 200 still alerts.