Cloud/AWS

[AWS] AppStream With Prometheus Monitoring

chronosa 2020. 10. 19. 10:37

1. 목표

AWS AppStream2.0의 gpu 사용량을 모니터링

기존에 익숙한 Zabbix 대신 Prometheus를 사용한 이유는 Nvidia-SMI 기반 Exporter가 이미 Github에 있었고 (물론 Windows용으로 사용하기 위해서는 스크립트를 수정해야 했다), 동적으로 확장되는 특징을 가지고 있기 때문에 이를 동적으로 인식하기 위해서는 Zabbix의 Discovery 기능을 활용해야 하는데, 이는 호스트 단위로 제공되는 기능임. 또한, 세션 ID 및 User ID를 같이 Labels에 적용하기에 적합하지 않아 금번에 Prometheus를 활용하여 테스트 수행

 

2. 사용 솔루션

  • Nvidia-smi
  • AWS AppStream2.0
  • Prometheus
  • Docker
  • 약간의 Python 및 Golang

3. 테스트 내용

  • AWS AppStream2.0에 Exporter 적용 (service.exe 형식)
  • g4dn type에 기본적으로 내장되어 있는 nvidia-smi.exe 파일을 이용하여 gpu 성능 현황을 검출할 수 있는 Exporter  개발
  • Docker를 이용하여 Prometheus 기동 (※ 향후 필요시 K8S 적용)
  • Prometheus에서 제공하는 FILE-BASED SERVICE DISCOVERY 기능을 활용하여 AppStream Fleet Instance Monitoring 스크립트 개발
  • Prometheus HTTP API를 활용하여 데이터 추출

4. Prometheus?

Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud.
Prometheus joined the Cloud Native Computing Foundation in 2016 as the second hosted project, after Kubernetes

 

Production-Grade Container Orchestration

Production-Grade Container Orchestration

kubernetes.io

Features

  • a multi-dimensional data model with time series data identified by metric name and key/value pairs
  • PromQL, a flexible query language to leverage this dimensionality
  • no reliance on distributed storage; single server nodes are autonomous
  • time series collection happens via a pull model over HTTP
  • pushing time series is supported via an intermediary gateway
  • targets are discovered via service discovery or static configuration
  • multiple modes of graphing and dashboarding support

Architecture

prometheus.io/assets/architecture.png

5. Simple Architecture

6. Github URL

github.com/chronosa/appstream_nvidia_smi_exporter/blob/master/README.md