Monitoring Apache
Metrics
The following metrics are submitted to Nixstats.
- IdleWorkers
- ReadingWorkers
- WritingWorkers
- KeepaliveWorkers
- DnsWorkers
- ClosingWorkers
- LoggingWorkers
- FinishingWorkers
- CleanupWorkers
- requests_per_second
- Total kBytes
- Total Accesses
- ServerUptimeSeconds
- BusyWorkers
- BytesPerReq
- BytesPerSec
- ConnsAsyncClosing
- ConnsAsyncKeepAlive
- ConnsAsyncWriting
- DnsWorkers
Enable status page
To enable the apache status page, add the following code to your apache (httpd.conf) configuration file.
<Location "/server-status">
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
The status page will only be available from the machine running apache.
You can test if the status page is working by running
wget -qO- http://127.0.0.1/server-status?auto
Configure the plugin
To enable the plugin edit the nixstats configuration file. This file is usually located at /etc/nixstats.ini.
Add the following settings to the end of the file.
[httpd]
enabled = yes
status_page_url = http://127.0.0.1/server-status?auto
Test to see if the plugin is working by running nixstatsagent --test httpd. It should show the following metrics:
httpd:
{
"BusyWorkers": "1",
"BytesPerReq": "1183.62",
"BytesPerSec": "20.1089",
"CleanupWorkers": 0,
"ClosingWorkers": 0,
"ConnsAsyncClosing": "0",
"ConnsAsyncKeepAlive": "0",
"ConnsAsyncWriting": "0",
"ConnsTotal": "0",
"DnsWorkers": 0,
"FinishingWorkers": 0,
"IdleWorkers": 49,
"KeepaliveWorkers": 0,
"LoggingWorkers": 0,
"ParentServerConfigGeneration": "2",
"ParentServerMPMGeneration": "1",
"ReadingWorkers": 0,
"ServerMPM": "event",
"ServerUptimeSeconds": "69102",
"ServerVersion": "Apache/2.4.18 (Ubuntu)",
"Total Accesses": "1174",
"Total kBytes": "1357",
"Uptime": "69102",
"WritingWorkers": 1,
"requests_per_second": 0
}
Now you can restart the agent service nixstatsagent restart to start monitoring Apache.
Updated on: 11/10/2019
Thank you!