百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

apache_exporter

> DevOps
开源

适用于 Apache 的 Prometheus 导出器。

361 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

适用于 Apache 的 Prometheus 导出器。

Apache Exporter for Prometheus Build Status

Exports apache mod_status statistics via HTTP for Prometheus consumption.

With working golang environment it can be built with go get. There is a good article with build HOWTO and usage example.

Help on flags:

-h, --[no-]help Show context-sensitive help (also try --help-long and --help-man). --telemetry.endpoint="/metrics" Path under which to expose metrics. --scrape_uri="http://localhost/server-status?auto" URI to apache stub status page. --host_override="" Override for HTTP Host header; empty string for no override. --[no-]insecure Ignore server certificate if using https. --custom_headers Adds custom headers to the collector. --[no-]web.systemd-socket Use systemd socket activation listeners instead of port listeners (Linux only). --web.listen-address=:9117 ... Addresses on which to expose metrics and web interface. Repeatable for multiple addresses. --web.config.file="" [EXPERIMENTAL] Path to configuration file that can enable TLS or authentication. --log.level=info Only log messages with the given severity or above. One of: [debug, info, warn, error] --log.format=logfmt Output format of log messages. One of: [logfmt, json] --[no-]version Show application version.

Tested on Apache 2.2 and Apache 2.4.

If your server-status page is secured by http auth, add the credentials to the scrape URL following this example:

http://user:password@localhost/server-status?auto

Override host name by runnning

./apache_exporter --host_override=example.com

Using Docker

Use compose.yml

  • Requires Docker CE
  • Does not build from source, but rather pulls from registry only
  1. Edit compose.yml if needed (Maybe to change server-status endpoint)
  2. docker compose up

OR

Build the compatible binary

To make sure that exporter binary created by build job is suitable to run on busybox environment, generate the binary using Makefile definition. Inside project directory run:

make

Please be aware that binary generated using go get or go build with defaults may not work in busybox/alpine base images.

Another option is to use a docker go container to generate the binary.

Pick an appropriate go image from https://hub.docker.com/_/golang. Inside the project directory run:

bash
docker run --rm -v :/usr/local/go/src/github.com/Lusitaniae/apache_exporter -w /usr/local/go/src/github.com/Lusitaniae/apache_exporter  make

Build image

Run the following commands from the project root directory.

bash
docker build -t apache_exporter .

Run

bash
docker run -d -p 9117:9117 apache_exporter \
  --scrape_uri="https://your.server.com/server-status?auto"

Collectors

Apache metrics:

…

Metrics marked '(*)' are only available if ExtendedStatus is On in apache webserver configuration. In version 2.3.6, loading mod_status will toggle ExtendedStatus On by default.

FAQ

Q. Can I change the Dockerfile?

A. In short no, it's not meant for end users. It's part of the CI/CD pipeline in which promu is cross building the exporter for all architectures and packaging them into a Docker image.

Q. Can I run this exporter on different architectures (ARM)?

A. This exporter is cross compiled to all architectures using promu by running promu crossbuild. You can find the resulting artifacts in the release page (Github) or docker images in Quay or Docker.

Q. Is there a Grafana dashboard for this exporter?

A. There's a 3rd party dashboard here which seems to work. Also monitoring-mixin (dashboard+prometheus alerts) is available here.

Q. Can you add additional metrics such as reqpersec, bytespersec and bytesperreq?

A. In line with the best practices, the exporter only provides the totals and you should derive rates using PromQL.

Like that:

  • ReqPerSec : rate(apache_accesses_total[5m])
  • BytesPerSec: rate(apache_sent_kilobytes_total[5m])
  • BytesPerReq: BytesPerSec / ReqPerSec

Q. Can I monitor multiple Apache instances?

A. In line with the best practices, the answer is no. Each process being monitored should be accompanied by one exporter.

We suggest automating configuration and deployment using your favorite tools, e.g. Ansible/Chef/Kubernetes.

Q. Its not working! Apache_up shows as 0

A. When apache_up reports 0 it means the exporter is running however it is not able to connect to Apache.

Do you have this (or similar) configuration uncommented in your Apache instance?


    SetHandler server-status
    Require host example.com

As documented at https://httpd.apache.org/docs/2.4/mod/mod_status.html

Are you able to see the stats, if you run this from the Apache instance?

curl localhost/server-status?auto

If you run the exporter manually, do you see any errors?

./apache_exporter

Please include all this information if you still have issues when creating an issue.

Q. There seem to be missing metrics! I can only see apache_up and apache_cpuload.

A. Make sure that you add ?auto at the end of the scrape_uri.

TLS and basic authentication

Apache Exporter supports TLS and basic authentication. This enables better control of the various HTTP endpoints.

To use TLS and/or basic authentication, you need to pass a configuration file using the --web.config parameter (see above at help on flags). The format of the file is described in the exporter-toolkit repository.

Note that the TLS and basic authentication settings affect all HTTP endpoints: /metrics for scraping, /probe for probing, and the web UI.

Author

The exporter was originally created by neezgee.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goapachedockermetricsprometheus

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理