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.

Updated · by PuzariCloud · commands checked against current releases

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

SignalAlert whenWhy it matters
HTTP status and latency per vhostnon-2xx/3xx, or p95 > 1 sWhat users see.
BusyWorkers / MaxRequestWorkers≥ 80% for 5 minQueueing starts at 100%.
AH00161 in the error loganyRequests are being queued.
5xx share of requests> 5% over at least 20 requestsApp or backend errors.
Memory used≥ 90%Prefork workers outgrowing RAM.
apache2 / httpd servicenot activeDown.

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

Test the config and list vhosts
sudo apachectl configtest
sudo apachectl -S
Scoreboard (mod_status, ExtendedStatus On)
curl -s 'http://127.0.0.1/server-status?auto' | grep -E 'BusyWorkers|IdleWorkers|ReqPerSec'
Worker limit hits
sudo grep AH00161 /var/log/apache2/error.log | tail   # RHEL: /var/log/httpd/error_log
Loaded MPM
apachectl -V | grep -i mpm

How to watch Apache httpd with Vigil

  1. In New monitor add an Uptime monitor per virtual host (SSL expiry included), or an API check with a contains assertion when a page can return 200 with an error inside.
  2. 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.log and /var/log/httpd/access_log are parsed automatically for the per-endpoint 5xx and p95 rules.
  3. Add the scoreboard command and AH00161 watch below, with limits such as apache_busy = 120 (80% of MaxRequestWorkers 150) and log:apache_maxworkers = 1.
  4. Add apache2 (Debian/Ubuntu) or httpd (RHEL) to the systemd services to watch.
/etc/vigil-agent.json (add to the existing keys)
{
  "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.

Vigil by PuzariCloud

Watch Apache httpd without stitching five tools together

Uptime and API checks, heartbeats, server and database metrics, traces, errors and logs in one place, with one incident and one alert when something breaks. Every feature is on every plan, including Free.