본문 바로가기
ops/kubernetes

쿠버네티스 클러스터에서 프로메테우스 metric을 그라파나 data source 로 사용하기 - 3

by seohan1010 2026. 1. 13.

진행할 작업 

 

1.시각화 영역에서 데이터의 모든 Labels가 아닌 특정 노드에 대한 정보만 확인할수 있도록 수정할 계획 

2. 사용중인 용량 / 전체 용량을 하나의 시각화(Gauge)로 출력할 계획 



-인스턴스 label만 출력되게 하기 


Transformation -> Add transformation 





맨 우측 Labels to fields 선택


instance 선택


 

instance 정보만 출력


Rename fields by regex를 사용하여 



정규식으로 포트번호를 제외한 ip만 확인할수 있도록 할수 있음 





-하나의 gauge에서 디스크 사용량을 확인할수 있도록 하기 

#쿼리문
100 * (
  1 -
  last_over_time(
  node_filesystem_avail_bytes{
    instance="20.0.0.2:9100",
    mountpoint="/",
    fstype!~"tmpfs|overlay|squashfs"
  }[5m])
  /
  last_over_time(
  node_filesystem_size_bytes{
    instance="20.0.0.2:9100",
    mountpoint="/",
    fstype!~"tmpfs|overlay|squashfs"
  }[5m])

)


 쿼리문을 하나만 남기고 위의 쿼리를 입력 


쿼리문 옵션을 Instant로 설정 


gauge 설정 화면의 Standard options을 위와 같이 설정 






출력 화면 


threshold를 설정하여 
사용가능한 용량에 따라 
색이 변하도록 할수 있음