Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
joohanhong
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JooHan Hong
joohanhong
Commits
72ed0511
Commit
72ed0511
authored
Mar 31, 2021
by
JooHan Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
high cpu load 1차완료
parent
cfb3ce71
Pipeline
#5318
passed with stages
in 47 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
0 deletions
+82
-0
README.md
DOCKER/PROMETHEUS/ITEM/NODES/RESULT/CPULOAD/README.md
+82
-0
high_cpu.png
DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu.png
+0
-0
high_cpu_alert.png
DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu_alert.png
+0
-0
high_cpu_resolved.png
DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu_resolved.png
+0
-0
high_cpu_verify.png
DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu_verify.png
+0
-0
No files found.
DOCKER/PROMETHEUS/ITEM/NODES/RESULT/CPULOAD/README.md
0 → 100644
View file @
72ed0511
[

](https://www.hongsnet.net)
# Node High CPU Usage Issue 검증
> Node의 전체 CPU 사용률에 대한 모니터링을 수행한다.
# Configuration
2분 동안 CPU 사용률이
`80`
% 이상인 경우가 감지된 경우 Alert을 발생시키는 Rule
-
**결과**

-
**검증 과정**
*
[
**STEP 1**
]
: Prometheus의 Graph 메뉴의 Expression에서 수식에 대한 검증을 진행한다.

> 대상 Node에 현재의 CPU Usage(%) 값이 쿼리 된다.
*
[
**STEP 2**
]
: Prometheus Configmap 파일에 ITEM을 추가한다.
```
bash
# cat prometheus-config-map.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-server-conf
labels:
name: prometheus-server-conf
namespace: monitoring
data:
prometheus.rules: |-
groups
:
- name: Node High CPU Load
rules:
- alert: HostHighCpuLoad
expr
: 100 -
(
avg by
(
instance
)
(
rate
(
node_cpu_seconds_total
{
mode
=
"idle"
}[
2m]
))
*
100
)
>
80
for
: 0m
labels:
severity: warning
annotations:
summary:
"Host high CPU load (instance {{
$labels
.instance }})"
description:
"CPU load is > 80%
\n
VALUE = {{
$value
}}
\n
LABELS: {{
$labels
}}"
...하략
```
*
[
**STEP 3**
]
: kubectl 툴을 이용하여 Replace 처리하고, curl을 이용하여 POST
**reload**
Payload를 전송한다.
```
bash
# kubectl replace -f prometheus-config-map.yaml
# curl -X POST http://172.24.0.222:30003/-/reload
```
> 또는 prometheus를 재시작하면 즉시 적용된다.
# Verify
*
[
**STEP 1**
]
: 검증을 위해 80% 기준을
`5`
%로 변경한다.
```
python
expr
:
100
-
(
avg
by
(
instance
)
(
rate
(
node_cpu_seconds_total
{
mode
=
"idle"
}[
2
m
]))
*
100
)
>
5
```
*
[
**STEP 2**
]
: Alert Manager를 통한 Alert 발송을 확인한다. 5%로 변경되었기 때문에 대부분의 Node가 해당된 상태이다.

*
[
**STEP 3**
]
: Resolved를 검증하기 위해 다시 기존 80%로 변경한다.
```
python
expr
:
100
-
(
avg
by
(
instance
)
(
rate
(
node_cpu_seconds_total
{
mode
=
"idle"
}[
2
m
]))
*
100
)
>
80
```
*
[
**STEP 4**
]
: Alert Manager를 통한
`Resolved`
Alert 발송을 확인한다.

DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu.png
0 → 100644
View file @
72ed0511
12.3 KB
DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu_alert.png
0 → 100644
View file @
72ed0511
50.4 KB
DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu_resolved.png
0 → 100644
View file @
72ed0511
51 KB
DOCKER/PROMETHEUS/ITEM/NODES/images/high_cpu_verify.png
0 → 100644
View file @
72ed0511
19.2 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment