Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
29d56b0a
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
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看板
提交
29d56b0a
编写于
3月 02, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init monitor module
上级
29422c65
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
243 addition
and
0 deletion
+243
-0
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+139
-0
source/libs/CMakeLists.txt
source/libs/CMakeLists.txt
+1
-0
source/libs/monitor/CMakeLists.txt
source/libs/monitor/CMakeLists.txt
+13
-0
source/libs/monitor/inc/monInt.h
source/libs/monitor/inc/monInt.h
+25
-0
source/libs/monitor/src/monitor.c
source/libs/monitor/src/monitor.c
+18
-0
source/libs/monitor/test/CMakeLists.txt
source/libs/monitor/test/CMakeLists.txt
+14
-0
source/libs/monitor/test/monTest.cpp
source/libs/monitor/test/monTest.cpp
+33
-0
未找到文件。
include/libs/monitor/monitor.h
0 → 100644
浏览文件 @
29d56b0a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_MONITOR_H_
#define _TD_MONITOR_H_
#include "tarray.h"
#include "tdef.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SMonitor
SMonitor
;
typedef
struct
{
int32_t
dnode_id
;
char
dnode_ep
[
TSDB_EP_LEN
];
}
SMonBasicInfo
;
typedef
struct
{
int32_t
dnode_id
;
char
dnode_ep
[
TSDB_EP_LEN
];
char
status
[
8
];
}
SMonDnodeDesc
;
typedef
struct
{
int32_t
mnode_id
;
char
mnode_ep
[
TSDB_EP_LEN
];
char
role
[
8
];
}
SMonMnodeDesc
;
typedef
struct
{
char
first_ep
[
TSDB_EP_LEN
];
int32_t
first_ep_dnode_id
;
char
version
[
12
];
float
master_uptime
;
// day
int32_t
monitor_interval
;
// sec
int32_t
vgroups_total
;
int32_t
vgroups_alive
;
int32_t
vnodes_total
;
int32_t
vnodes_alive
;
int32_t
connections_total
;
SArray
*
dnodes
;
// array of SMonDnodeDesc
SArray
*
mnodes
;
// array of SMonMnodeDesc
}
SMonClusterInfo
;
typedef
struct
{
float
uptime
;
// day
float
cpu_engine
;
float
cpu_system
;
float
cpu_cores
;
float
mem_engine
;
// MB
float
mem_system
;
// MB
float
mem_total
;
// MB
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
int32_t
req_select
;
float
req_select_rate
;
int32_t
req_insert
;
int32_t
req_insert_success
;
float
req_insert_rate
;
int32_t
req_insert_batch
;
int32_t
req_insert_batch_success
;
float
req_insert_batch_rate
;
int32_t
errors
;
int32_t
vnodes_num
;
int32_t
masters
;
int32_t
has_mnode
;
}
SMonDnodeInfo
;
typedef
struct
{
char
name
[
TSDB_FILENAME_LEN
];
int32_t
level
;
SDiskSize
size
;
}
SMonDiskDesc
;
typedef
struct
{
SArray
*
disks
;
// array of SMonDiskDesc
}
SMonDiskInfo
;
typedef
struct
{
int32_t
dnode_id
;
int8_t
vnode_online
;
char
vnode_role
[
8
];
}
SMonVnodeDesc
;
typedef
struct
{
int32_t
vgroup_id
;
SMonVnodeDesc
vnodes
[
TSDB_MAX_REPLICA
];
}
SMonVgroupDesc
;
typedef
struct
{
char
database_name
[
TSDB_DB_NAME_LEN
];
int32_t
tables_num
;
int8_t
status
;
SArray
*
vgroups
;
// array of SMonVgroupDesc
}
SMonVgroupInfo
;
typedef
struct
{
int64_t
ts
;
int8_t
level
;
char
content
[
1024
];
}
SMonLogItem
;
typedef
struct
{
SArray
*
logs
;
// array of SMonLogItem
}
SMonLogInfo
;
typedef
struct
{
int32_t
expire_time
;
int32_t
timeseries_used
;
int32_t
timeseries_total
;
}
SMonGrantInfo
;
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MONITOR_H_*/
source/libs/CMakeLists.txt
浏览文件 @
29d56b0a
...
@@ -14,5 +14,6 @@ add_subdirectory(function)
...
@@ -14,5 +14,6 @@ add_subdirectory(function)
add_subdirectory
(
qcom
)
add_subdirectory
(
qcom
)
add_subdirectory
(
qworker
)
add_subdirectory
(
qworker
)
add_subdirectory
(
tfs
)
add_subdirectory
(
tfs
)
add_subdirectory
(
monitor
)
add_subdirectory
(
nodes
)
add_subdirectory
(
nodes
)
add_subdirectory
(
scalar
)
add_subdirectory
(
scalar
)
source/libs/monitor/CMakeLists.txt
0 → 100644
浏览文件 @
29d56b0a
aux_source_directory
(
src MONITOR_SRC
)
add_library
(
monitor STATIC
${
MONITOR_SRC
}
)
target_include_directories
(
monitor
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/monitor"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
monitor os util common
)
if
(
${
BUILD_TEST
}
)
add_subdirectory
(
test
)
endif
(
${
BUILD_TEST
}
)
\ No newline at end of file
source/libs/monitor/inc/monInt.h
0 → 100644
浏览文件 @
29d56b0a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_MONITOR_INT_H_
#define _TD_MONITOR_INT_H_
#include "monitor.h"
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MONITOR_INT_H_*/
source/libs/monitor/src/monitor.c
0 → 100644
浏览文件 @
29d56b0a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "monInt.h"
source/libs/monitor/test/CMakeLists.txt
0 → 100644
浏览文件 @
29d56b0a
enable_testing
()
aux_source_directory
(
. MONITOR_TEST_SRC
)
add_executable
(
monitor_test
${
MONITOR_TEST_SRC
}
)
target_link_libraries
(
monitor_test
PUBLIC monitor
PUBLIC gtest_main
)
add_test
(
NAME monitor_test
COMMAND monitor_test
)
source/libs/monitor/test/monTest.cpp
0 → 100644
浏览文件 @
29d56b0a
/**
* @file monTest.cpp
* @author slguan (slguan@taosdata.com)
* @brief monitor module tests
* @version 1.0
* @date 2022-03-05
*
* @copyright Copyright (c) 2022
*
*/
#include <gtest/gtest.h>
#include "os.h"
#include "monitor.h"
class
MonitorTest
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
root
=
"/tmp/monTest"
;
}
static
void
TearDownTestSuite
()
{}
public:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
static
const
char
*
root
;
};
const
char
*
MonitorTest
::
root
;
TEST_F
(
MonitorTest
,
01
_Open_Close
)
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录