본문 바로가기
ops/kubernetes

워커노드의 disk-usage에 따라 alert발생 시키기 - 1(쿼리문)

by seohan1010 2026. 1. 12.

prometheus 쿼리문 작성 

#사용할 쿼리문-1
node_filesystem_avail_bytes{mountpoint="/",fstype!~"tmpfs|overlay|squashfs"} #사용가능용량

#사용할 쿼리문-2
 node_filesystem_size_bytes{mountpoint="/",fstype!~"tmpfs|overlay|squashfs"} #전체용량
 
 #사용중인용량
 100 * (
  1 -
  node_filesystem_avail_bytes{
    mountpoint="/",
    fstype!~"tmpfs|overlay|squashfs"
  }
  /
  node_filesystem_size_bytes{
    mountpoint="/",
    fstype!~"tmpfs|overlay|squashfs"
  }
)


각 노드의 사용중인 용량 계산 

#쿼리문
 100 * (
  1 -
  node_filesystem_avail_bytes{
    instance="20.0.0.2:9100",        #노드를 식별
    mountpoint="/",
    fstype!~"tmpfs|overlay|squashfs"
  }
  /
  node_filesystem_size_bytes{
    instance="20.0.0.2:9100",        #노드를 식별  
    mountpoint="/",
    fstype!~"tmpfs|overlay|squashfs"
  }
)