
GUIDE
导读
01
下载apache_exporter
GitHub - Lusitaniae/apache_exporter: Prometheus exporter for Apache
02
解压并启动apache_exporter
# 解压[root@pre1 ~]# tar xzvf apache_exporter-0.11.0.linux-386.tar.gz[root@pre1 ~]# mv apache_exporter-0.11.0.linux-386 apache_exporter#启动apache-exporterapache-exporter启动时的参数包括以下几个部分:-h, --help Show context-sensitive help (also try --help-long and--help-man).--telemetry.address=":9117"Address on which to expose metrics.--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 nooverride.--insecure Ignore server certificate if using https.--web.config="" Path to config yaml file that can enable TLS orauthentication.--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]--version Show application version.[root@localhost software]# ./apache_exporter --scrape_uri="http://192.168.3.73/server-status?auto" &#需要注意的是这里一定要使用scrape_uri来指定需要监控的URI地址,否则默认监控的为localhost/server-auto,这样prometheus就无法读取到这台服务器的监控数据
03
启动apache服务器并添加监控status
[root@pre1 apache_exporter]# vim /etc/httpd/conf/httpd.conf354 LoadModule status_module modules/mod_status.so355 <location /server-status>356 SetHandler server-status357 Order Deny,Allow358 Deny from nothing359 Allow from all360 </location>在配置文件httpd.conf中添加以下监控配置
04
修改prometheus配置文件
- job_name: 'apache_status'static_configs:- targets: ['apache服务器IP:9117']
05
在grafana导入模板
在grafana中导入3894模板

往/期/回/顾
-End-
「有用就扩散」
「有用就点在看」
更多课程咨询或免费资料领取,扫下方二维码即可!

文章转载自西安川石,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




