Skip to content

Prometheus for Docker Hello World guide based on official release

Notifications You must be signed in to change notification settings

pyo-counting/hello-world-prometheus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello-world-prometheus

Prometheus hello world 프로젝트

1. Architecture overview

2. Configuration

정상 설치 및 실행하기 위해 사용자 환경에 따라 기본적으로 변경되어야 하는 설정은 다음과 같다.

  • Prometheus:
    • ./prometheus/prometheus.yml
      • alerting.alertmanagers.static_configs.targets: alertmanager endpoint 설정 필요
    • ./prometheus/sd_configs/file/*.yml
      • scrape target 추가를 위한 endpoint(IP 및 PORT 정보) 설정 필요
  • Grafana:
    • ./grafana/cert/*
      • HTTPS 인증서 및 키 파일 추가 필요
    • ./grafana/grafana.ini
      • server.domain: 도메인 설정 필요
      • server.cert_file, server.cert_key: 인증서 관련 파일 경로 설정 필요
      • security.admin_password: Grafana 관리자 계정 비밀번호 설정 필요
    • ./grafana/provisioning/datasources/datasources.yml
      • datasources.url: Prometheus endpoint 설정 필요
  • Alertmanager:
    • ./alertmanager/alertmanager.yml
      • global.slack_api_url: slack webhook URL 설정 필요

추가적으로 SpringBoot metrics 수집을 위한 maven pom.xml, application.yml 및 JMX exporter metrics 수집을 위한 설정은 아래와 같다.

  • SpringBoot
    • pom.xml
      <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-registry-prometheus</artifactId>
        <version>1.8.2</version>
      </dependency>
    • application.yml
      management:
        endpoint:
          enables: true
        metrics:
          tags:
            application: springboot
        endpoints:
          web:
            exposure:
              include: "*"
  • JMX-exporter
    • JVM 실행 옵션
      # non-tomcat JVM application(>= java 7)의 경우
      -javaagent:${라이브러리_디렉토리_경로}/jmx_prometheus_javaagent-0.16.1.jar=${포트}:${설정파일_디렉토리_경로}/jmx_exporter_config.yml
      # tomcat(>= java 7) JVM의 경우
      CATALINA_OPTS="${CATALINA_OPTS} -javaagent:${라이브러리_디렉토리_경로}/jmx_prometheus_javaagent-0.16.1.jar=${포트}:${설정파일_디렉토리_경로}/jmx_exporter_config.yml" 

3. Installation

Docker를 이용해 설치 및 실행하며 여러 docker image를 사용하기 때문에 docker-compose를 이용해 container를 관리한다.

3.1 Execution environment info

해당 프로젝트는 아래 환경에서 정상 동작했음을 테스트했다.

  • OS: CentOS Linux release 7.8.2003 (Core)
  • Kernel version: 3.10.0-1127.18.2.el7.x86_64 #1 SMP Sun Jul 26 15:27:06 UTC 2020
  • Docker version: 20.10.5
  • Docker-compose version: 1.28.6, build 5db8d86f

3.2 Software Version Info

3.3 Step by step

  1. project clone하기
    git clone https://github.com/pyo-counting/hello-world-prometheus.git
  2. 프로젝트 디렉토리로 이동
    cd hello-world-prometheus
  3. docker-compose 실행 및 확인
    docker-compsoe up -d
    docker-compsoe ps
  4. docker-compose down
    docker-compsoe down -v

3.4 Grafana dashboard overview

4. Documentation

5. Etc

  • Architecture overview은 draw.io를 통해 작성
  • Prometheus에 대한 고가용성(High Availability)을 위해 Cortex를 이용할 수 있으며 관련해서는 hello-world-cortex 프로젝트 참고

About

Prometheus for Docker Hello World guide based on official release

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published