
Apache Exporter for Prometheus是一款用于通过HTTP协议导出Apache服务器mod_status模块统计数据的工具,供Prometheus监控系统采集和分析。该工具兼容Apache 2.2和2.4版本,支持配置监控目标地址、认证信息、日志级别等参数,帮助用户实时掌握Apache服务器的运行状态与性能指标。
-scrape_uri)、指标暴露地址(-telemetry.address)及路径(-telemetry.endpoint)-log.level),覆盖从debug到panic的各级别日志适用于需要通过Prometheus监控Apache Web服务器状态的各类场景,包括:
apache_up指标判断Apache服务可用性)从项目根目录执行以下命令构建Docker镜像:
bashdocker build -t apache_exporter .
基本运行示例
bashdocker run -d -p 9117:9117 apache_exporter \ -scrape_uri "https://your.server.com/server-status/?auto"
参数说明:
-p 9117:9117:将容器内默认监控端口(9117)映射到主机,供Prometheus采集指标-scrape_uri:指定Apache服务器server-status页面的URL(需包含?auto参数以获取机器可读格式)带HTTP认证的运行示例
若Apache的server-status页面启用HTTP基本认证,需在scrape_uri中嵌入用户名和密码:
bashdocker run -d -p 9117:9117 apache_exporter \ -scrape_uri "http://user:password@localhost/server-status?auto"
| 参数 | 说明 | 默认值 |
|---|---|---|
-insecure | 当使用HTTPS时,忽略服务器证书验证(默认关闭) | false |
-log.level value | 日志级别,仅记录指定级别及以上的消息,有效值:debug/info/warn/error/fatal/panic | info |
-scrape_uri string | Apache server-status页面的访问URI(必须包含?auto参数) | "http://localhost/server-status/?auto" |
-telemetry.address string | 指标暴露的网络地址(格式:host:port) | ":9117" |
-telemetry.endpoint string | 指标暴露的HTTP路径 | "/metrics" |
-version | 显示Exporter版本信息 | - |
# HELP apache_accesses_total 当前Apache总访问量 (*) # TYPE apache_accesses_total counter # HELP apache_scoreboard Apache记分板状态(工作进程状态分布) # TYPE apache_scoreboard gauge # HELP apache_sent_kilobytes_total 当前总发送千字节数 (*) # TYPE apache_sent_kilobytes_total counter # HELP apache_cpu_load CPU负载 (*) # TYPE apache_cpu_load gauge # HELP apache_up Apache服务器是否可达(1=可达,0=不可达) # TYPE apache_up gauge # HELP apache_uptime_seconds_total Apache服务器运行时间(秒) (*) # TYPE apache_uptime_seconds_total counter # HELP apache_workers Apache工作进程状态(各状态进程数量) # TYPE apache_workers gauge
# HELP http_request_duration_microseconds HTTP请求延迟(微秒) # TYPE http_request_duration_microseconds summary # HELP http_request_size_bytes HTTP请求大小(字节) # TYPE http_request_size_bytes summary # HELP http_response_size_bytes HTTP响应大小(字节) # TYPE http_response_size_bytes summary # HELP process_cpu_seconds_total 进程总CPU时间(秒) # TYPE process_cpu_seconds_total counter # HELP process_max_fds 最大打开文件描述符数 # TYPE process_max_fds gauge # HELP process_open_fds 当前打开文件描述符数 # TYPE process_open_fds gauge # HELP process_resident_memory_bytes 常驻内存大小(字节) # TYPE process_resident_memory_bytes gauge # HELP process_start_time_seconds 进程启动时间(Unix时间戳,秒) # TYPE process_start_time_seconds gauge # HELP process_virtual_memory_bytes 虚拟内存大小(字节) # TYPE process_virtual_memory_bytes gauge
注意:标记
(*)的指标需在Apache配置中启用ExtendedStatus On才能获取。Apache 2.3.6及以上版本加载mod_status模块时会默认开启ExtendedStatus。
该Exporter最初由https://github.com/neezgee%E5%88%9B%E5%BB%BA%E3%80%82
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
不支持 push
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务