Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2bf46ddc
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2bf46ddc
编写于
3月 03, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
monitor
上级
3fbb78a9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
44 deletion
+51
-44
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+6
-6
include/os/osSysinfo.h
include/os/osSysinfo.h
+2
-2
source/dnode/mgmt/impl/inc/dndMnode.h
source/dnode/mgmt/impl/inc/dndMnode.h
+1
-0
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+16
-17
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+7
-0
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+19
-19
未找到文件。
include/libs/monitor/monitor.h
浏览文件 @
2bf46ddc
...
...
@@ -94,12 +94,12 @@ typedef struct {
float
disk_engine
;
// GB
float
disk_used
;
// GB
float
disk_total
;
// GB
float
net_in
;
// Kb/s
float
net_out
;
// Kb/s
float
io_read
;
// Mb/s
float
io_write
;
// Mb/s
float
io_read_disk
;
// Mb/s
float
io_write_disk
;
// Mb/s
int64_t
net_in
;
int64_t
net_out
;
float
io_read
;
float
io_write
;
float
io_read_disk
;
float
io_write_disk
;
int32_t
req_select
;
float
req_select_rate
;
int32_t
req_insert
;
...
...
include/os/osSysinfo.h
浏览文件 @
2bf46ddc
...
...
@@ -45,8 +45,8 @@ int32_t taosGetSysMemory(int64_t *usedKB);
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SDiskSize
*
diskSize
);
int32_t
taosReadProcIO
(
int64_t
*
rchars
,
int64_t
*
wchars
);
int32_t
taosGetProcIO
(
float
*
readKB
,
float
*
writeKB
);
bool
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
);
bool
taosGetBandSpeed
(
float
*
bandSpeedKb
);
int32_t
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
);
int32_t
taosGetBandSpeed
(
float
*
bandSpeedKb
);
int32_t
taosSystem
(
const
char
*
cmd
);
void
taosKillSystem
();
...
...
source/dnode/mgmt/impl/inc/dndMnode.h
浏览文件 @
2bf46ddc
...
...
@@ -34,6 +34,7 @@ int32_t dndProcessDropMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
int32_t
dndGetMnodeMonitorInfo
(
SDnode
*
pDnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
);
int8_t
dndIsMnode
(
SDnode
*
pDnode
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
2bf46ddc
...
...
@@ -486,26 +486,25 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
taosGetProcMemory
(
&
pInfo
->
mem_engine
);
taosGetSysMemory
(
&
pInfo
->
mem_system
);
pInfo
->
mem_total
=
tsTotalMemoryKB
;
pInfo
->
disk_engine
=
4
.
1
;
pInfo
->
disk_used
=
4
.
2
;
pInfo
->
disk_total
=
4
.
3
;
pInfo
->
net_in
=
5
.
1
;
pInfo
->
net_out
=
5
.
2
;
pInfo
->
disk_engine
=
0
;
pInfo
->
disk_used
=
tsDataSpace
.
size
.
used
/
(
1024
*
1024
*
1024
.
0
);
pInfo
->
disk_total
=
tsDataSpace
.
size
.
avail
/
(
1024
*
1024
*
1024
.
0
);
taosGetCardInfo
(
NULL
,
&
pInfo
->
net_in
,
&
pInfo
->
net_out
);
taosGetProcIO
(
&
pInfo
->
io_read
,
&
pInfo
->
io_write
);
pInfo
->
io_read_disk
=
0
;
pInfo
->
io_write_disk
=
0
;
pInfo
->
req_select
=
8
;
pInfo
->
req_select_rate
=
8
.
1
;
pInfo
->
req_insert
=
9
;
pInfo
->
req_insert_success
=
1
0
;
pInfo
->
req_insert_rate
=
10
.
1
;
pInfo
->
req_insert_batch
=
11
;
pInfo
->
req_insert_batch_success
=
12
;
pInfo
->
req_insert_batch_rate
=
12
.
3
;
pInfo
->
errors
=
4
;
pInfo
->
vnodes_num
=
5
;
pInfo
->
masters
=
6
;
pInfo
->
has_mnode
=
1
;
pInfo
->
req_select
=
0
;
pInfo
->
req_select_rate
=
0
;
pInfo
->
req_insert
=
0
;
pInfo
->
req_insert_success
=
0
;
pInfo
->
req_insert_rate
=
0
;
pInfo
->
req_insert_batch
=
0
;
pInfo
->
req_insert_batch_success
=
0
;
pInfo
->
req_insert_batch_rate
=
0
;
pInfo
->
errors
=
0
;
pInfo
->
vnodes_num
=
0
;
pInfo
->
masters
=
0
;
pInfo
->
has_mnode
=
dndIsMnode
(
pDnode
)
;
}
static
void
dndSendMonitorReport
(
SDnode
*
pDnode
)
{
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
2bf46ddc
...
...
@@ -639,4 +639,11 @@ int32_t dndGetMnodeMonitorInfo(SDnode *pDnode, SMonClusterInfo *pClusterInfo, SM
int32_t
code
=
mndGetMonitorInfo
(
pMnode
,
pClusterInfo
,
pVgroupInfo
,
pGrantInfo
);
dndReleaseMnode
(
pDnode
,
pMnode
);
return
code
;
}
int8_t
dndIsMnode
(
SDnode
*
pDnode
)
{
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
==
NULL
)
return
0
;
dndReleaseMnode
(
pDnode
,
pMnode
);
return
1
;
}
\ No newline at end of file
source/os/src/osSysinfo.c
浏览文件 @
2bf46ddc
...
...
@@ -112,16 +112,16 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
}
}
bool
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
)
{
int32_t
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
)
{
if
(
bytes
)
*
bytes
=
0
;
if
(
rbytes
)
*
rbytes
=
0
;
if
(
tbytes
)
*
tbytes
=
0
;
return
true
;
return
0
;
}
bool
taosGetBandSpeed
(
float
*
bandSpeedKb
)
{
int32_t
taosGetBandSpeed
(
float
*
bandSpeedKb
)
{
*
bandSpeedKb
=
0
;
return
true
;
return
0
;
}
int32_t
taosReadProcIO
(
int64_t
*
readbyte
,
int64_t
*
writebyte
)
{
...
...
@@ -271,16 +271,16 @@ int32_t taosGetProcIO(float *readKB, float *writeKB) {
return
0
;
}
bool
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
)
{
int32_t
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
)
{
if
(
bytes
)
*
bytes
=
0
;
if
(
rbytes
)
*
rbytes
=
0
;
if
(
tbytes
)
*
tbytes
=
0
;
return
true
;
return
0
;
}
bool
taosGetBandSpeed
(
float
*
bandSpeedKb
)
{
int32_t
taosGetBandSpeed
(
float
*
bandSpeedKb
)
{
*
bandSpeedKb
=
0
;
return
true
;
return
0
;
}
int32_t
taosGetCpuUsage
(
float
*
sysCpuUsage
,
float
*
procCpuUsage
)
{
...
...
@@ -544,13 +544,13 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
}
}
bool
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
)
{
*
bytes
=
0
;
int32_t
taosGetCardInfo
(
int64_t
*
bytes
,
int64_t
*
rbytes
,
int64_t
*
tbytes
)
{
if
(
bytes
)
*
bytes
=
0
;
// FILE *fp = fopen(tsSysNetFile, "r");
TdFilePtr
pFile
=
taosOpenFile
(
tsSysNetFile
,
TD_FILE_READ
|
TD_FILE_STREAM
);
if
(
pFile
==
NULL
)
{
// printf("open file:%s failed", tsSysNetFile);
return
false
;
return
-
1
;
}
ssize_t
_bytes
=
0
;
...
...
@@ -586,37 +586,37 @@ bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) {
nouse0
,
&
o_rbytes
,
&
rpackts
,
&
nouse1
,
&
nouse2
,
&
nouse3
,
&
nouse4
,
&
nouse5
,
&
nouse6
,
&
o_tbytes
,
&
tpackets
);
if
(
rbytes
)
*
rbytes
=
o_rbytes
;
if
(
tbytes
)
*
tbytes
=
o_tbytes
;
*
bytes
+=
(
o_rbytes
+
o_tbytes
);
if
(
bytes
)
*
bytes
+=
(
o_rbytes
+
o_tbytes
);
}
if
(
line
!=
NULL
)
tfree
(
line
);
taosCloseFile
(
&
pFile
);
return
true
;
return
0
;
}
bool
taosGetBandSpeed
(
float
*
bandSpeedKb
)
{
int32_t
taosGetBandSpeed
(
float
*
bandSpeedKb
)
{
static
int64_t
lastBytes
=
0
;
static
time_t
lastTime
=
0
;
int64_t
curBytes
=
0
;
time_t
curTime
=
time
(
NULL
);
if
(
!
taosGetCardInfo
(
&
curBytes
,
NULL
,
NULL
)
)
{
return
false
;
if
(
taosGetCardInfo
(
&
curBytes
,
NULL
,
NULL
)
!=
0
)
{
return
-
1
;
}
if
(
lastTime
==
0
||
lastBytes
==
0
)
{
lastTime
=
curTime
;
lastBytes
=
curBytes
;
*
bandSpeedKb
=
0
;
return
true
;
return
0
;
}
if
(
lastTime
>=
curTime
||
lastBytes
>
curBytes
)
{
lastTime
=
curTime
;
lastBytes
=
curBytes
;
*
bandSpeedKb
=
0
;
return
true
;
return
0
;
}
double
totalBytes
=
(
double
)(
curBytes
-
lastBytes
)
/
1024
*
8
;
// Kb
...
...
@@ -628,7 +628,7 @@ bool taosGetBandSpeed(float *bandSpeedKb) {
lastTime
=
curTime
;
lastBytes
=
curBytes
;
return
true
;
return
0
;
}
int32_t
taosReadProcIO
(
int64_t
*
rchars
,
int64_t
*
wchars
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录