Skip to content

Commit

Permalink
[manager,collector] support dm database monitor (#410)
Browse files Browse the repository at this point in the history
  [manager] TagControllerTest Test class writing completed (#386)

  [collector] bugfix: Fixed expression:(A | B), A and B are null, print the error log (#387)

  [home] update constants.js jpom link (#388)

  [doc] update commit user (#389)

  [web-app] notice monitors.detail.time-series.unavailable (#390)

  [home] notice jvm code_cache only support jdk8 (#391)

  [home] support time-series db dependency iotdb deploy doc (#392)

  [home] support time-series db dependency iotdb deploy doc

  [warehouse] support iotdb connection available check when init

  [home] support time-series db dependency iotdb deploy doc

  [manager] add app service impl unit test (#393)

  [docs] update hertzbeat arch pic (#394)

  [home] update constants.js northstar (#395)

  [home] update constants.js sa-token url (#396)

  [docs] add hertzbeat roadmap  (#397)

  [docs] add roadmap

  Add @click33 as a contributor

  Add @bwcx-jzy as a contributor

  Add @kevinhuangwl as a contributor

  Add @TJxiaobao as a contributor

  Update @TJxiaobao as a contributor

  [docs] fix typo repair (#398)

Co-authored-by: 高兴存 <gxc01514416@alibaba-inc.com>

  DM DB monitoring

  Gradual improvement of DM monitoring

  [hertzbeat] update dm collect

Co-authored-by: zcx <48920254+Ceilzcx@users.noreply.github.com>
Co-authored-by: 蒋小小 <bwcx_jzy@163.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: Kevin Huang <12959229@qq.com>
Co-authored-by: click33 <36243476+click33@users.noreply.github.com>
Co-authored-by: 高兴存 <gxc01514416@alibaba-inc.com>
  • Loading branch information
7 people committed Nov 6, 2022
1 parent e219ac5 commit a09706a
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 1 deletion.
6 changes: 6 additions & 0 deletions collector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<!-- dm -->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.2.141</version>
</dependency>
<!-- postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private void queryOneRow(Statement statement, String sql, List<String> columns,
/**
* 查询一行数据, 通过查询的两列数据(key-value),key和查询的字段匹配,value为查询字段的值
* eg:
* 查询字段:one tow three four
* 查询字段:one two three four
* 查询SQL:select key, value from book;
* 返回的key映射查询字段
* @param statement 执行器
Expand Down Expand Up @@ -299,6 +299,9 @@ private String constructDatabaseUrl(JdbcProtocol jdbcProtocol) {
url = "jdbc:oracle:thin:@" + jdbcProtocol.getHost() + ":" + jdbcProtocol.getPort()
+ "/" + (jdbcProtocol.getDatabase() == null ? "" : jdbcProtocol.getDatabase());
break;
case "dm":
url = "jdbc:dm://" + jdbcProtocol.getHost() + ":" +jdbcProtocol.getPort();
break;
default:
throw new IllegalArgumentException("Not support database platform: " + jdbcProtocol.getPlatform());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void run(String... args) throws Exception {
Class.forName("org.postgresql.Driver");
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Class.forName("oracle.jdbc.driver.OracleDriver");
Class.forName("dm.jdbc.driver.DmDriver");
} catch (Exception e) {
log.error("load jdbc error: {}", e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public interface DispatchConstants {
* protocol redis
*/
String PROTOCOL_REDIS = "redis";
/**
* protocol
*/
String PROTOCOL_DM = "dm";
/**
* protocol jmx
*/
Expand Down
142 changes: 142 additions & 0 deletions manager/src/main/resources/define/app/app-dm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

category: db
app: dm
name:
zh-CN: 达梦数据库
en-US: DM DB
# 参数映射map. type是参数类型: 0-number数字, 1-string明文字符串, 2-secret加密字符串
# 强制固定必须参数 - host
configmap:
- key: host
type: 1
- key: port
type: 0
- key: username
type: 1
- key: password
type: 2
- key: database
type: 1
- key: timeout
type: 0
- key: url
type: 1
# 指标组列表
metrics:
- name: basic
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
priority: 0
# 指标组中的具体监控指标
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
- field: PORT_NUM
type: 1
- field: CTL_PATH
type: 1
- field: MAX_SESSIONS
type: 0
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
aliasFields:
- PORT_NUM
- CTL_PATH
- MAX_SESSIONS
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- PORT_NUM=PORT_NUM
- CTL_PATH=CTL_PATH
- MAX_SESSIONS=MAX_SESSIONS
protocol: jdbc
jdbc:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
platform: dm
username: ^_^username^_^
password: ^_^password^_^
database: ^_^database^_^
timeout: ^_^timeout^_^
# SQL查询方式: oneRow, multiRow, columns
queryType: columns
# sql
sql: select PARA_NAME, PARA_VALUE from SYS."V$DM_INI" where PARA_NAME = 'MAX_SESSIONS'or PARA_NAME = 'CTL_PATH' or PARA_NAME = 'PORT_NUM';
url: ^_^url^_^
- name: status
priority: 1
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
- field: status
type: 1
protocol: jdbc
jdbc:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
platform: dm
username: ^_^username^_^
password: ^_^password^_^
database: ^_^database^_^
timeout: ^_^timeout^_^
# SQL查询方式: oneRow, multiRow, columns
queryType: oneRow
# sql
sql: SELECT status$ as status FROM v$instance;
url: ^_^url^_^


- name: thread
priority: 2
fields:
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
- field: dm_sql_thd
type: 0
- field: dm_io_thd
type: 0
- field: dm_quit_thd
type: 0
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
aliasFields:
- dm_sql_thd
- dm_io_thd
- dm_quit_thd
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- dm_sql_thd=dm_sql_thd
- dm_io_thd=dm_io_thd
- dm_quit_thd=dm_quit_thd
protocol: jdbc
jdbc:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
platform: dm
username: ^_^username^_^
password: ^_^password^_^
database: ^_^database^_^
timeout: ^_^timeout^_^
# SQL查询方式: oneRow, multiRow, columns
queryType: columns
# sql
sql: SELECT DISTINCT NAME, COUNT(*) AS NUM FROM V$THREADS GROUP BY NAME ORDER BY NUM DESC;
url: ^_^url^_^


51 changes: 51 additions & 0 deletions manager/src/main/resources/define/param/param-dm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 监控应用类型名称(与文件名保持一致) eg: linux windows tomcat mysql aws...
app: dm
# 强制固定必须参数 - host(ipv4,ipv6,域名)
param:
# field-字段名称标识符
- field: host
# name-参数字段显示名称
name:
zh-CN: 主机Host
en-US: Host
# type-字段类型,样式(大部分映射input标签type属性)
type: host
# 是否是必输项 true-必填 false-可选
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
type: number
# 当type为number时,用range表示范围
range: '[0,65535]'
required: true
# 端口默认值
defaultValue: 5236
# 参数输入框提示信息
# 这个是什么参数?
placeholder: '请输入端口'
- field: username
name:
zh-CN: 用户名
en-US: Username
type: text
# 当type为text时,用limit表示字符串限制大小
limit: 20
required: false
hide: true
- field: password
name:
zh-CN: 用户密码
en-US: Password
type: password
required: false
hide: true
- field: timeout
name:
zh-CN: 超时时间
en-US: Timeout
type: number
range: '[0, 100000]'
required: true
defaultValue: 3000

0 comments on commit a09706a

Please sign in to comment.