책 367~372페이지 - 사용자 정의 prometheusrules 정책 설정 : 파일 시스템 사용률 80% 초과 시 시스템 경고 발생시키기 ⇒ 직접 실습 후 관련 스샷을 올려주세요
- alert: NodeFilesystemAlmostOutOfSpace-20
annotations:
description: Filesystem on {{ $labels.device }} at {{ $labels.instance }}
has only {{ printf "%.2f" $value }}% available space left.
runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemalmostoutofspace
summary: Filesystem has less than 20% space left.
expr: |-
(
node_filesystem_avail_bytes{job="node-exporter",fstype!="",mountpoint!=""} / node_filesystem_size_bytes{job="node-exporter",fstype!="",mountpoint!=""} * 100 < 20
and
node_filesystem_readonly{job="node-exporter",fstype!="",mountpoint!=""} == 0
)
for: 3m
labels:
severity: warning
ubuntu@i-0e40fe96653f2a31c:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 124G 105G 20G 85% /
(repush:N/A) [root@kops-ec2 ch19]# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
i-00f8a233c909d4e4e Ready node 112m v1.24.10 172.30.80.45 43.201.26.174 Ubuntu 20.04.5 LTS 5.15.0-1028-aws containerd://1.6.10
i-042526240cf7db78d NotReady node 90m v1.24.10 172.30.35.144 3.34.143.87 Ubuntu 20.04.5 LTS 5.15.0-1028-aws containerd://1.6.10
i-0e40fe96653f2a31c Ready node 115m v1.24.10 172.30.49.138 43.201.5.236 Ubuntu 20.04.5 LTS 5.15.0-1028-aws containerd://1.6.10
i-0e455e95e7da1446d Ready control-plane 120m v1.24.10 172.30.40.103 3.35.13.134 Ubuntu 20.04.5 LTS 5.15.0-1028-aws containerd://1.6.10
책 386~389페이지 - LogQL 사용법 익히기 ⇒ 직접 실습 후 관련 스샷을 올려주세요
Awesome Prometheus alerts 를 참고해서 스터디에서 배우지 않은 Alert Rule 생성 및 적용 후 관련 스샷을 올려주세요
rules:
- alert: HostOutOfMemory
expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100 < 10
for: 2m
labels:
severity: warning
annotations:
summary: Host out of memory (instance {{ $labels.instance }})
description: "Node memory is filling up (< 10% left)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"