Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/apache_agent?at=release/6.2
Apache by Zabbix agent
Overview
For Zabbix version: 6.2 and higher
The template to monitor Apache HTTPD by Zabbix that work without any external scripts.
Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
Template Apache by Zabbix agent
- collects metrics by polling mod_status locally with Zabbix agent:
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: __________________________________________W_____________W___________________LW_____W______W_W_______............................................................................................................................................................................................................................................................................................................
It also uses Zabbix agent to collect Apache
Linux process stats like CPU usage, memory usage and whether process is running or not.
This template was tested on:
- Apache, version 2.4.41
Setup
See Zabbix template operation for basic instructions.
Setup mod_status
Check module availability: httpd -M 2>/dev/null | grep status_module
Example configuration of Apache:
<Location "/server-status">
SetHandler server-status
Require host example.com
</Location>
If you use another path, then don't forget to change {$APACHE.STATUS.PATH}
macro.
Install and setup Zabbix agent.
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$APACHE.PROCESS_NAME} | Apache server process name |
httpd |
{$APACHE.RESPONSE_TIME.MAX.WARN} | Maximum Apache response time in seconds for trigger expression |
10 |
{$APACHE.STATUS.HOST} | Hostname or IP address of the Apache status page |
127.0.0.1 |
{$APACHE.STATUS.PATH} | The URL path |
server-status?auto |
{$APACHE.STATUS.PORT} | The port of Apache status page |
80 |
{$APACHE.STATUS.SCHEME} | Request scheme which may be http or https |
http |
Template links
There are no template links in this template.
Discovery rules
Name | Description | Type | Key and additional info |
---|---|---|---|
Event MPM discovery | Additional metrics if event MPM is used |
DEPENDENT | apache.mpm.event.discovery Preprocessing: - JAVASCRIPT: - DISCARD_UNCHANGED_HEARTBEAT: |
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
Apache | Apache: Service ping | - |
ZABBIX_PASSIVE | net.tcp.service[http,"{$APACHE.STATUS.HOST}","{$APACHE.STATUS.PORT}"] Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: |
Apache | Apache: Service response time | - |
ZABBIX_PASSIVE | net.tcp.service.perf[http,"{$APACHE.STATUS.HOST}","{$APACHE.STATUS.PORT}"] |
Apache | Apache: Total bytes | Total bytes served |
DEPENDENT | apache.bytes Preprocessing: - JSONPATH: - MULTIPLIER: |
Apache | Apache: Bytes per second | Calculated as change rate for 'Total bytes' stat. BytesPerSec is not used, as it counts average since last Apache server start. |
DEPENDENT | apache.bytes.rate Preprocessing: - JSONPATH: - MULTIPLIER: - CHANGE_PER_SECOND |
Apache | Apache: Requests per second | Calculated as change rate for 'Total requests' stat. ReqPerSec is not used, as it counts average since last Apache server start. |
DEPENDENT | apache.requests.rate Preprocessing: - JSONPATH: - CHANGE_PER_SECOND |
Apache | Apache: Total requests | A total number of accesses |
DEPENDENT | apache.requests Preprocessing: - JSONPATH: |
Apache | Apache: Uptime | Service uptime in seconds |
DEPENDENT | apache.uptime Preprocessing: - JSONPATH: |
Apache | Apache: Version | Service version |
DEPENDENT | apache.version Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Apache | Apache: Total workers busy | Total number of busy worker threads/processes |
DEPENDENT | apache.workers_total.busy Preprocessing: - JSONPATH: |
Apache | Apache: Total workers idle | Total number of idle worker threads/processes |
DEPENDENT | apache.workers_total.idle Preprocessing: - JSONPATH: |
Apache | Apache: Workers closing connection | Number of workers in closing state |
DEPENDENT | apache.workers.closing Preprocessing: - JSONPATH: |
Apache | Apache: Workers DNS lookup | Number of workers in dnslookup state |
DEPENDENT | apache.workers.dnslookup Preprocessing: - JSONPATH: |
Apache | Apache: Workers finishing | Number of workers in finishing state |
DEPENDENT | apache.workers.finishing Preprocessing: - JSONPATH: |
Apache | Apache: Workers idle cleanup | Number of workers in cleanup state |
DEPENDENT | apache.workers.cleanup Preprocessing: - JSONPATH: |
Apache | Apache: Workers keepalive (read) | Number of workers in keepalive state |
DEPENDENT | apache.workers.keepalive Preprocessing: - JSONPATH: |
Apache | Apache: Workers logging | Number of workers in logging state |
DEPENDENT | apache.workers.logging Preprocessing: - JSONPATH: |
Apache | Apache: Workers reading request | Number of workers in reading state |
DEPENDENT | apache.workers.reading Preprocessing: - JSONPATH: |
Apache | Apache: Workers sending reply | Number of workers in sending state |
DEPENDENT | apache.workers.sending Preprocessing: - JSONPATH: |
Apache | Apache: Workers slot with no current process | Number of slots with no current process |
DEPENDENT | apache.workers.slot Preprocessing: - JSONPATH: |
Apache | Apache: Workers starting up | Number of workers in starting state |
DEPENDENT | apache.workers.starting Preprocessing: - JSONPATH: |
Apache | Apache: Workers waiting for connection | Number of workers in waiting state |
DEPENDENT | apache.workers.waiting Preprocessing: - JSONPATH: |
Apache | Apache: Number of processes running | - |
ZABBIX_PASSIVE | proc.num["{$APACHE.PROCESS_NAME}"] |
Apache | Apache: Memory usage (rss) | Resident set size memory used by process in bytes. |
ZABBIX_PASSIVE | proc.mem["{$APACHE.PROCESS_NAME}",,,,rss] |
Apache | Apache: Memory usage (vsize) | Virtual memory size used by process in bytes. |
ZABBIX_PASSIVE | proc.mem["{$APACHE.PROCESS_NAME}",,,,vsize] |
Apache | Apache: CPU utilization | Process CPU utilization percentage. |
ZABBIX_PASSIVE | proc.cpu.util["{$APACHE.PROCESS_NAME}"] |
Apache | Apache: Connections async closing | Number of async connections in closing state (only applicable to event MPM) |
DEPENDENT | apache.connections[async_closing{#SINGLETON}] Preprocessing: - JSONPATH: |
Apache | Apache: Connections async keep alive | Number of async connections in keep-alive state (only applicable to event MPM) |
DEPENDENT | apache.connections[async_keep_alive{#SINGLETON}] Preprocessing: - JSONPATH: |
Apache | Apache: Connections async writing | Number of async connections in writing state (only applicable to event MPM) |
DEPENDENT | apache.connections[async_writing{#SINGLETON}] Preprocessing: - JSONPATH: |
Apache | Apache: Connections total | Number of total connections |
DEPENDENT | apache.connections[total{#SINGLETON}] Preprocessing: - JSONPATH: |
Apache | Apache: Bytes per request | Average number of client requests per second |
DEPENDENT | apache.bytes[per_request{#SINGLETON}] Preprocessing: - JSONPATH: |
Apache | Apache: Number of async processes | Number of async processes |
DEPENDENT | apache.process[num{#SINGLETON}] Preprocessing: - JSONPATH: |
Zabbix raw items | Apache: Get status | Getting data from a machine-readable version of the Apache status page. |
ZABBIX_PASSIVE | web.page.get["{$APACHE.STATUS.SCHEME}://{$APACHE.STATUS.HOST}:{$APACHE.STATUS.PORT}/{$APACHE.STATUS.PATH}"] Preprocessing: - JAVASCRIPT: |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
Apache: Service is down | - |
last(/Apache by Zabbix agent/net.tcp.service[http,"{$APACHE.STATUS.HOST}","{$APACHE.STATUS.PORT}"])=0 |
AVERAGE | Manual close: YES Depends on: - Apache: Process is not running |
Apache: Service response time is too high | - |
min(/Apache by Zabbix agent/net.tcp.service.perf[http,"{$APACHE.STATUS.HOST}","{$APACHE.STATUS.PORT}"],5m)>{$APACHE.RESPONSE_TIME.MAX.WARN} |
WARNING | Manual close: YES Depends on: - Apache: Process is not running - Apache: Service is down |
Apache: has been restarted | Uptime is less than 10 minutes. |
last(/Apache by Zabbix agent/apache.uptime)<10m |
INFO | Manual close: YES |
Apache: Version has changed | Apache version has changed. Ack to close. |
last(/Apache by Zabbix agent/apache.version,#1)<>last(/Apache by Zabbix agent/apache.version,#2) and length(last(/Apache by Zabbix agent/apache.version))>0 |
INFO | Manual close: YES |
Apache: Process is not running | - |
last(/Apache by Zabbix agent/proc.num["{$APACHE.PROCESS_NAME}"])=0 |
HIGH | |
Apache: Failed to fetch status page | Zabbix has not received data for items for the last 30 minutes. |
nodata(/Apache by Zabbix agent/web.page.get["{$APACHE.STATUS.SCHEME}://{$APACHE.STATUS.HOST}:{$APACHE.STATUS.PORT}/{$APACHE.STATUS.PATH}"],30m)=1 |
WARNING | Manual close: YES Depends on: - Apache: Process is not running - Apache: Service is down |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template or ask for help with it at ZABBIX forums.