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
4ad1a2ec
Commit
4ad1a2ec
authored
Mar 12, 2021
by
JooHan Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prometheus, alert add
parent
938f1ee4
Pipeline
#5196
passed with stages
in 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
README.md
DOCKER/PROMETHEUS/README.md
+84
-0
No files found.
DOCKER/PROMETHEUS/README.md
View file @
4ad1a2ec
...
...
@@ -96,6 +96,90 @@ placement:
constraints
:
[
node
.
hostname
==
TB2
-
DOCKER
]
```
-
**prometheus**
의 구성내역
```
bash
# cat prometheus.yml
global:
scrape_interval: 15s
external_labels:
monitor:
'hongsnet'
scrape_configs:
- job_name:
'prometheus'
static_configs:
- targets:
[
'127.0.0.1:9090'
]
- job_name:
'node-exporter'
static_configs:
- targets:
[
'172.24.0.245:9100'
,
'172.24.0.151:9100'
,
'172.16.0.158:9100'
,
'172.16.0.251:9100'
]
- job_name:
'cadvisor'
static_configs:
- targets:
[
'172.24.0.245:8080'
,
'172.24.0.151:8080'
,
'172.16.0.158:8080'
,
'172.16.0.251:8080'
]
rule_files:
-
'alert.rules'
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager:9093
```
또한
**alert.rules**
내역은 다음과 같다.
```
bash
# cat alert.rules
groups
:
- name: host
rules:
- alert: high_cpu_load
expr
: node_load1
>
1.5
for
: 30s
labels:
severity: warning
annotations:
summary:
"Server under high load"
description:
"Docker host is under high load, the avg load 1m is at {{
$value
}}. Reported by instance {{
$labels
.instance }} of job {{
$labels
.job }}."
- alert: high_memory_load
expr
:
(
sum
(
node_memory_MemTotal_bytes
)
-
sum
(
node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes
)
)
/
sum
(
node_memory_MemTotal_bytes
)
*
100
>
85
for
: 30s
labels:
severity: warning
annotations:
summary:
"Server memory is almost full"
description:
"Docker host memory usage is {{ humanize
$value
}}%. Reported by instance {{
$labels
.instance }} of job {{
$labels
.job }}."
- alert: high_storage_load
expr
:
(
node_filesystem_size_bytes
{
fstype
=
"aufs"
}
- node_filesystem_free_bytes
{
fstype
=
"aufs"
})
/ node_filesystem_size_bytes
{
fstype
=
"aufs"
}
*
100
>
85
for
: 30s
labels:
severity: warning
annotations:
summary:
"Server storage is almost full"
description:
"Docker host storage usage is {{ humanize
$value
}}%. Reported by instance {{
$labels
.instance }} of job {{
$labels
.job }}."
- name: containers
rules:
- alert: High Pod Memory
expr
:
sum
(
container_memory_usage_bytes
)
>
1
for
: 30s
labels:
severity: critical
annotations:
summary:
"memory usage test"
description:
"test container is down for more than 30 seconds."
- alert: ContainerKilled
expr
:
time
()
- container_last_seen
>
60
for
: 1m
labels:
severity: warning
annotations:
summary:
"Container killed (instance {{
$labels
.instance }})"
description:
"A container has disappeared
\n
VALUE = {{
$value
}}
\n
LABELS: {{
$labels
}}"
```
이제
**monitor**
서비스를 다음과 같이 실행한다.
```
bash
...
...
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