BESPIN Tech Blog
  • Home
  • Tech
    • CSP

      AWS

      GCP

      NCP

      Cloud

      Migration

      LZ, Control Tower

      Backup

      Monitoring

      Container

      Infra

      OS

      Middleware

      Data

      RDB

      Big Data Platform

      Application

      CI/CD

      BESPICK 구독하기 ㅣ 1668-1280

  • Trend
  • IT
최신 리포트 다운로드 지금 바로 문의하기
BESPIN Tech Blog
  • Home
  • Tech
    • CSP

      AWS

      GCP

      NCP

      Cloud

      Migration

      LZ, Control Tower

      Backup

      Monitoring

      Container

      Infra

      OS

      Middleware

      Data

      RDB

      Big Data Platform

      Application

      CI/CD

      BESPICK 구독하기 ㅣ 1668-1280

  • Trend
  • IT
최신 리포트 다운로드 지금 바로 문의하기
BESPIN Tech Blog
BESPIN Tech Blog
  • Tech
    • CSP
      • AWS
      • GCP
      • NCP
    • Cloud
      • Migration
      • LZ, Control Tower
      • Backup
      • Monitoring
      • Container
    • Infra
      • OS
      • Middleware
    • Data
      • RDB
      • Big Data Platform
    • Application
      • CI/CD
  • Trend
  • IT
  • Contact US
TECHCloudMonitoring

Prometheus 설정 가이드(Auto Scale 대상 모니터링)

by 형래 김 2023년 06월 30일
2023년 06월 30일
32

안녕하세요. 오늘은 베스핀글로벌 D&A 실 김동규 님이 작성해 주신 Firelens OpenSearch 연동 설정에 대해 알아보겠습니다.

본 가이드에서는 ECS를 예시로 하여 Firelens와 OpenSearch 기본 연동 설정 방법에 대해 가이드 합니다.

관련해서 궁금하신 점이 있으시면 댓글을 달아주세요:)

1. Prometheus 설치

  • 압축파일을 해제 후 설정하는 방식으로 진행

• 사용자 추가

# useradd prometheus

