Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
meta_base_code
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
黎涛
meta_base_code
Commits
9dce1a53
Commit
9dce1a53
authored
Dec 09, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
0492d468
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
es_status.py
celery_stats/es_status.py
+8
-10
No files found.
celery_stats/es_status.py
View file @
9dce1a53
...
...
@@ -81,9 +81,10 @@ def get_node_status(ip):
query_current
=
data
[
"indices"
][
"search"
][
"query_current"
]
fetch_current
=
data
[
"indices"
][
"search"
][
"fetch_current"
]
cpu_percent
=
data
[
"os"
][
"cpu"
][
"percent"
]
cpu_1m
=
data
[
"os"
][
"cpu"
][
"load_average"
][
'1m'
]
cpu_5m
=
data
[
"os"
][
"cpu"
][
"load_average"
][
'5m'
]
cpu_15m
=
data
[
"os"
][
"cpu"
][
"load_average"
][
'15m'
]
cpu_1m
=
data
[
"process"
][
"cpu"
][
"percent"
]
# cpu_1m = data["os"]["cpu"]["load_average"]['1m']
# cpu_5m = data["os"]["cpu"]["load_average"]['5m']
# cpu_15m = data["os"]["cpu"]["load_average"]['15m']
young_gc
=
data
[
"jvm"
][
"gc"
][
"collectors"
][
'young'
][
'collection_count'
]
young_gc_ms
=
data
[
"jvm"
][
"gc"
][
"collectors"
][
'young'
][
'collection_time_in_millis'
]
old_gc
=
data
[
"jvm"
][
"gc"
][
"collectors"
][
'young'
][
'collection_count'
]
...
...
@@ -91,8 +92,7 @@ def get_node_status(ip):
search_thread_pool
=
data
[
"thread_pool"
][
"search"
]
young_gc_per_ms
=
int
(
young_gc_ms
/
young_gc
)
old_gc_ms
=
int
(
old_gc_ms
/
old_gc
)
yield
node_name
,
ip
,
query_time
,
query_current
,
fetch_current
,
cpu_percent
,
cpu_1m
,
cpu_5m
,
cpu_15m
,
\
young_gc_per_ms
,
old_gc
,
old_gc_ms
,
search_thread_pool
yield
node_name
,
ip
,
query_time
,
query_current
,
fetch_current
,
cpu_percent
,
cpu_1m
,
young_gc_per_ms
,
old_gc
,
old_gc_ms
,
search_thread_pool
def
parse_cluster_stats
(
data
):
...
...
@@ -109,7 +109,7 @@ def parse_cluster_stats(data):
def
parse_node_stats
(
data
):
res_str
=
""
node_name
,
ip
,
query_time
,
query_current
,
fetch_current
,
cpu_percent
,
cpu_1m
,
cpu_5m
,
cpu_15m
,
young_gc
,
\
node_name
,
ip
,
query_time
,
query_current
,
fetch_current
,
cpu_percent
,
cpu_1m
,
young_gc
,
\
old_gc
,
old_gc_ms
,
search_thread_pool
=
data
if
not
data_dict
.
get
(
node_name
):
data_dict
[
node_name
]
=
{}
...
...
@@ -128,11 +128,9 @@ def parse_node_stats(data):
res_str
+=
"{name}节点 old_gc增长中 old_gc为{old_gc} 平均{old_gc_ms}ms
\n
"
.
format
(
name
=
node_name
,
old_gc
=
str
(
old_gc
),
old_gc_ms
=
str
(
old_gc_ms
))
if
cpu_1m
>=
cpu_top
or
cpu_5m
>=
cpu_top
or
cpu_15m
>=
cpu_top
:
res_str
+=
"{name}节点CPU使用率预警 1m {cpu_1m}
5m {cpu_5m} 15m {cpu_15m}
\n
"
\
if
cpu_1m
>=
cpu_top
:
res_str
+=
"{name}节点CPU使用率预警 1m {cpu_1m}
\n
"
\
"目前 query_current为{query_current} fetch_current为{fetch_current} young_gc为{young_gc}ms"
.
format
(
cpu_1m
=
str
(
int
(
cpu_1m
*
100
))
+
"
%
"
,
name
=
node_name
,
cpu_5m
=
str
(
int
(
cpu_5m
*
100
))
+
"
%
"
,
cpu_15m
=
str
(
int
(
cpu_15m
*
100
))
+
"
%
"
,
query_current
=
str
(
query_current
),
fetch_current
=
str
(
fetch_current
),
young_gc
=
str
(
young_gc
))
data_dict
[
node_name
][
'old_gc'
]
=
old_gc
...
...
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