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
ca8b6a2f
Commit
ca8b6a2f
authored
Dec 09, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
25d9442b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
es_status.py
celery_stats/es_status.py
+11
-1
No files found.
celery_stats/es_status.py
View file @
ca8b6a2f
...
@@ -36,6 +36,11 @@ access_token = '6eb687358606347cef617237cddab6a80e2f5981b46fe04950a96152e387f35c
...
@@ -36,6 +36,11 @@ access_token = '6eb687358606347cef617237cddab6a80e2f5981b46fe04950a96152e387f35c
def
get_cluster_stats
(
ip
):
def
get_cluster_stats
(
ip
):
if
"@"
in
ip
:
ip
,
auth
=
ip
.
split
(
"@"
,
1
)
node_requests_url
=
"http://{ip}:9200/_cluster/stats"
.
format
(
ip
=
ip
)
node_requests_res
=
requests
.
get
(
node_requests_url
,
verify
=
False
,
auth
=
tuple
(
auth
.
split
(
':'
,
1
)))
else
:
node_requests_url
=
"http://{ip}:9200/_cluster/stats"
.
format
(
ip
=
ip
)
node_requests_url
=
"http://{ip}:9200/_cluster/stats"
.
format
(
ip
=
ip
)
node_requests_res
=
requests
.
get
(
node_requests_url
)
node_requests_res
=
requests
.
get
(
node_requests_url
)
res_json
=
node_requests_res
.
json
()
res_json
=
node_requests_res
.
json
()
...
@@ -58,6 +63,11 @@ def get_index_stats(ip,index):
...
@@ -58,6 +63,11 @@ def get_index_stats(ip,index):
def
get_node_status
(
ip
):
def
get_node_status
(
ip
):
if
"@"
in
ip
:
ip
,
auth
=
ip
.
split
(
"@"
,
1
)
node_requests_url
=
"http://{ip}:9200/_nodes/stats"
.
format
(
ip
=
ip
)
node_requests_res
=
requests
.
get
(
node_requests_url
,
verify
=
False
,
auth
=
tuple
(
auth
.
split
(
':'
,
1
)))
else
:
node_requests_url
=
"http://{ip}:9200/_nodes/stats"
.
format
(
ip
=
ip
)
node_requests_url
=
"http://{ip}:9200/_nodes/stats"
.
format
(
ip
=
ip
)
node_requests_res
=
requests
.
get
(
node_requests_url
)
node_requests_res
=
requests
.
get
(
node_requests_url
)
res_json
=
node_requests_res
.
json
()
res_json
=
node_requests_res
.
json
()
...
@@ -149,5 +159,5 @@ def main_task(ip_list):
...
@@ -149,5 +159,5 @@ def main_task(ip_list):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# main_task('172.16.31.6')
# main_task('172.16.31.6')
ip_list
=
[
'172.16.52.29'
,
'172.16.52.25
'
,
'172.16.52.33
'
]
ip_list
=
[
'172.16.52.29'
,
'172.16.52.25
@elastic:gengmei!@#'
,
'172.16.52.33@elastic:gengmei!@#
'
]
main_task
(
ip_list
)
main_task
(
ip_list
)
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