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-exporter
apache-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 no
override.
--insecure Ignore server certificate if using https.
--web.config="" Path to config yaml 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]
--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.conf
354 LoadModule status_module modules/mod_status.so
355 <location /server-status>
356 SetHandler server-status
357 Order Deny,Allow
358 Deny from nothing
359 Allow from all
360 </location>
在配置文件httpd.conf中添加以下监控配置
复制
04
修改prometheus配置文件
- job_name: 'apache_status'
static_configs:
- targets: ['apache服务器IP:9117']
复制
05
在grafana导入模板
在grafana中导入3894模板
往/期/回/顾
-End-
「有用就扩散」
「有用就点在看」
更多课程咨询或免费资料领取,扫下方二维码即可!
文章转载自西安川石,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。