일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- Octavia
- grafana-loki
- golang
- k8s
- archlinux
- ceph-ansible
- ubuntu
- pacman
- HTML
- kolla-ansible
- repository
- i3
- nfs-provisioner
- cloud-init
- kolla
- OpenStack
- KVM
- libvirt
- Linux
- Kubeflow
- ceph
- Docker
- terraform
- Kubernetes
- Ansible
- port open
- awx
- yum
- cephadm
- Arch
Archives
- Today
- Total
YJWANG
[Kolla-ansible] prometheus custom rule 추가하기 본문
아래와 같이 kolla config 경로에 rules 파일을 생성해줍니다.
# ls -l /etc/kolla/config/prometheus/
total 20
-rw-r--r-- 1 root root 13995 Aug 6 03:41 first_rules.rules
파일 내용은 아래와 같습니다.
rule 샘플은 링크를 참고합니다.
https://github.com/samber/awesome-prometheus-alerts
# cat /etc/kolla/config/prometheus/first_rules.rules
groups:
- name: nodeExpoter
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 }}"
- alert: HostMemoryUnderMemoryPressure
expr: rate(node_vmstat_pgmajfault[1m]) > 1000
for: 2m
labels:
severity: warning
annotations:
summary: Host memory under memory pressure (instance {{ $labels.instance }})
description: "The node is under heavy memory pressure. High rate of major page faults\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
# cat /etc/kolla/config/prometheus/first_rules.rules
groups:
- name: nodeExpoter
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 }}"
- alert: HostMemoryUnderMemoryPressure
expr: rate(node_vmstat_pgmajfault[1m]) > 1000
for: 2m
labels:
severity: warning
annotations:
summary: Host memory under memory pressure (instance {{ $labels.instance }})
description: "The node is under heavy memory pressure. High rate of major page faults\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
이후 reconfigure 이나 deploy를 진행하면 자동으로 prometheus.yml 과 rule이 추가됩니다.
# kolla-ansible -i all-in-one deploy -t prometheus
# ls -l /etc/kolla/prometheus-server/
total 24
-rw-rw---- 1 root root 1284 Jul 30 05:04 config.json
-rw-rw---- 1 root root 13995 Aug 6 03:41 first_rules.rules
-rw-rw---- 1 root root 952 Aug 6 03:41 prometheus.yml
# grep -ir 'rule' /etc/kolla/prometheus-server/prometheus.yml
rule_files:
- /etc/prometheus/first_rules.rules
반응형