Monitor Type: collectd/apache
(Source)
Accepts Endpoints: Yes
Multiple Instances Allowed: Yes
Monitors Apache webservice instances using the information provided by
mod_status
.
Apache worker threads can be in one of the following states:
State | Remark |
---|---|
Open | Open (unused) slot - no process |
Waiting | Idle and waiting for request |
Sending | Serving response |
KeepAlive | Kept alive for possible next request |
Idle_cleanup | Idle and marked for cleanup |
Closing | Closing connection |
Logging | Writing to log file |
Reading | Reading request |
Finishing | Finishing as part of graceful shutdown |
Starting | Starting up to serve |
To configure the Apache webserver itself to expose status metrics:
-
Enable the mod_status module in your Apache server.
-
Add the following configuration to your Apache server:
ExtendedStatus on <Location /mod_status> SetHandler server-status </Location>
-
Restart Apache.
Note: Make sure that the URL you provide for your mod_status
module
ends in ?auto
. This returns the status page as text/plain
, which this
plugin requires.
monitors:
- type: collectd/apache
host: localhost
port: 80
If mod_status
is exposed on an endpoint other than /mod_status
, you can
use the url
config option to specify the path:
monitors:
- type: collectd/apache
host: localhost
port: 80
url: "http://{{.Host}}:{{.Port}}/server-status?auto"
For a full list of options, see Configuration.
To activate this monitor in the Smart Agent, add the following to your agent config:
monitors: # All monitor config goes under this key
- type: collectd/apache
... # Additional config
For a list of monitor options that are common to all monitors, see Common Configuration.
Config option | Required | Type | Description |
---|---|---|---|
host |
yes | string |
The hostname of the Apache server |
port |
yes | integer |
The port number of the Apache server |
name |
no | string |
This will be sent as the plugin_instance dimension and can be any name you like. |
url |
no | string |
The URL, either a final URL or a Go template that will be populated with the host and port values. (default: http://{{.Host}}:{{.Port}}/mod_status?auto ) |
username |
no | string |
|
password |
no | string |
These are the metrics available for this monitor. Metrics that are categorized as container/host (default) are in bold and italics in the list below.
-
apache_bytes
(cumulative)
Amount of data served by Apache, in bytes. -
apache_connections
(gauge)
The number of connections that are being served by Apache. This is also equal to the number of busy worker threads, where 'busy' means any worker thread which has been started successfully and is not slated for idle cleanup. -
apache_idle_workers
(gauge)
The number of Apache workers that are idling. If this number is consistently low, then your server may be too busy and you may have to increase the number of threads. If it is consistently high, then the system may be under-utilized. -
apache_requests
(cumulative)
The number of requests that have been served by Apache. This metric is useful to know total requests and the rate at which Apache is able to serve them. -
apache_scoreboard.closing
(gauge)
This metric shows how many worker threads are in the process of closing TCP connections after serving a response. If this number is consistently high, then there might be a network issue or errant client preventing TCP tear-down. -
apache_scoreboard.dnslookup
(gauge)
This metric counts the number of worker threads that are performing a DNS lookup. If this number is too high, check if there is a DNS resolution problem at your server. This can affect Apache server performance. -
apache_scoreboard.finishing
(gauge)
The number of worker threads that are finishing as part of graceful server shutdown. -
apache_scoreboard.idle_cleanup
(gauge)
The number of worker threads that are idle and ready for clean-up. -
apache_scoreboard.keepalive
(gauge)
The number of worker threads that are maintaining keep-alive connections: keeping the connection "alive" after serving a response, in the expectation that another HTTP request will come on the same connection. At the end of the keep-alive interval, the connection is closed. -
apache_scoreboard.logging
(gauge)
This metric shows how many worker threads are busy writing to the log file. If this number is consistently high, your logging level may be too high or one or more modules may be too verbose. -
apache_scoreboard.open
(gauge)
This metric shows how many worker slots are open. The slots do not have a worker thread yet, but they can be spun up based on incoming requests. -
apache_scoreboard.reading
(gauge)
This metric shows how many workers are in the process of receiving requests (headers or body). If this number is consistently high, clients may be sending large headers or uploading large files. -
apache_scoreboard.sending
(gauge)
This metric shows how many workers are sending responses. It is normal for this to be a large number when measuring sites that serve large downloads. -
apache_scoreboard.starting
(gauge)
This metric shows how many workers are being started up. If this number is consistently high, then the system may be overloaded. -
apache_scoreboard.waiting
(gauge)
This metric shows how many worker threads are ready and waiting for requests to come in.
To emit metrics that are not default, you can add those metrics in the
generic monitor-level extraMetrics
config option. Metrics that are derived
from specific configuration options that do not appear in the above list of
metrics do not need to be added to extraMetrics
.
To see a list of metrics that will be emitted you can run agent-status monitors
after configuring this monitor in a running agent instance.
The following dimensions may occur on metrics emitted by this monitor. Some dimensions may be specific to certain metrics.
Name | Description |
---|---|
plugin_instance |
Set to whatever you set in the name config option. |