Apache server-status 설정 후 Apache 재시작

httpd.conf
ExtendedStatus on
<Location /server-status>
    SetHandler server-status
    Require host .test.kr
    Require ip 172.21
</Location>

$ ./apachectl restart

Apache exporter 다운로드 및 설치

다운로드 페이지: https://github.com/Lusitaniae/apache_exporter/releases/tag/v0.11.0
wget https://github.com/Lusitaniae/apache_exporter/releases/download/v0.11.0/apache_exporter-0.11.0.linux-amd64.tar.gz
$ tar -zxvf apache_exporter-0.11.0.linux-amd64.tar.gz

Apache exporter 시작

$  /SW/prometheus/apache_exporter-0.11.0.linux-amd64/apache_exporter  --scrape_uri=http://localhost/server-status/?auto
 curl http://localhost/server-status/?auto 명령어를 수행하여 apache status를 정상적으로 불러오는지 확인 필요

 

Prometheus 다운로드 및 설치

다운로드 페이지: https://prometheus.io/download/$ wget https://github.com/prometheus/prometheus/releases/download/v2.38.0/prometheus-2.38.0.linux-amd64.tar.gz
$
 tar -zxvf prometheus-2.38.0.linux-amd64.tar.gz

Prometheus 환경파일 수정(apache-exporter 설정)

prometheus.yml
# my global config
global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.
  evaluation_interval: 15s # By default, scrape targets every 15 seconds.
 
  external_labels:
    monitor: 'www.test.kr'
 
rule_files:
 
scrape_configs:
  # ...
  - job_name: 'apache-exporter'
    scrape_interval: 5s
 
    static_configs:
      # httpd(apache), apache-exporter 설치된 인스턴스 IP:9117
      - targets: ['localhost:9117']

Prometheus 시작

$ /SW/prometheus/prometheus-2.38.0.linux-amd64/prometheus

 

Grafana 다운로드 및 설치

다운로드 페이지: https://grafana.com/grafana/download?pg=get&plcmt=selfmanaged-box1-cta1wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.1.5.linux-amd64.tar.gz

Grafana 시작

$ cd grafana-9.1.5
$ /SW/grafana/grafana-9.1.5/bin/grafana-server

 

Grafana 대시보드 적용

-계정/패스워드: admin/admin
-Apache 대시보드 json파일을 다운받아 적용한다.
https://grafana.com/grafana/dashboards/3894-apache/

 

Dashboards → + import → Upload JSON file(apache_rev7.json)

Grafana Apache 대시보드 적용 화면

+ Recent posts