【发布时间】:2021-07-14 07:04:19
【问题描述】:
我的要求是使用 Prometheus 和 Grafana 监控包含 Apache 的 Linode 虚拟机。 (PS - Prometheus 和 Grafana 在单独的 Linode VM 中运行)
我使用以下文档来安装 Apache exporter : 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) 作为它们的操作系统。
我在这里缺少什么?如何获取其余面板的图表?任何和所有的帮助表示赞赏。提前非常感谢。
【问题讨论】:
-
我在 Grafana 中丢失数据的问题通常是以下两种类型之一:1)由于尚未生成计数器指标而丢失数据(例如,受监控实例的负载较低;您不会得到错误计数器,因为尚未发生错误)2)不兼容的仪表板(在编辑模式下打开面板,查看源是什么以及提供数据的指标是否首先存在)。学习 grafana 不需要太多时间,其实很有趣。 :)
-
@MarekPuchalski 来源是普罗米修斯,应该是。面板使用的指标是 apache_sent_kilobytes_total、apache_accesses_total、apache_scoreboard、apache_workers 和 apache_cpuload。我在我的普罗米修斯中看不到这些。所以我有不兼容的仪表板?我应该怎么做才能获取这些指标的数据?一切都很有趣和游戏,直到老板开始在我的脖子上呼吸XD
-
您使用的是哪个版本的 Apache?
标签: apache prometheus grafana