# Apache by HTTP
## Overview
This template is designed for the effortless deployment of Apache monitoring by Zabbix via HTTP and doesn't require any external scripts.
The template `Apache by HTTP` - collects metrics by polling [mod_status](https://httpd.apache.org/docs/current/mod/mod_status.html) with HTTP agent remotely:
```text
127.0.0.1
ServerVersion: Apache/2.4.41 (Unix)
ServerMPM: event
Server Built: Aug 14 2019 00:35:10
CurrentTime: Friday, 16-Aug-2019 12:38:40 UTC
RestartTime: Wednesday, 14-Aug-2019 07:58:26 UTC
ParentServerConfigGeneration: 1
ParentServerMPMGeneration: 0
ServerUptimeSeconds: 189613
ServerUptime: 2 days 4 hours 40 minutes 13 seconds
Load1: 4.60
Load5: 1.20
Load15: 0.47
Total Accesses: 27860
Total kBytes: 33011
Total Duration: 54118
CPUUser: 18.02
CPUSystem: 31.76
CPUChildrenUser: 0
CPUChildrenSystem: 0
CPULoad: .0262535
Uptime: 189613
ReqPerSec: .146931
BytesPerSec: 178.275
BytesPerReq: 1213.33
DurationPerReq: 1.9425
BusyWorkers: 7
IdleWorkers: 93
Processes: 4
Stopping: 0
BusyWorkers: 7
IdleWorkers: 93
ConnsTotal: 13
ConnsAsyncWriting: 0
ConnsAsyncKeepAlive: 5
ConnsAsyncClosing: 0
Scoreboard: ...
```
## Requirements
Zabbix version: 7.0 and higher.
## Tested versions
This template has been tested on:
- Apache 2.4.41
## Configuration
> Zabbix should be configured according to the instructions in the [Templates out of the box](https://www.zabbix.com/documentation/7.0/manual/config/templates_out_of_the_box) section.
## Setup
See the setup instructions for [mod_status](https://httpd.apache.org/docs/current/mod/mod_status.html).
Check the availability of the module with this command line: `httpd -M 2>/dev/null | grep status_module`
This is an example configuration of the Apache web server:
```text
The port of the Apache status page.
|`80`| |{$APACHE.STATUS.PATH}|The URL path.
|`server-status?auto`| |{$APACHE.STATUS.SCHEME}|The request scheme, which may be either HTTP or HTTPS.
|`http`| |{$APACHE.RESPONSE_TIME.MAX.WARN}|The maximum Apache response time expressed in seconds for a trigger expression.
|`10`| ### Items |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Apache: Get status|Getting data from a machine-readable version of the Apache status page.
For more information see Apache Module [mod_status](https://httpd.apache.org/docs/current/mod/mod_status.html).
|HTTP agent|apache.get_status**Preprocessing**
JavaScript: `The text is too long. Please see the template.`
**Preprocessing**
Discard unchanged with heartbeat: `10m`
The total bytes served.
|Dependent item|apache.bytes**Preprocessing**
JSON Path: `$["Total kBytes"]`
Custom multiplier: `1024`
It is calculated as a rate of change for total bytes statistics.
`BytesPerSec` is not used, as it counts the average since the last Apache server start.
|Dependent item|apache.bytes.rate**Preprocessing**
JSON Path: `$["Total kBytes"]`
Custom multiplier: `1024`
It is calculated as a rate of change for the "Total requests" statistics.
`ReqPerSec` is not used, as it counts the average since the last Apache server start.
|Dependent item|apache.requests.rate**Preprocessing**
JSON Path: `$["Total Accesses"]`
The total number of the Apache server accesses.
|Dependent item|apache.requests**Preprocessing**
JSON Path: `$["Total Accesses"]`
The service uptime expressed in seconds.
|Dependent item|apache.uptime**Preprocessing**
JSON Path: `$.ServerUptimeSeconds`
The Apache service version.
|Dependent item|apache.version**Preprocessing**
JSON Path: `$.ServerVersion`
Discard unchanged with heartbeat: `1d`
The total number of busy worker threads/processes.
|Dependent item|apache.workers_total.busy**Preprocessing**
JSON Path: `$.BusyWorkers`
The total number of idle worker threads/processes.
|Dependent item|apache.workers_total.idle**Preprocessing**
JSON Path: `$.IdleWorkers`
The number of workers in closing state.
|Dependent item|apache.workers.closing**Preprocessing**
JSON Path: `$.Workers.closing`
The number of workers in `dnslookup` state.
|Dependent item|apache.workers.dnslookup**Preprocessing**
JSON Path: `$.Workers.dnslookup`
The number of workers in finishing state.
|Dependent item|apache.workers.finishing**Preprocessing**
JSON Path: `$.Workers.finishing`
The number of workers in cleanup state.
|Dependent item|apache.workers.cleanup**Preprocessing**
JSON Path: `$.Workers.cleanup`
The number of workers in `keepalive` state.
|Dependent item|apache.workers.keepalive**Preprocessing**
JSON Path: `$.Workers.keepalive`
The number of workers in logging state.
|Dependent item|apache.workers.logging**Preprocessing**
JSON Path: `$.Workers.logging`
The number of workers in reading state.
|Dependent item|apache.workers.reading**Preprocessing**
JSON Path: `$.Workers.reading`
The number of workers in sending state.
|Dependent item|apache.workers.sending**Preprocessing**
JSON Path: `$.Workers.sending`
The number of slots with no current process.
|Dependent item|apache.workers.slot**Preprocessing**
JSON Path: `$.Workers.slot`
The number of workers in starting state.
|Dependent item|apache.workers.starting**Preprocessing**
JSON Path: `$.Workers.starting`
The number of workers in waiting state.
|Dependent item|apache.workers.waiting**Preprocessing**
JSON Path: `$.Workers.waiting`
Zabbix has not received any data for items for the last 30 minutes.
|`nodata(/Apache by HTTP/apache.get_status,30m)=1`|Warning|**Manual close**: YesUptime is less than 10 minutes.
|`last(/Apache by HTTP/apache.uptime)<10m`|Info|**Manual close**: Yes| |Apache: Version has changed|Apache version has changed. Acknowledge to close the problem manually.
|`last(/Apache by HTTP/apache.version,#1)<>last(/Apache by HTTP/apache.version,#2) and length(last(/Apache by HTTP/apache.version))>0`|Info|**Manual close**: Yes| ### LLD rule Event MPM discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Event MPM discovery|The discovery of additional metrics if the event Multi-Processing Module (MPM) is used.
For more details see [Apache MPM event](https://httpd.apache.org/docs/current/mod/event.html).
|Dependent item|apache.mpm.event.discovery**Preprocessing**
JavaScript: `The text is too long. Please see the template.`
Discard unchanged with heartbeat: `3h`
The number of asynchronous connections in closing state (applicable only to the event MPM).
|Dependent item|apache.connections[async_closing{#SINGLETON}]**Preprocessing**
JSON Path: `$.ConnsAsyncClosing`
The number of asynchronous connections in keepalive state (applicable only to the event MPM).
|Dependent item|apache.connections[async_keep_alive{#SINGLETON}]**Preprocessing**
JSON Path: `$.ConnsAsyncKeepAlive`
The number of asynchronous connections in writing state (applicable only to the event MPM).
|Dependent item|apache.connections[async_writing{#SINGLETON}]**Preprocessing**
JSON Path: `$.ConnsAsyncWriting`
The number of total connections.
|Dependent item|apache.connections[total{#SINGLETON}]**Preprocessing**
JSON Path: `$.ConnsTotal`
The average number of client requests per second.
|Dependent item|apache.bytes[per_request{#SINGLETON}]**Preprocessing**
JSON Path: `$.BytesPerReq`
The number of asynchronous processes.
|Dependent item|apache.process[num{#SINGLETON}]**Preprocessing**
JSON Path: `$.Processes`