2023년 3월 10일 금요일

Prometheus & Grafana Installation (on Ubuntu)

 [Prometheus]


1) download prometheus

$ wget <https://prometheus.io/download/ 에서 OS에 맞는 파일의 주소>

압축 해제.. & prometheus.yml 편집

scrape_configs:

  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.

  - job_name: "prometheus"


    # metrics_path defaults to '/metrics'

    # scheme defaults to 'http'.

    static_configs:

      - targets: ["localhost:9091"]

      - 

  - job_name: "springboot"

    scrape_interval: 15s

    metrics_path: "/actuator/prometheus"

    static_configs:

      - targets: ["rookie01.local:8080"]

      - 

2) startup

$ ./prometheus --config.file=prometheus.yml  --web.listen-address="0.0.0.0:9091" --web.enable-lifecycle 2>&1 | tee -a ./startup.log &



3) shutdown

$ curl -X POST localhost:9091/-/quit   ( or kill )


4) brower 접속

http://localhost:9091

http://localhost:9091/metrics



[Grafana]

1) download installation file

$ wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.3.6.linux-amd64.tar.gz


2) startup

$ ./bin/grafana-server web


3) browser 접속

http://localhost:3000  ( admin / admin ; 첫 로그인 후 비밀번호 변경)


4) springboot 용 pannel 샘플 다운로드 / Import

 download from : https://grafana.com/grafana/dashboards/12900-springboot-apm-dashboard/


[업데이트 2026-10]

  • Prometheus 다운로드 명령이 Alpine 저장소 주소로 잘못 들어가 있었다(복사 실수). Prometheus 공식 다운로드 페이지(https://prometheus.io/download/)에서 OS에 맞는 파일을 받는 것으로 고쳤다.
  • Grafana 9.3.6도 오래된 버전이라 새로 설치한다면 Grafana 공식 다운로드 페이지에서 최신 버전을 확인한다.
  • Grafana 기본 계정은 admin/admin이고, 첫 로그인 후 비밀번호를 바꾸면 된다. 글에 적혀 있던 비밀번호 힌트는 지웠다.

댓글 없음:

댓글 쓰기