Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
obdeploy
提交
73283db4
O
obdeploy
项目概览
oceanbase
/
obdeploy
1 年多 前同步成功
通知
7
Star
73
Fork
132
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obdeploy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
未验证
提交
73283db4
编写于
6月 28, 2021
作者:
R
Rongfeng Fu
提交者:
GitHub
6月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.0.2 (#17)
* memory and disk check * 1.0.2
上级
9664cb9c
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
17 addition
and
21 deletion
+17
-21
_cmd.py
_cmd.py
+1
-1
ob-deploy.spec
ob-deploy.spec
+4
-2
plugins/mysqltest/3.1.0/init.py
plugins/mysqltest/3.1.0/init.py
+1
-1
plugins/oceanbase/3.1.0/start_check.py
plugins/oceanbase/3.1.0/start_check.py
+11
-17
未找到文件。
_cmd.py
浏览文件 @
73283db4
...
@@ -35,7 +35,7 @@ from tool import DirectoryUtil, FileUtil
...
@@ -35,7 +35,7 @@ from tool import DirectoryUtil, FileUtil
ROOT_IO
=
IO
(
1
)
ROOT_IO
=
IO
(
1
)
VERSION
=
'1.0.
1
'
VERSION
=
'1.0.
2
'
REVISION
=
'<CID>'
REVISION
=
'<CID>'
BUILD_BRANCH
=
'<B_BRANCH>'
BUILD_BRANCH
=
'<B_BRANCH>'
BUILD_TIME
=
'<B_TIME>'
BUILD_TIME
=
'<B_TIME>'
...
...
ob-deploy.spec
浏览文件 @
73283db4
Name: ob-deploy
Name: ob-deploy
Version: 1.0.
1
Version: 1.0.
2
Release: 1%{?dist}
Release: 1%{?dist}
# if you want use the parameter of rpm_create on build time,
# if you want use the parameter of rpm_create on build time,
# uncomment below
# uncomment below
...
@@ -106,3 +106,5 @@ echo -e 'Installation of obd finished successfully\nPlease source /etc/profile.d
...
@@ -106,3 +106,5 @@ echo -e 'Installation of obd finished successfully\nPlease source /etc/profile.d
- cancel the timeout limit for waiting for the cluster to initialize
- cancel the timeout limit for waiting for the cluster to initialize
- new configuration item for store log
- new configuration item for store log
- support SUSE, Ubuntu etc.
- support SUSE, Ubuntu etc.
* Mon Jun 28 2021 obd 1.0.2
- fix memory and disk check bug
\ No newline at end of file
plugins/mysqltest/3.1.0/init.py
浏览文件 @
73283db4
...
@@ -31,7 +31,7 @@ def parse_size(size):
...
@@ -31,7 +31,7 @@ def parse_size(size):
_bytes
=
int
(
size
)
_bytes
=
int
(
size
)
else
:
else
:
units
=
{
"B"
:
1
,
"K"
:
1
<<
10
,
"M"
:
1
<<
20
,
"G"
:
1
<<
30
,
"T"
:
1
<<
40
}
units
=
{
"B"
:
1
,
"K"
:
1
<<
10
,
"M"
:
1
<<
20
,
"G"
:
1
<<
30
,
"T"
:
1
<<
40
}
match
=
re
.
match
(
r
'([1-9][0-9]*)
([B,K,M,G,T])'
,
size
)
match
=
re
.
match
(
r
'([1-9][0-9]*)
\s*([B,K,M,G,T])'
,
size
.
upper
()
)
_bytes
=
int
(
match
.
group
(
1
))
*
units
[
match
.
group
(
2
)]
_bytes
=
int
(
match
.
group
(
1
))
*
units
[
match
.
group
(
2
)]
return
_bytes
return
_bytes
...
...
plugins/oceanbase/3.1.0/start_check.py
浏览文件 @
73283db4
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
from
__future__
import
absolute_import
,
division
,
print_function
from
__future__
import
absolute_import
,
division
,
print_function
import
os
import
re
import
re
...
@@ -27,17 +28,6 @@ stdio = None
...
@@ -27,17 +28,6 @@ stdio = None
success
=
True
success
=
True
def
parse_size
(
size
):
_bytes
=
0
if
not
isinstance
(
size
,
str
)
or
size
.
isdigit
():
_bytes
=
int
(
size
)
else
:
units
=
{
"B"
:
1
,
"K"
:
1
<<
10
,
"M"
:
1
<<
20
,
"G"
:
1
<<
30
,
"T"
:
1
<<
40
}
match
=
re
.
match
(
r
'([1-9][0-9]*)([B,K,M,G,T])'
,
size
)
_bytes
=
int
(
match
.
group
(
1
))
*
units
[
match
.
group
(
2
)]
return
_bytes
def
get_port_socket_inode
(
client
,
port
):
def
get_port_socket_inode
(
client
,
port
):
port
=
hex
(
port
)[
2
:].
zfill
(
4
).
upper
()
port
=
hex
(
port
)[
2
:].
zfill
(
4
).
upper
()
cmd
=
"bash -c 'cat /proc/net/{tcp,udp}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq"
%
port
cmd
=
"bash -c 'cat /proc/net/{tcp,udp}' | awk -F' ' '{print $2,$10}' | grep '00000000:%s' | awk -F' ' '{print $2}' | uniq"
%
port
...
@@ -54,7 +44,7 @@ def parse_size(size):
...
@@ -54,7 +44,7 @@ def parse_size(size):
_bytes
=
int
(
size
)
_bytes
=
int
(
size
)
else
:
else
:
units
=
{
"B"
:
1
,
"K"
:
1
<<
10
,
"M"
:
1
<<
20
,
"G"
:
1
<<
30
,
"T"
:
1
<<
40
}
units
=
{
"B"
:
1
,
"K"
:
1
<<
10
,
"M"
:
1
<<
20
,
"G"
:
1
<<
30
,
"T"
:
1
<<
40
}
match
=
re
.
match
(
r
'([1-9][0-9]*)
([B,K,M,G,T])'
,
size
)
match
=
re
.
match
(
r
'([1-9][0-9]*)
\s*([B,K,M,G,T])'
,
size
.
upper
()
)
_bytes
=
int
(
match
.
group
(
1
))
*
units
[
match
.
group
(
2
)]
_bytes
=
int
(
match
.
group
(
1
))
*
units
[
match
.
group
(
2
)]
return
_bytes
return
_bytes
...
@@ -127,7 +117,7 @@ def start_check(plugin_context, strict_check=False, *args, **kwargs):
...
@@ -127,7 +117,7 @@ def start_check(plugin_context, strict_check=False, *args, **kwargs):
memory
[
'percentage'
]
+=
int
(
parse_size
(
server_config
[
'memory_limit_percentage'
]))
memory
[
'percentage'
]
+=
int
(
parse_size
(
server_config
[
'memory_limit_percentage'
]))
else
:
else
:
memory
[
'percentage'
]
+=
80
memory
[
'percentage'
]
+=
80
data_path
=
server_config
[
'data_dir'
]
if
'data_dir'
in
server_config
else
server_config
[
'home_path'
]
data_path
=
server_config
[
'data_dir'
]
if
'data_dir'
in
server_config
else
os
.
path
.
join
(
server_config
[
'home_path'
],
'store'
)
if
not
client
.
execute_command
(
'ls %s/sstable/block_file'
%
data_path
):
if
not
client
.
execute_command
(
'ls %s/sstable/block_file'
%
data_path
):
if
data_path
in
disk
:
if
data_path
in
disk
:
critical
(
'Same Path: %s in %s and %s'
%
(
data_path
,
server
,
disk
[
data_path
][
'server'
]))
critical
(
'Same Path: %s in %s and %s'
%
(
data_path
,
server
,
disk
[
data_path
][
'server'
]))
...
@@ -171,11 +161,15 @@ def start_check(plugin_context, strict_check=False, *args, **kwargs):
...
@@ -171,11 +161,15 @@ def start_check(plugin_context, strict_check=False, *args, **kwargs):
alert
(
'(%s) The recommended number of open files is 655350 (Current value: %s)'
%
(
ip
,
max_of
))
alert
(
'(%s) The recommended number of open files is 655350 (Current value: %s)'
%
(
ip
,
max_of
))
# memory
# memory
ret
=
client
.
execute_command
(
"free -b | grep Mem | awk -F' ' '{print $2, $4}'"
)
ret
=
client
.
execute_command
(
'cat /proc/meminfo'
)
if
ret
:
if
ret
:
total_memory
,
free_memory
=
ret
.
stdout
.
split
(
' '
)
total_memory
=
0
total_memory
=
int
(
total_memory
)
free_memory
=
0
free_memory
=
int
(
free_memory
)
for
k
,
v
in
re
.
findall
(
'(\w+)\s*:\s*(\d+\s*\w+)'
,
ret
.
stdout
):
if
k
==
'MemTotal'
:
total_memory
=
parse_size
(
str
(
v
))
elif
k
==
'MemAvailable'
:
free_memory
=
parse_size
(
str
(
v
))
total_use
=
servers_memory
[
ip
][
'percentage'
]
*
total_memory
/
100
+
servers_memory
[
ip
][
'num'
]
total_use
=
servers_memory
[
ip
][
'percentage'
]
*
total_memory
/
100
+
servers_memory
[
ip
][
'num'
]
if
total_use
>
free_memory
:
if
total_use
>
free_memory
:
critical
(
'(%s) not enough memory. (Free: %s, Need: %s)'
%
(
ip
,
formate_size
(
free_memory
),
formate_size
(
total_use
)))
critical
(
'(%s) not enough memory. (Free: %s, Need: %s)'
%
(
ip
,
formate_size
(
free_memory
),
formate_size
(
total_use
)))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录