값이 변하지 않을 때 경보 발생시키기
값이 변하지 않을 때 경보 발생시키기 (Alert on No Change in value)
설정한 기간 동안 메트릭 값이 변하지 않을 때 경보를 발생시키는 간단한 방법은 쿼리에 diff() 함수를 사용하는 거예요. 이 함수는 연속된 데이터 포인트 사이의 델타 값을 만들어줘요.
출처: 문서
본문
시작으로 쿼리에 diff() 함수를 적용해볼게요:
diff(avg:system.mem.free{*})
다음으로, 이 델타들의 절댓값을 구하기 위해 abs() 함수를 적용해요.
abs(diff(avg:system.mem.free{*}))
이 함수들은 UI에서 쿼리에 적용할 수 있어요.
{% image source="https://docs.dd-static.net/images/monitors/guide/alert_value_difference.4ffb4e05454df0db8afb5b1449af123a.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/monitors/guide/alert_value_difference.4ffb4e05454df0db8afb5b1449af123a.png?auto=format&fit=max&w=850&dpr=2 2x" alt="Apply diff function through Sigma icon > Rate > Value difference" /%}
또는 복잡한 쿼리를 'edit monitor' UI의 Source 탭에서 직접 입력할 수도 있어요 (또는 API를 통해 프로그래밍 방식으로 적용). 아래 이미지를 참고해요.
메트릭 모니터 자체의 알림 조건(alert conditions)은 다음과 같이 구성해요:
- threshold alert(임계값 알림)를 선택해요
- Trigger when the metric is… 드롭다운 선택자를 below or equal to(이하)로 설정해요
- Alert Threshold 필드를 0(영)으로 설정해요
이 구성은 선택한 시간 범위 동안 값 변화가 감지되지 않으면 경보 이벤트를 발생시켜요.
다른 알림 조건/옵션은 취향에 따라 설정할 수 있어요. 모니터의 UI 구성은 최종적으로 아래와 비슷하게 보여야 해요:
{% image source="https://docs.dd-static.net/images/monitors/faq/zero_alert.e28701f355ec6b913199a71f70ef1f3f.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/monitors/faq/zero_alert.e28701f355ec6b913199a71f70ef1f3f.png?auto=format&fit=max&w=850&dpr=2 2x" alt="zero_alert" /%}