我的要求是使用 Prometheus 和 Grafana 监控包含 Apache 的 Linode 虚拟机。(PS - Prometheus 和 Grafana 在单独的 Linode VM 中运行)
我使用以下文档安装 Apache 导出器: https ://www.techbeginner.in/2021/01/install-and-configure-apache-node.html 。服务文件是这样的:
[Unit]
Description=Prometheus
Documentation=https://github.com/Lusitaniae/apache_exporter
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/apache_exporter \
--insecure \
--scrape_uri=http://localhost/server-status/?auto \
--telemetry.address=0.0.0.0:9117 \
--telemetry.endpoint=/metrics
SyslogIdentifier=apache_exporter
Restart=always
[Install]
WantedBy=multi-user.target
我已将 --scrape_uri 更改为 http://usr_name:password@localhost/server-status/?auto \ 并将 --telemetry.address 更改为 127.0.0.1:9117 尽管我确信它不会有任何区别. Prometheus 能够抓取数据。但是当我导入一个 grafana 仪表板(ID - 3894)来可视化数据时,我没有得到任何数据。在整个仪表板的 7 个面板中(当前发送的总 kbytes、当前总 apache 访问、Apache 记分板状态、Apache 工作状态、Apache CPU 负载、正常运行时间和 Apache Up/Down),我可以看到 Apache Up/Down 的 grapf。其他 6 个说没有可用的数据。
这是 prometheus.yml 配置:
#Apache Servers
- job_name: apache-web-server
static_configs:
- targets: ['x.x.x.x:9117']
labels:
alias: server-apache
PS - 两个 Linode 实例都包含 Debian GNU/Linux 9.8 (stretch) 作为它们的操作系统。
我在这里想念什么?如何获取其余面板的图表?任何和所有的帮助表示赞赏。提前非常感谢。