프로메테우스 Exporter : Node(linux), WMI(window)

프로메테우스 가이드북
이민석's avatar
Jun 06, 2024
프로메테우스 Exporter : Node(linux), WMI(window)

프로메테우스 가이드북은 A to Z Metnros (Udemy) — Prometheus | The Complete Hands-On for Monitoring & Alerting를 듣고 작성한 가이드북입니다.

가이드북의 전체 목차 및 인덱싱은 프로메테우스 가이드북 — 소개 페이지를 참고해주세요.

개요

프로메테우스의 모니터링 기능을 제공받고 싶은 어플리케이션은 코드 레벨에서 직접 매트릭을 전송하거나 수집할 수 있도록 설정할 수 있을 것입니다.

하지만 시스템 레벨의 커널(kernel)의 매트릭은 어떻게 이를 수집할 수 있을까요?

그 해답은 exporter에 있습니다.

Exporter이란?

  • An exporter is a software of number of libraries and servers that help in exporting existing metrics from third-party systems (like Linuxs/Windows OS) in the same format as of Prometheus metrics

  • Useful for cases where it is not feasible to instrument a given system with Prometheus metrics directly.
    (e.g. HAProxy or Linux System stats)

[그림]

Linux System ←→ Exporter → Prometheus Server

  1. Linux System ←→ Exporter : Gather data from target

  2. Exporter ←→ Prometheus Server : Transform into correct format

Node Exporter

Node Exporter는 Unix(**NIX) 계열의 운영체제(OS) 및 하드웨어(HW) 매트릭을 위해서 사용합니다.

  • 커널 및 머신 수준의 매트릭을 노출합니다.

  • CPU, MEM, Disk Storage, Disk I/O, Network Bandwidth와 같은 매트릭을 제공합니다.

  • 플러그 가능한 매트릭 수집기와 동시에 Golang으로 작성되어 있습니다.

  • The Node Exporter is a Prometheus exporter for hardware and OS metrics exposed by Unix[**NIX]

  • It exposes kernel-level and machine-level metrics on Unix Systems, such as Linux.

  • When in action, it provides metrics such as CPU, memory, disk space, disk I/O, and network bandwidth.

  • It is written in Go with pluggable metric collectors.

이런 Node Exporter를 다운로드 받아 실행하면 수집이 시작됩니다. 예를 들어, UbuntuOS에서 Node Exporter를 실행하면 localhost:9100에 Node Exporter가 가동됩니다.

이후 localhost:9100/metrics에서 수집 가능한 매트릭 명단을 확인할 수 있습니다.

Node Exporter를 추가하기

작성한 Node Exporter에 대해서 Prometheus Server가 매트릭 수집을 할 수 있도록 Configuration File을 수정 해야 합니다.

scrap_configs 항목에 아래와 같이 새로운 job을 추가하면 됩니다.

scrap_configs:
  # other options
  # ...

 - job_name: 'node_exporter'
   static_configs:
   - targets: ['localhost:9100']

WMI(Windows Management Instrumentation) Exporter

Windows 기반의 시스템을 위한 Exporter가 별도로 존재합니다.

promtheus-community/windows_exporter 를 설치 & 실행하고 지정된 포트(e.g. 9144)에 접속하면 작동 상태를 확인할 수 있습니다.

이후, localhost:9144/metrics에서 수집가능한 매트릭을 모두 볼 수 있습니다.

수집된 매트릭에 대해서 Configuration File을 Node Exporter와 같이 변경하면, 작업이 완료됩니다.

Share article
RSSPowered by inblog