# su – prometheus

  • Prometheus 홈페이지(https://prometheus.io/download/) 에서 리눅스용 확인 후 링크 복사

1-1. Prometheus 설치

  • 압축파일을 해제 후 설정하는 방식으로 진행

• 다운로드 및 압축해제

# wget https://github.com/prometheus/prometheus/releases/download/v2.30.1/prometheus-2.30.1.linux-amd64.tar.gz

# tar xvzf prometheus-2.30.1.linux-amd64.tar.gz

• 관리 편의상 디렉터리명 변경

# mv prometheus-2.30.1.linux-amd64 prometheus

  • 재부팅시 자동 서비스 시동 구성

• 일반 사용자(예: ec2-user)로 돌아와서 다음과 같이 vi 에디터 편집

# sudo vi /etc/systemd/system/prometheus.service

1-2. Prometheus 설치

  • 재부팅시 자동 서비스 시동 구성

• 아래 내용을 붙여넣고 저장한다

[Unit]

Description=Prometheus Server

Documentation=https://prometheus.io/docs/introduction/overview/

After=network-online.target

[Service]

User=prometheus

Restart=on-failure

ExecStart=/home/prometheus/prometheus/prometheus \

  –config.file=/home/prometheus/prometheus/prometheus.yml \

  –storage.tsdb.path=/home/prometheus/prometheus/data

[Install]

WantedBy=multi-user.target

1-3. Prometheus 설치

  • 재부팅시 자동 서비스 시동 구성

• 서비스 구동

# sudo systemctl daemon-reload           # daemon 리로드

# sudo systemctl enable prometheus    # 재부팅시 자동 시작

# sudo systemctl start prometheus        #  Prometheus 서비스 시작

# sudo systemctl status prometheus

1-4. Prometheus 설치

  • ALB 연결 및 SG에서 9090 포트 오픈 후 브라우저에서 서비스 정상 작동 확인

2. Node Exporter 설치

  • 모니터링 대상 인스턴스에 Node Exporter를 압축해제 방식으로 설치

• 모니터링 대상 인스턴스에 사용자 추가

# useradd prometheus

# su – prometheus

• Prometheus 홈페이지(https://prometheus.io/download/)에서 Node Exporter 리눅스용 확인 후 링크 복사

2-1. Node Exporter 설치

  • 모니터링 대상 인스턴스에 Node Exporter를 압축해제 방식으로 설치

• 다운로드 및 압축해제

# wget https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz

# tar xvzf node_exporter-1.2.2.linux-amd64.tar.gz

• 관리 편의상 디렉터리명 변경

# mv node_exporter-1.2.2.linux-amd64 node_exporter

  • 재부팅시 자동 서비스 시동 구성

• 일반 사용자(예: ec2-user)로 돌아와서 다음과 같이 vi 에디터 편집

# sudo vi /etc/systemd/system/node_exporter.service

2-2. Node Exporter 설치

  • 재부팅시 자동 서비스 시동 구성

• 아래 내용을 붙여넣고 저장한다

[Unit]

Description=Prometheus Node Exporter

Documentation=https://prometheus.io/docs/guides/node-exporter/

Wants=network-online.target

After=network-online.target

[Service]

User=prometheus

Restart=on-failure

ExecStart=/home/prometheus/node_exporter/node_exporter

[Install]

WantedBy=multi-user.target

2-3. Node Exporter 설치

  • 재부팅시 자동 서비스 시동 구성

• 서비스 구동

# sudo systemctl daemon-reload               # daemon 리로드

# sudo systemctl enable node_exporter    # 재부팅시 자동 시작

# sudo systemctl start node_exporter        #  Node Exporter 서비스 시작

# sudo systemctl status node_exporter

2-4. Node Exporter 설치

  • SG 설정

• Node Exporter는 기본 설정일 경우 9100 포트를 사용하며 출발지 Prometheus 서버에서 목적자 Node Exporter 로 TCP 9100  포트 접근이 가능해야 한다

  • IAM Role 설정

• Prometheus 서버에서 모니터링 대상 인스턴스를 접근할 수 있도록 다음과 같은 Role을 생성하고  Prometheus 서버에 할당한다

3. Prometheus 서버 설정 수정 및 확인

  • Node Exporter와 연동 – 지정 인스턴스

# su – prometheus

# cd prometheus

# vi prometheus.yml

생략)

scrape_configs:

  – job_name: “prometheus”

    static_configs:

      – targets: [“localhost:9090”]

  – job_name: “node-01-static“                 # Prometheus에서 Job이름으로 쓰일 명칭을 입력한다

    static_configs:                                       # static_configs 이하에 모니터링 할 인스턴스 정보를 targets에 넣는다

    – targets: [‘10.0.4.149:9100’]

서버가 여러 대일 경우  targets을 추가 입력한다

  • yaml 파일 수정 후 Prometheus 데몬 재시작 필요 (systemctlrestartprometheus)

3-1. Prometheus 서버 설정 수정 및 확인

  • Prometheus 관리 웹페이지에서 설정한 job의 인스턴스 모니터링 가능

3-2. Prometheus 서버 설정 수정 및 확인

  • Node Exporter와 연동 – 다수 인스턴스

• Auto Scale 로 증가된 인스턴스와 같이 특정 지을 수 없는 경우는 static_configs 대신 ec2_sd_configs 를 사용한다

(생략)

scrape_configs:

  – job_name: “prometheus”

    static_configs:

      – targets: [“localhost:9090”]

  – job_name: “node-xx-as“                 # Prometheus에서 Job이름으로 쓰일 명칭을 입력한다

    ec2_sd_configs:

      – region: ap-northeast-2               # 리전

        port: 9100                                   # Node Export 사용 포트 입력

        filters:                                           # filters 옵션 미사용시 해당 리전의 9100포트를 사용하는 Node Exporter와 통신이 되는 모든 인스턴스 정보를 가져옴

          – name: tag:Monitor                  # filters 사용시에는 태그의 key, value 값을 지정해서 해당 태그를 사용하는 인스턴스 정보를 가져오게 된다

            values:                                       # 예시된 태그값은 Monitor: gp-01

              – gp-01

  • yaml 파일 수정 후 Prometheus 데몬 재시작 필요 (systemctlrestartprometheus)

3-3. Prometheus 서버 설정 수정 및 확인

  • Node Exporter와 연동 – 다수 인스턴스

• 예시로 Auto Scale 구성시 앞서의 태그값을 지정해 보도록 한다

3-4. Prometheus 서버 설정 수정 및 확인

  • Prometheus 관리 웹페이지에서 스케일 아웃된 인스턴스를 자동으로 모니터링 대상으로 가져옴을 확인 가능

4. #별첨 – 참고 사이트

https://prometheus.io/docs/introduction/overview/

https://koudingspawn.de/prometheus-aws-discovery/

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ec2_sd_config

감사합니다:)

문의: info@bespinglobal.com | 대표번호: 02-1668-1280

관련

모니터링서버Node인스턴스PrometheusExporterAuto ScalePrometheus 설치Node Exporter 설치오토스케일 대상 모니터링

HOT Trend

Recent Posts

  • 딜로이트도, 맥킨지도, 베스핀글로벌도: AI 에이전트로 일 바꾸는 시대

    2025년 07월 04일 클라우드베스핀글로벌clouddata데이터AI인공지능HelpNow AIbespinglobalAI에이전트helpnow업무자동화딜로이트
  • ⚔️데이터센터에서 시작된 전쟁? 요즘 뜨는 AIDC 개념부터 트렌드까지!

    2025년 06월 27일 클라우드clouddata데이터AI데이터센터클라우드 데이터센터bespinglobalAIDCAI 인프라베스핀글로벌
  • 구글부터 엔비디아까지, 빅테크 기업들의 AI 전략 최신본📖

    2025년 06월 20일 cloud베스핀글로벌클라우드data데이터AI구글마이크로소프트엔비디아AI에이전트google I/ONVIDIA GTC 2025Microsoft build 2025
  • AI를 연결한다고? 업계가 주목하는 ‘MCP’ 알아보기🔍

    2025년 06월 13일 베스핀글로벌클라우드cloudAIMCP
  • [WhaTap] RDS Failover/Reboot 관제 2 – RDS Failover

    2025년 05월 30일 RDSRDS FailoverRebootFailoverbespin global

베스핀글로벌은 모든 기업의 AI 혁신을 실현하기 위해, 세상에서 가장 혁신적이고 자동화된 AI 서비스와 솔루션을 만들어갑니다.
상호 : 베스핀글로벌 주식회사 ㅣ 대표자명 : 김써니, 허양호 ㅣ 사업자등록증번호 : 638-87-00223 ㅣ 통신판매번호 : 2019-서울서초-0347 ㅣ 대표전화 : 1668-1280
사업장주소지 : 서울특별시 서초구 강남대로 327, 13,14,15,16층(서초동,대륭서초타워) ㅣ 이메일 : info@bespinglobal.com ㅣ 개인정보 처리방침 ㅣ 개인정보 처리방침 안내

© 2026 BESPIN GLOBAL, All Rights Reserved.

BESPINGLOBAL
패밀리 사이트
China MEA SEA US

BESPIN Tech Blog
  • Home
  • Tech
    • CSP

      AWS

      GCP

      NCP

      Cloud

      Migration

      LZ, Control Tower

      Backup

      Monitoring

      Container

      Infra

      OS

      Middleware

      Data

      RDB

      Big Data Platform

      Application

      CI/CD

      BESPICK 구독하기 ㅣ 1668-1280

  • Trend
  • IT