Compare commits
16 Commits
feature#xg
...
fea#timeou
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2820f9dd3 | ||
|
|
2f52ff5e63 | ||
|
|
abe24914d3 | ||
|
|
491ca17106 | ||
|
|
feef3e7054 | ||
|
|
5c7bb4b14e | ||
|
|
bb636c9bae | ||
|
|
d871572438 | ||
|
|
d169dac94d | ||
|
|
cc22196d4a | ||
|
|
820cb7a3e5 | ||
|
|
155bdaf462 | ||
|
|
11981942d7 | ||
|
|
8473545d89 | ||
|
|
eea9e601cf | ||
|
|
711f0e070a |
@@ -8,7 +8,7 @@
|
||||
|
||||
## HertzBeat 赫兹跳动
|
||||
|
||||
> 易用友好的高性能监控告警系统。
|
||||
> 易用友好的监控告警系统。
|
||||
|
||||

|
||||

|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
##### 安装TDengine
|
||||
1. docker安装TDengine
|
||||
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine:2.4.0.12`
|
||||
`docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/tcp -p 6030-6049:6030-6049/udp --name tdengine tdengine/tdengine:2.4.0.12`
|
||||
2. 创建名称为hertzbeat的数据库
|
||||
|
||||
详细步骤参考 [依赖服务TDengine安装初始化](https://hertzbeat.com/docs/start/tdengine-init)
|
||||
@@ -100,7 +100,7 @@
|
||||
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程manager和前端工程web-app
|
||||
2. 后端:需要`maven3+`和`java8+`环境,修改YML配置信息并启动manager服务
|
||||
3. 前端:需要`nodejs npm angular-cli`环境,待本地后端启动后,在web-app目录下启动 `ng serve --open`
|
||||
4. 浏览器访问 localhost:4200 即可开始
|
||||
4. 浏览器访问 localhost:4200 即可开始,默认账号密码 admin/admin
|
||||
|
||||
详细步骤参考 [参与贡献之本地代码启动](CONTRIBUTING.md)
|
||||
|
||||
@@ -138,7 +138,8 @@ HertzBeat赫兹跳动为 [Dromara开源社区](https://dromara.org/) 孵化项
|
||||
|
||||
##### 赞助
|
||||
|
||||
感谢[吉实信息(构建全新的微波+光交易网络)](https://www.flarespeed.com)赞助服务器采集节点
|
||||
感谢[吉实信息(构建全新的微波+光交易网络)](https://www.flarespeed.com) 赞助服务器采集节点
|
||||
感谢[天上云计算(全新智慧上云)](https://www.tsyvps.com/aff/BZBEGYLX) 赞助服务器采集节点
|
||||
|
||||
## 🛡️ License
|
||||
[`Apache License, Version 2.0`](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
|
||||
@@ -109,6 +109,12 @@
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
<version>10.2.0.jre8</version>
|
||||
</dependency>
|
||||
<!-- oracle -->
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>21.5.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -2,6 +2,9 @@ package com.usthe.collector.collect.common.ssh;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.sshd.client.SshClient;
|
||||
import org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier;
|
||||
import org.apache.sshd.common.PropertyResolverUtils;
|
||||
import org.apache.sshd.core.CoreModuleProperties;
|
||||
|
||||
/**
|
||||
* ssh公共client
|
||||
@@ -16,6 +19,14 @@ public class CommonSshClient {
|
||||
|
||||
static {
|
||||
sshClient = SshClient.setUpDefaultClient();
|
||||
// 接受所有服务端公钥校验,会打印warn日志 Server at {} presented unverified {} key: {}
|
||||
AcceptAllServerKeyVerifier verifier = AcceptAllServerKeyVerifier.INSTANCE;
|
||||
sshClient.setServerKeyVerifier(verifier);
|
||||
// 设置链接保活心跳10000毫秒一次, 客户端等待保活心跳超时响应时间3000毫秒
|
||||
PropertyResolverUtils.updateProperty(
|
||||
sshClient, CoreModuleProperties.HEARTBEAT_INTERVAL.getName(), 10000);
|
||||
PropertyResolverUtils.updateProperty(
|
||||
sshClient, CoreModuleProperties.HEARTBEAT_REPLY_WAIT.getName(), 3000);
|
||||
sshClient.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -285,6 +285,10 @@ public class JdbcCommonCollect extends AbstractCollect {
|
||||
url = "jdbc:sqlserver://" + jdbcProtocol.getHost() + ":" + jdbcProtocol.getPort()
|
||||
+ ";" + (jdbcProtocol.getDatabase() == null ? "" : "DatabaseName=" + jdbcProtocol.getDatabase());
|
||||
break;
|
||||
case "oracle":
|
||||
url = "jdbc:oracle:thin:@" + jdbcProtocol.getHost() + ":" + jdbcProtocol.getPort()
|
||||
+ "/" + (jdbcProtocol.getDatabase() == null ? "" : jdbcProtocol.getDatabase());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Not support database platform: " + jdbcProtocol.getPlatform());
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.usthe.collector.collect.database;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 预加载jdbc驱动包 避免spi并发加载造成死锁
|
||||
* @author tom
|
||||
* @date 2022/3/19 15:39
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Order(value = 0)
|
||||
public class JdbcSpiLoader implements CommandLineRunner {
|
||||
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
log.info("start load jdbc drivers");
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Class.forName("org.postgresql.Driver");
|
||||
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||
} catch (Exception e) {
|
||||
log.error("load jdbc error: {}", e.getMessage(), e);
|
||||
}
|
||||
log.info("end load jdbc drivers");
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.usthe.collector.collect.common.cache.CacheIdentifier;
|
||||
import com.usthe.collector.collect.common.cache.CommonCache;
|
||||
import com.usthe.collector.collect.common.ssh.CommonSshClient;
|
||||
import com.usthe.collector.util.CollectorConstants;
|
||||
import com.usthe.collector.util.KeyPairUtil;
|
||||
import com.usthe.common.entity.job.Metrics;
|
||||
import com.usthe.common.entity.job.protocol.SshProtocol;
|
||||
import com.usthe.common.entity.message.CollectRep;
|
||||
@@ -19,6 +20,7 @@ import org.springframework.util.StringUtils;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.security.KeyPair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -56,8 +58,8 @@ public class SshCollectImpl extends AbstractCollect {
|
||||
return;
|
||||
}
|
||||
SshProtocol sshProtocol = metrics.getSsh();
|
||||
// 超时时间默认300毫秒
|
||||
int timeout = 3000;
|
||||
// 超时时间默认6000毫秒
|
||||
int timeout = 6000;
|
||||
try {
|
||||
timeout = Integer.parseInt(sshProtocol.getTimeout());
|
||||
} catch (Exception e) {
|
||||
@@ -181,6 +183,13 @@ public class SshCollectImpl extends AbstractCollect {
|
||||
.verify(timeout, TimeUnit.MILLISECONDS).getSession();
|
||||
if (StringUtils.hasText(sshProtocol.getPassword())) {
|
||||
clientSession.addPasswordIdentity(sshProtocol.getPassword());
|
||||
} else if (StringUtils.hasText(sshProtocol.getPublicKey())) {
|
||||
KeyPair keyPair = KeyPairUtil.getKeyPairFromPublicKey(sshProtocol.getPublicKey());
|
||||
if (keyPair != null) {
|
||||
clientSession.addPublicKeyIdentity(keyPair);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("需填写账户登陆密码或公钥");
|
||||
}
|
||||
// 进行认证
|
||||
if (!clientSession.auth().verify(timeout, TimeUnit.MILLISECONDS).isSuccess()) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
||||
/**
|
||||
* 指标组采集任务超时时间值
|
||||
*/
|
||||
private static final long DURATION_TIME = 120_000L;
|
||||
private static final long DURATION_TIME = 240_000L;
|
||||
/**
|
||||
* 指标组采集任务优先级队列
|
||||
*/
|
||||
@@ -94,7 +94,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
||||
Thread.currentThread().setName("metrics-task-monitor");
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
// 检测每个指标组采集单元是否超时2分钟,超时则丢弃并返回异常
|
||||
// 检测每个指标组采集单元是否超时4分钟,超时则丢弃并返回异常
|
||||
long deadline = System.currentTimeMillis() - DURATION_TIME;
|
||||
for (Map.Entry<String, MetricsTime> entry : metricsTimeoutMonitorMap.entrySet()) {
|
||||
MetricsTime metricsTime = entry.getValue();
|
||||
@@ -165,7 +165,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
||||
metricsSet.forEach(metricItem -> {
|
||||
MetricsCollect metricsCollect = new MetricsCollect(metricItem, timeout, this);
|
||||
jobRequestQueue.addJob(metricsCollect);
|
||||
metricsTimeoutMonitorMap.put(job.getId() + metrics.getName(),
|
||||
metricsTimeoutMonitorMap.put(job.getId() + "-" + metrics.getName(),
|
||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||
});
|
||||
} else {
|
||||
@@ -185,7 +185,7 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
||||
metricsSet.forEach(metricItem -> {
|
||||
MetricsCollect metricsCollect = new MetricsCollect(metricItem, timeout, this);
|
||||
jobRequestQueue.addJob(metricsCollect);
|
||||
metricsTimeoutMonitorMap.put(job.getId() + metrics.getName(),
|
||||
metricsTimeoutMonitorMap.put(job.getId() + "-" + metrics.getName(),
|
||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.usthe.collector.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
/**
|
||||
* 密钥工具类
|
||||
* @author tom
|
||||
* @date 2022/4/2 17:04
|
||||
*/
|
||||
@Slf4j
|
||||
public class KeyPairUtil {
|
||||
|
||||
private static KeyFactory keyFactory;
|
||||
|
||||
static {
|
||||
try {
|
||||
keyFactory = KeyFactory.getInstance("RSA");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取密钥对
|
||||
*/
|
||||
public static KeyPair getKeyPairFromPublicKey(String publicKeyStr) {
|
||||
try {
|
||||
if (publicKeyStr == null || "".equals(publicKeyStr)) {
|
||||
return null;
|
||||
}
|
||||
// todo fix 公钥解析
|
||||
byte[] publicKeyBytes = (new BASE64Decoder()).decodeBuffer(publicKeyStr);
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyBytes);
|
||||
PublicKey publicKey = keyFactory.generatePublic(keySpec);
|
||||
return new KeyPair(publicKey, null);
|
||||
} catch (Exception e) {
|
||||
log.info("[keyPair] parse failed, {}." + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,4 +6,5 @@ com.usthe.collector.dispatch.MetricsCollectorQueue,\
|
||||
com.usthe.collector.dispatch.WorkerPool,\
|
||||
com.usthe.collector.dispatch.entrance.internal.CollectJobService,\
|
||||
com.usthe.collector.dispatch.export.MetricsDataExporter,\
|
||||
com.usthe.collector.util.SpringContextHolder
|
||||
com.usthe.collector.util.SpringContextHolder,\
|
||||
com.usthe.collector.collect.database.JdbcSpiLoader
|
||||
|
||||
@@ -166,7 +166,7 @@ public class Job {
|
||||
return null;
|
||||
}
|
||||
if (!metricsSet.remove(metrics)) {
|
||||
log.error("Job {} appId {} app {} metrics {} remove empty error in priorMetrics.",
|
||||
log.warn("Job {} appId {} app {} metrics {} remove empty error in priorMetrics.",
|
||||
id, monitorId, app, metrics.getName());
|
||||
}
|
||||
if (metricsSet.isEmpty()) {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SshProtocol {
|
||||
/**
|
||||
* 超时时间
|
||||
*/
|
||||
private String timeout = "3000";
|
||||
private String timeout = "6000";
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
|
||||
@@ -59,7 +59,7 @@ public class Param {
|
||||
* 参数值
|
||||
*/
|
||||
@ApiModelProperty(value = "参数值", example = "8080", accessMode = READ_WRITE, position = 3)
|
||||
@Length(max = 255)
|
||||
@Length(max = 8126)
|
||||
private String value;
|
||||
|
||||
/**
|
||||
|
||||
70
home/blog/2022-03-20-hertzbeat-v1.0-beta.6.md
Normal file
70
home/blog/2022-03-20-hertzbeat-v1.0-beta.6.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: HertzBeat赫兹节拍 v1.0.beta.6 发布,Linux监控来啦
|
||||
author: tom
|
||||
author_title: tom
|
||||
author_url: https://github.com/tomsun28
|
||||
author_image_url: https://avatars.githubusercontent.com/u/24788200?s=400&v=4
|
||||
tags: [opensource]
|
||||
---
|
||||
|
||||
HertzBeat赫兹跳动是由Dromara孵化,TanCloud开源的一个支持网站,API,PING,端口,数据库,操作系统,全站等监控类型,支持阈值告警,告警通知(邮箱,webhook,钉钉,企业微信,飞书机器人),拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||
|
||||
官网:hertzbeat.com | tancloud.cn
|
||||
|
||||
此升级版本包含了很多同学需要的Linux操作系统监控支持,支持其CPU,内存,磁盘,网络等指标,重要的是同步支持了SSH自定义,我们可以很方便的写脚本监控我们想要的Linux指标,也新增了对主流的数据库SqlServer监控支持等,更多功能欢迎使用。
|
||||
|
||||
版本特性:
|
||||
1. feature 新增支持Linux操作系统监控类型(支持CPU内存磁盘网卡等监控指标) (#20)
|
||||
2. feature 新增支持microsoft sqlserver数据库监控类型 (#37)
|
||||
3. feature 添加docker-compose部署方案 (#27) 由 @jx10086 贡献 thanks
|
||||
4. feature 监控列表支持状态过滤和字段搜索功能 (#29)
|
||||
5. feature 新增mysql,postgresql等数据库查询超时时间设置 (#18) 由 @学习代码的小白 贡献
|
||||
6. [纳管]修改为[监控]表述,[探测]修改为[测试]表述
|
||||
7. feature add github build and translate action (#22)
|
||||
8. feature 新增贡献指南,本地代码启动文档
|
||||
9. docs 指定mysql和tdengine版本,避免环境问题
|
||||
|
||||
BUG修复
|
||||
1. fix 由于链接复用不佳造成创建过多链接监控异常 (#26)
|
||||
2. fix 页面全局监控搜索结果异常 (#28) issue by @Suremotoo
|
||||
3. 代码优化 #I4U9BT 由 @学习代码的小白 贡献
|
||||
4. fix 服务启动脚本偶现端口占用误判问题
|
||||
5. 时间本地时区格式化 (#35)
|
||||
6. fix 此版本引入问题jdbc解析异常 (#36)
|
||||
7. fix jdbc并发注册加载时由于spi机制加载死锁问题 (#40)
|
||||
|
||||
欢迎在线试用 https://console.tancloud.cn.
|
||||
|
||||
-----------------------
|
||||
|
||||
> [HertzBeat赫兹跳动](https://github.com/dromara/hertzbeat) 是由[Dromara](https://dromara.org)孵化,[TanCloud](https://tancloud.cn)开源的一个支持网站,API,PING,端口,数据库,操作系统等监控类型,拥有易用友好的可视化操作界面的开源监控告警项目。
|
||||
> 我们也提供了对应的 **[SAAS版本监控云](https://console.tancloud.cn)**,中小团队和个人无需再为了监控自己的网站资源,而去部署一套繁琐的监控系统,**[登录即可免费开始](https://console.tancloud.cn)**。
|
||||
> HertzBeat 支持[自定义监控](https://hertzbeat.com/docs/advanced/extend-point) ,只用通过配置YML文件我们就可以自定义需要的监控类型和指标,来满足常见的个性化需求。
|
||||
> HertzBeat 模块化,`manager, collector, scheduler, warehouse, alerter` 各个模块解耦合,方便理解与定制开发。
|
||||
> HertzBeat 支持更自由化的告警配置(计算表达式),支持告警通知,告警模版,邮件钉钉微信飞书等及时通知送达
|
||||
> 欢迎登录 HertzBeat 的 [云环境TanCloud](https://console.tancloud.cn) 试用发现更多。
|
||||
> 我们正在快速迭代中,欢迎参与加入一起共建项目开源生态。
|
||||
|
||||
> `HertzBeat`的多类型支持,易扩展,低耦合,希望能帮助开发者和中小团队快速搭建自有监控系统。
|
||||
|
||||
老铁们可以通过演示视频来直观了解功能: https://www.bilibili.com/video/BV1Vi4y1f7i8
|
||||
|
||||
##### 欢迎联系交流哦
|
||||
|
||||
**微信交流群**
|
||||
|
||||
加微信号 tan-cloud 或 扫描下面账号二维码拉进微信群。
|
||||
<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/help/tan-cloud-wechat.jpg" width="200"/>
|
||||
|
||||
**QQ交流群**
|
||||
|
||||
加QQ群号 718618151 或 扫描下面的群二维码进群, 验证信息: tancloud
|
||||
|
||||
<img alt="tan-cloud" src="https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/help/qq-qr.jpg" width="200"/>
|
||||
|
||||
**仓库地址**
|
||||
|
||||
[Github](https://github.com/dromara/hertzbeat) https://github.com/dromara/hertzbeat
|
||||
[Gitee](https://gitee.com/dromara/hertzbeat) https://gitee.com/dromara/hertzbeat
|
||||
|
||||
看到这里不妨给个Star哦,灰常感谢,弯腰!!
|
||||
@@ -3,7 +3,7 @@ id: extend-jdbc
|
||||
title: JDBC协议自定义监控
|
||||
sidebar_label: JDBC协议自定义监控
|
||||
---
|
||||
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用JDBC(目前支持mysql,mariadb,postgresql)自定义指标监控。
|
||||
> 从[自定义监控](extend-point)了解熟悉了怎么自定义类型,指标,协议等,这里我们来详细介绍下用JDBC(目前支持mysql,mariadb,postgresql,sqlserver)自定义指标监控。
|
||||
> JDBC协议自定义监控可以让我们很方便的通过写SQL查询语句就能监控到我们想监控的指标
|
||||
|
||||
### JDBC协议采集流程
|
||||
|
||||
@@ -18,7 +18,7 @@ sidebar_label: 帮助入门
|
||||
|
||||
### 数据库监控
|
||||
|
||||
[MYSQL数据库监控](mysql)      [MariaDB数据库监控](mariadb)      [PostgreSQL数据库监控](postgresql)
|
||||
[MYSQL数据库监控](mysql)      [MariaDB数据库监控](mariadb)      [PostgreSQL数据库监控](postgresql)      [SqlServer数据库监控](sqlserver)      [Oracle数据库监控](oracle)
|
||||
|
||||
### 操作系统监控
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ sidebar_label: MariaDB数据库
|
||||
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||
| 端口 | 数据库对外提供的端口,默认为3306。 |
|
||||
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||
| 数据库名称 | 数据库实例名称,可选。 |
|
||||
| 用户名 | 数据库连接用户名,可选 |
|
||||
| 密码 | 数据库连接密码,可选 |
|
||||
|
||||
@@ -13,6 +13,7 @@ sidebar_label: MYSQL数据库
|
||||
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||
| 端口 | 数据库对外提供的端口,默认为3306。 |
|
||||
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||
| 数据库名称 | 数据库实例名称,可选。 |
|
||||
| 用户名 | 数据库连接用户名,可选 |
|
||||
| 密码 | 数据库连接密码,可选 |
|
||||
|
||||
62
home/docs/help/oracle.md
Normal file
62
home/docs/help/oracle.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
id: oracle
|
||||
title: 监控:ORACLE数据库监控
|
||||
sidebar_label: ORACLE数据库
|
||||
---
|
||||
|
||||
> 对ORACLE数据库的通用性能指标进行采集监控。
|
||||
|
||||
### 配置参数
|
||||
|
||||
| 参数名称 | 参数帮助描述 |
|
||||
| ----------- | ----------- |
|
||||
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||
| 端口 | 数据库对外提供的端口,默认为1521。 |
|
||||
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||
| 数据库名称 | 数据库实例名称,可选。 |
|
||||
| 用户名 | 数据库连接用户名,可选 |
|
||||
| 密码 | 数据库连接密码,可选 |
|
||||
| URL | 数据库连接URL,可选,若配置,则URL里面的数据库名称,用户名密码等参数会覆盖上面配置的参数 |
|
||||
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为10秒 |
|
||||
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
|
||||
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
|
||||
|
||||
### 采集指标
|
||||
|
||||
#### 指标集合:basic
|
||||
|
||||
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| database_version | 无 | 数据库版本 |
|
||||
| database_type | 无 | 数据库类型 |
|
||||
| hostname | 无 | 主机名称 |
|
||||
| instance_name | 无 | 数据库实例名称 |
|
||||
| startup_time | 无 | 数据库启动时间 |
|
||||
| status | 无 | 数据库状态 |
|
||||
|
||||
#### 指标集合:tablespace
|
||||
|
||||
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| file_id | 无 | 文件ID |
|
||||
| file_name | 无 | 文件名称 |
|
||||
| tablespace_name | 无 | 所属表空间名称 |
|
||||
| status | 无 | 状态 |
|
||||
| bytes | MB | 大小 |
|
||||
| blocks | 无 | 区块数量 |
|
||||
|
||||
#### 指标集合:user_connect
|
||||
|
||||
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| username | 无 | 用户名 |
|
||||
| counts | 个数 | 当前连接数量 |
|
||||
|
||||
#### 指标集合:performance
|
||||
|
||||
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| qps | QPS | I/O Requests per Second 每秒IO请求数量 |
|
||||
| tps | TPS | User Transaction Per Sec 每秒用户事物处理数量 |
|
||||
| mbps | MBPS | I/O Megabytes per Second 每秒 I/O 兆字节数量 |
|
||||
@@ -13,6 +13,7 @@ sidebar_label: PostgreSQL数据库
|
||||
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||
| 端口 | 数据库对外提供的端口,默认为5432。 |
|
||||
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||
| 数据库名称 | 数据库实例名称,可选。 |
|
||||
| 用户名 | 数据库连接用户名,可选 |
|
||||
| 密码 | 数据库连接密码,可选 |
|
||||
|
||||
57
home/docs/help/sqlserver.md
Normal file
57
home/docs/help/sqlserver.md
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
id: sqlserver
|
||||
title: 监控:SqlServer数据库监控
|
||||
sidebar_label: SqlServer数据库
|
||||
---
|
||||
|
||||
> 对SqlServer数据库的通用性能指标进行采集监控。支持SqlServer 2017+。
|
||||
|
||||
### 配置参数
|
||||
|
||||
| 参数名称 | 参数帮助描述 |
|
||||
| ----------- | ----------- |
|
||||
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。 |
|
||||
| 监控名称 | 标识此监控的名称,名称需要保证唯一性。 |
|
||||
| 端口 | 数据库对外提供的端口,默认为1433。 |
|
||||
| 查询超时时间 | 设置SQL查询未响应数据时的超时时间,单位ms毫秒,默认3000毫秒。 |
|
||||
| 数据库名称 | 数据库实例名称,可选。 |
|
||||
| 用户名 | 数据库连接用户名,可选 |
|
||||
| 密码 | 数据库连接密码,可选 |
|
||||
| URL | 数据库连接URL,可选,若配置,则URL里面的数据库名称,用户名密码等参数会覆盖上面配置的参数 |
|
||||
| 采集间隔 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为10秒 |
|
||||
| 是否探测 | 新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作 |
|
||||
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
|
||||
|
||||
### 采集指标
|
||||
|
||||
#### 指标集合:basic
|
||||
|
||||
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| machine_name | 无 | 运行服务器实例的 Windows 计算机名称 |
|
||||
| server_name | 无 | 与Windows实例关联的服务器和实例信息SQL Server |
|
||||
| version | 无 | 实例的版本,SQL Server,格式为"major.minor.build.revision" |
|
||||
| edition | 无 | 已安装的 实例的产品SQL Server版本 |
|
||||
| start_time | 无 | 数据库启动时间 |
|
||||
|
||||
#### 指标集合:performance_counters
|
||||
|
||||
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| database_pages | 无 | Database pages, 已获得的页面数(缓冲池) |
|
||||
| target_pages | 无 | Target pages, 缓冲池必须的理想页面数 |
|
||||
| page_life_expectancy | s,秒 | Page life expectancy, 数据页在缓冲池中驻留的时间,这个时间一般会大于 300 |
|
||||
| buffer_cache_hit_ratio | % | Buffer cache hit ratio, 数据库缓冲池高速缓冲命中率,被请求的数据在缓冲池中被找到的概率,一般会大于 80% 才算正常,否则可能是缓冲池容量太小 |
|
||||
| checkpoint_pages_sec | 无 | Checkpoint pages/sec, 检查点每秒写入磁盘的脏页个数,如果数据过高,证明缺少内存容量 |
|
||||
| page_reads_sec | 无 | Page reads/sec, 缓存池中每秒读的页数 |
|
||||
| page_writes_sec | 无 | Page writes/sec, 缓存池中每秒写的页数 |
|
||||
|
||||
|
||||
#### 指标集合:connection
|
||||
|
||||
| 指标名称 | 指标单位 | 指标帮助描述 |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| user_connection | 无 | 已连接的会话数 |
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ sidebar_label: 介绍
|
||||
slug: /
|
||||
---
|
||||
|
||||
> 易用友好的高性能监控告警系统。
|
||||
> 易用友好的监控告警系统。
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -43,10 +43,56 @@ sidebar_label: Docker方式部署
|
||||
HertzBeat默认内置三个用户账户,分别为 admin/admin tom/tom@123 lili/lili
|
||||
若需要新增删除修改账户或密码,可以通过配置 `sureness.yml` 实现,若无此需求可忽略此步骤
|
||||
在主机目录下创建sureness.yml,eg:/opt/sureness.yml
|
||||
配置文件内容参考 项目仓库[/script/sureness.yml](https://gitee.com/dromara/hertzbeat/blob/master/script/sureness.yml)
|
||||
修改sureness.yml的如下部分参数:[注意⚠️sureness配置的其它默认参数需保留]
|
||||
配置文件内容参考 项目仓库[/script/sureness.yml](https://gitee.com/dromara/hertzbeat/blob/master/script/sureness.yml)
|
||||
|
||||
```yaml
|
||||
|
||||
resourceRole:
|
||||
- /account/auth/refresh===post===[role1,role2,role3,role4]
|
||||
|
||||
excludedResource:
|
||||
- /account/auth/**===*
|
||||
- /===get
|
||||
- /i18n/**===get
|
||||
- /apps/hierarchy===get
|
||||
- /console/**===get
|
||||
- /**/*.html===get
|
||||
- /**/*.js===get
|
||||
- /**/*.css===get
|
||||
- /**/*.ico===get
|
||||
- /**/*.ttf===get
|
||||
- /**/*.png===get
|
||||
- /**/*.gif===get
|
||||
- /**/*.png===*
|
||||
- /swagger-resources/**===get
|
||||
- /v2/api-docs===get
|
||||
- /v3/api-docs===get
|
||||
|
||||
# 用户账户信息
|
||||
# 下面有 admin tom lili 三个账户
|
||||
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||
# eg: tom 拥有[role1,role2,role3],密码为tom@123
|
||||
# eg: lili 拥有[role1,role2],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin
|
||||
role: [role1,role2]
|
||||
- appId: tom
|
||||
credential: tom@123
|
||||
role: [role1,role2,role3]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
# 加盐加密的密码,通过 MD5(password+salt)计算
|
||||
# 此账户的原始密码为 lili
|
||||
credential: 1A676730B0C7F54654B0E09184448289
|
||||
salt: 123
|
||||
role: [role1,role2]
|
||||
```
|
||||
|
||||
修改sureness.yml的如下**部分参数**:**[注意⚠️sureness配置的其它默认参数需保留]**
|
||||
|
||||
```yaml
|
||||
|
||||
# 用户账户信息
|
||||
# 下面有 admin tom lili 三个账户
|
||||
# eg: admin 拥有[role1,role2]角色,密码为admin
|
||||
@@ -82,7 +128,7 @@ sidebar_label: Docker方式部署
|
||||
- tancloud/hertzbeat:[版本tag] : 使用拉取的HertzBeat官方发布的应用镜像来启动容器,TAG可查看[官方镜像仓库](https://hub.docker.com/r/tancloud/hertzbeat/tags)
|
||||
|
||||
7. 开始探索HertzBeat
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警,默认账户密码 admin/admin。
|
||||
|
||||
**HAVE FUN**
|
||||
|
||||
@@ -101,4 +147,4 @@ sidebar_label: Docker方式部署
|
||||
|
||||
3. **日志报错TDengine连接或插入SQL失败**
|
||||
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
|
||||
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||
|
||||
@@ -46,7 +46,7 @@ sidebar_label: 安装包方式部署
|
||||
4. 配置用户配置文件(非必须,配置账户需要)
|
||||
HertzBeat默认内置三个用户账户,分别为 admin/admin tom/tom@123 lili/lili
|
||||
若需要新增删除修改账户或密码,可以通过修改位于 `hertzbeat/config/sureness.yml` 的配置文件实现,若无此需求可忽略此步骤
|
||||
修改sureness.yml的如下部分参数:[注意⚠️sureness配置的其它默认参数需保留]
|
||||
修改sureness.yml的如下**部分参数**:**[注意⚠️sureness配置的其它默认参数需保留]**
|
||||
|
||||
```yaml
|
||||
# 用户账户信息
|
||||
@@ -76,7 +76,7 @@ sidebar_label: 安装包方式部署
|
||||
$ ./startup.sh
|
||||
```
|
||||
6. 开始探索HertzBeat
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警。
|
||||
浏览器访问 http://ip:1157/console 开始使用HertzBeat进行监控告警,默认账户密码 admin/admin。
|
||||
|
||||
**HAVE FUN**
|
||||
|
||||
@@ -90,4 +90,4 @@ sidebar_label: 安装包方式部署
|
||||
|
||||
2. **日志报错TDengine连接或插入SQL失败**
|
||||
> 一:排查配置的数据库账户密码是否正确,数据库是否创建
|
||||
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||
> 二:若是安装包安装的TDengine2.3+,除了启动server外,还需执行 `systemctl start taosadapter` 启动 adapter
|
||||
|
||||
@@ -47,7 +47,7 @@ sidebar_label: 快速开始
|
||||
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程manager和前端工程web-app
|
||||
2. 后端:需要`maven3+`和`java8+`环境,修改YML配置信息并启动manager服务
|
||||
3. 前端:需要`nodejs npm angular-cli`环境,待本地后端启动后,在web-app目录下启动 `ng serve --open`
|
||||
4. 浏览器访问 localhost:4200 即可开始
|
||||
4. 浏览器访问 localhost:4200 即可开始,默认账户密码 admin/admin
|
||||
|
||||
详细步骤参考 [参与贡献之本地代码启动](../others/contributing)
|
||||
|
||||
|
||||
@@ -64,7 +64,9 @@
|
||||
"items": [
|
||||
"help/mysql",
|
||||
"help/mariadb",
|
||||
"help/postgresql"
|
||||
"help/postgresql",
|
||||
"help/sqlserver",
|
||||
"help/oracle"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ export const features = [{
|
||||
custom: <a href={'/docs/advanced/extend-point'}><strong>自定义监控</strong></a>,
|
||||
br: <br/>
|
||||
}}>
|
||||
{'HertzBeat目前支持对网站,API,PING连通性,端口可用性,SiteMap全站,MYSQL数据库等的监控,不久我们将兼容 prometheus 协议,提供更多的监控类型和性能指标。{br}' +
|
||||
{'HertzBeat目前支持对网站,API,PING连通性,端口可用性,SiteMap全站,数据库,操作系统等的监控,快速迭代提供更多的监控类型和性能指标。{br}' +
|
||||
'我们提供了更自由化的阈值告警配置,支持邮箱,短信,webhook,钉钉,企业微信,飞书机器人等告警通知。{br}' +
|
||||
'不同团队的监控需求千变万化,我们提供{custom},仅需配置YML就能快速接入监控系统。'
|
||||
}
|
||||
|
||||
@@ -28,12 +28,13 @@ function Home() {
|
||||
<h1 className="hero__title">
|
||||
<img style={{width: '500px', marginTop: '100px'}} src={cdnTransfer('img/hertzbeat-brand.svg')} alt={'#'}/>
|
||||
</h1>
|
||||
<p className="hero__subtitle"><Translate>易用友好的高性能监控告警系统</Translate></p>
|
||||
<p className="hero__subtitle"><Translate>易用友好的监控告警系统</Translate></p>
|
||||
<div className={styles.social}>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/web-monitor.svg')} alt={''}/></a>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/ping-connect.svg')} alt={''}/></a>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/port-available.svg')} alt={''}/></a>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/database-monitor.svg')} alt={''}/></a>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/os-monitor.svg')} alt={''}/></a>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/custom-monitor.svg')} alt={''}/></a>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/threshold.svg')} alt={''}/></a>
|
||||
<a href="https://console.tancloud.cn"><img src={cdnTransfer('img/badge/alert.svg')} alt={''}/></a>
|
||||
|
||||
@@ -27,8 +27,8 @@ spring:
|
||||
on-profile: prod
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: admin
|
||||
password: admin
|
||||
username: root
|
||||
password: 123456
|
||||
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||
platform: mysql
|
||||
hikari:
|
||||
|
||||
@@ -16,6 +16,8 @@ configmap:
|
||||
type: 1
|
||||
- key: password
|
||||
type: 2
|
||||
- key: timeout
|
||||
type: 0
|
||||
# 指标组列表
|
||||
metrics:
|
||||
# 第一个监控指标组 basic
|
||||
@@ -44,6 +46,7 @@ metrics:
|
||||
port: ^_^port^_^
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: (uname -r ; hostname ; uptime | awk -F "," '{print $1}' | sed "s/ //g") | sed ":a;N;s/\n/^/g;ta" | awk -F '^' 'BEGIN{print "version hostname uptime"} {print $1, $2, $3}'
|
||||
# 响应数据解析方式:oneRow, multiRow
|
||||
parseType: multiRow
|
||||
@@ -75,6 +78,7 @@ metrics:
|
||||
port: ^_^port^_^
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -107,6 +111,7 @@ metrics:
|
||||
port: ^_^port^_^
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: free -m | grep Mem | awk 'BEGIN{print "total used free buff_cache available"} {print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -139,6 +144,7 @@ metrics:
|
||||
port: ^_^port^_^
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: vmstat -D | awk 'NR==1{print $1}';vmstat -D | awk 'NR==2{print $1}';vmstat 1 1 | awk 'NR==3{print $10}';vmstat 1 1 | awk 'NR==3{print $9}';vmstat 1 1 | awk 'NR==3{print $16}'
|
||||
parseType: oneRow
|
||||
|
||||
@@ -164,5 +170,6 @@ metrics:
|
||||
port: ^_^port^_^
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
182
manager/src/main/resources/define/app/oracle.yml
Normal file
182
manager/src/main/resources/define/app/oracle.yml
Normal file
@@ -0,0 +1,182 @@
|
||||
category: db
|
||||
app: oracle
|
||||
name:
|
||||
zh-CN: Oracle数据库
|
||||
en-US: Oracle 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: database_version
|
||||
type: 1
|
||||
instance: true
|
||||
- field: database_type
|
||||
type: 1
|
||||
- field: hostname
|
||||
type: 1
|
||||
- field: instance_name
|
||||
type: 1
|
||||
- field: startup_time
|
||||
type: 1
|
||||
- field: status
|
||||
type: 1
|
||||
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||
aliasFields:
|
||||
- VERSION
|
||||
- DATABASE_TYPE
|
||||
- HOST_NAME
|
||||
- INSTANCE_NAME
|
||||
- STARTUP_TIME
|
||||
- STATUS
|
||||
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
|
||||
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
|
||||
calculates:
|
||||
- database_version=VERSION
|
||||
- database_type=DATABASE_TYPE
|
||||
- hostname=HOST_NAME
|
||||
- instance_name=INSTANCE_NAME
|
||||
- startup_time=STARTUP_TIME
|
||||
- status=STATUS
|
||||
protocol: jdbc
|
||||
jdbc:
|
||||
# 主机host: ipv4 ipv6 域名
|
||||
host: ^_^host^_^
|
||||
# 端口
|
||||
port: ^_^port^_^
|
||||
platform: oracle
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
database: ^_^database^_^
|
||||
timeout: ^_^timeout^_^
|
||||
# SQL查询方式: oneRow, multiRow, columns
|
||||
queryType: oneRow
|
||||
# sql
|
||||
sql: select * from sys.v_$instance
|
||||
url: ^_^url^_^
|
||||
|
||||
- name: tablespace
|
||||
priority: 1
|
||||
# 指标组中的具体监控指标
|
||||
fields:
|
||||
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||
- field: file_id
|
||||
type: 1
|
||||
instance: true
|
||||
- field: file_name
|
||||
type: 1
|
||||
- field: tablespace_name
|
||||
type: 1
|
||||
- field: status
|
||||
type: 1
|
||||
- field: bytes
|
||||
type: 0
|
||||
unit: MB
|
||||
- field: blocks
|
||||
type: 0
|
||||
unit: 块数
|
||||
protocol: jdbc
|
||||
jdbc:
|
||||
# 主机host: ipv4 ipv6 域名
|
||||
host: ^_^host^_^
|
||||
# 端口
|
||||
port: ^_^port^_^
|
||||
platform: oracle
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
database: ^_^database^_^
|
||||
timeout: ^_^timeout^_^
|
||||
# SQL查询方式: oneRow, multiRow, columns
|
||||
queryType: oneRow
|
||||
# sql
|
||||
sql: select file_id, file_name, tablespace_name, status, bytes / 1024 / 1024 as bytes, blocks from dba_data_files
|
||||
url: ^_^url^_^
|
||||
|
||||
- name: user_connect
|
||||
priority: 1
|
||||
fields:
|
||||
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||
- field: username
|
||||
type: 1
|
||||
instance: true
|
||||
- field: counts
|
||||
type: 0
|
||||
unit: 连接数
|
||||
protocol: jdbc
|
||||
jdbc:
|
||||
# 主机host: ipv4 ipv6 域名
|
||||
host: ^_^host^_^
|
||||
# 端口
|
||||
port: ^_^port^_^
|
||||
platform: oracle
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
database: ^_^database^_^
|
||||
timeout: ^_^timeout^_^
|
||||
# SQL查询方式: oneRow, multiRow, columns
|
||||
queryType: oneRow
|
||||
# sql
|
||||
sql: SELECT username, count( username ) as counts FROM v$session WHERE username IS NOT NULL GROUP BY username
|
||||
url: ^_^url^_^
|
||||
|
||||
- name: performance
|
||||
priority: 1
|
||||
fields:
|
||||
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||
- field: qps
|
||||
type: 0
|
||||
unit: qps
|
||||
- field: tps
|
||||
type: 0
|
||||
unit: tps
|
||||
- field: mbps
|
||||
type: 0
|
||||
unit: mbps
|
||||
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||
aliasFields:
|
||||
- I/O Requests per Second
|
||||
- User Transaction Per Sec
|
||||
- I/O Megabytes per Second
|
||||
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
|
||||
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
|
||||
calculates:
|
||||
- qps=I/O Requests per Second
|
||||
- tps=User Transaction Per Sec
|
||||
- mbps=I/O Megabytes per Second
|
||||
protocol: jdbc
|
||||
jdbc:
|
||||
# 主机host: ipv4 ipv6 域名
|
||||
host: ^_^host^_^
|
||||
# 端口
|
||||
port: ^_^port^_^
|
||||
platform: oracle
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
database: ^_^database^_^
|
||||
timeout: ^_^timeout^_^
|
||||
# SQL查询方式: oneRow, multiRow, columns
|
||||
queryType: columns
|
||||
# sql
|
||||
sql: select metric_name, value from gv$sysmetric where metric_name = 'I/O Megabytes per Second' or metric_name = 'User Transaction Per Sec' or metric_name = 'I/O Requests per Second'
|
||||
url: ^_^url^_^
|
||||
@@ -115,7 +115,7 @@ metrics:
|
||||
priority: 1
|
||||
fields:
|
||||
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||
- field: connection
|
||||
- field: user_connection
|
||||
type: 0
|
||||
unit: 连接数
|
||||
protocol: jdbc
|
||||
@@ -132,5 +132,5 @@ metrics:
|
||||
# SQL查询方式: oneRow, multiRow, columns
|
||||
queryType: oneRow
|
||||
# sql
|
||||
sql: SELECT cntr_value as connection FROM sys.dm_os_performance_counters WHERE object_name = 'SQLServer:General Statistics' AND counter_name = 'User Connections';
|
||||
sql: SELECT cntr_value as user_connection FROM sys.dm_os_performance_counters WHERE object_name = 'SQLServer:General Statistics' AND counter_name = 'User Connections';
|
||||
url: ^_^url^_^
|
||||
@@ -11,6 +11,12 @@ param:
|
||||
required: true
|
||||
defaultValue: 22
|
||||
placeholder: '请输入端口'
|
||||
- field: timeout
|
||||
name: 超时时间
|
||||
type: number
|
||||
required: false
|
||||
defaultValue: 6000
|
||||
placeholder: '超时时间'
|
||||
- field: username
|
||||
name: 用户名
|
||||
type: text
|
||||
@@ -19,4 +25,4 @@ param:
|
||||
- field: password
|
||||
name: 密码
|
||||
type: password
|
||||
required: true
|
||||
required: false
|
||||
36
manager/src/main/resources/define/param/oracle.yml
Normal file
36
manager/src/main/resources/define/param/oracle.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
app: oracle
|
||||
param:
|
||||
- field: host
|
||||
name: 主机Host
|
||||
type: host
|
||||
required: true
|
||||
- field: port
|
||||
name: 端口
|
||||
type: number
|
||||
range: '[0,65535]'
|
||||
required: true
|
||||
defaultValue: 1521
|
||||
placeholder: '请输入端口'
|
||||
- field: timeout
|
||||
name: 查询超时时间
|
||||
type: number
|
||||
required: false
|
||||
defaultValue: 3000
|
||||
placeholder: '查询超时时间'
|
||||
- field: database
|
||||
name: 数据库名称
|
||||
type: text
|
||||
required: false
|
||||
- field: username
|
||||
name: 用户名
|
||||
type: text
|
||||
limit: 20
|
||||
required: false
|
||||
- field: password
|
||||
name: 密码
|
||||
type: password
|
||||
required: false
|
||||
- field: url
|
||||
name: URL
|
||||
type: text
|
||||
required: false
|
||||
@@ -27,8 +27,8 @@ spring:
|
||||
on-profile: prod
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: admin
|
||||
password: admin
|
||||
username: root
|
||||
password: 123456
|
||||
url: jdbc:mysql://localhost:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||
platform: mysql
|
||||
hikari:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd
|
||||
http://maven.apache.org/ASSEMBLY/2.0.0 ">
|
||||
<!--必填,会追加到打包文件名称的末尾-->
|
||||
<id>1.0-beta.5</id>
|
||||
<id>1.0-beta.6</id>
|
||||
<!--打包类型,可以设置多种类型,打包的时候不同的类型都会打包打出来-->
|
||||
<formats>
|
||||
<format>tar</format>
|
||||
|
||||
@@ -28,7 +28,7 @@ spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: 1234
|
||||
password: 123456
|
||||
url: jdbc:mysql://mysql:3306/hertzbeat?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||
platform: mysql
|
||||
hikari:
|
||||
|
||||
@@ -34,7 +34,7 @@ CREATE TABLE param
|
||||
id bigint not null auto_increment comment '参数ID',
|
||||
monitor_id bigint not null comment '监控ID',
|
||||
field varchar(100) not null comment '参数标识符',
|
||||
value varchar(255) comment '参数值,最大字符长度255',
|
||||
value varchar(8126) comment '参数值,最大字符长度8126',
|
||||
type tinyint not null default 0 comment '参数类型 0:数字 1:字符串 2:加密串',
|
||||
gmt_create timestamp default current_timestamp comment 'create time',
|
||||
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||
|
||||
@@ -36,10 +36,10 @@ excludedResource:
|
||||
# eg: lili 拥有[role1,role2],明文密码为lili, 加盐密码为1A676730B0C7F54654B0E09184448289
|
||||
account:
|
||||
- appId: admin
|
||||
credential: admin@123.
|
||||
credential: admin
|
||||
role: [role1,role2]
|
||||
- appId: tom
|
||||
credential: tom@123.
|
||||
credential: tom
|
||||
role: [role1,role2,role3]
|
||||
- appId: lili
|
||||
# 注意 Digest认证不支持加盐加密的密码账户
|
||||
|
||||
@@ -14,7 +14,7 @@ services:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MYSQL_ROOT_PASSWORD: 1234
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
volumes:
|
||||
- ./dbdata/mysqldata:/var/lib/mysql/
|
||||
- ./conf/sql:/docker-entrypoint-initdb.d/
|
||||
@@ -35,7 +35,7 @@ services:
|
||||
- heartzbeat
|
||||
|
||||
hertzbeat:
|
||||
image: "tancloud/hertzbeat:1.0-beta.5"
|
||||
image: "tancloud/hertzbeat:1.0-beta.6"
|
||||
container_name: hertzbeat
|
||||
hostname: hertzbeat
|
||||
restart: always
|
||||
|
||||
@@ -2,7 +2,7 @@ FROM openjdk:8-alpine
|
||||
|
||||
MAINTAINER tomsun28 "tomsun28@outlook.com"
|
||||
|
||||
ADD hertzbeat-1.0-beta.5.tar /opt/
|
||||
ADD hertzbeat-1.0-beta.6.tar /opt/
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ CREATE TABLE param
|
||||
id bigint not null auto_increment comment '参数ID',
|
||||
monitor_id bigint not null comment '监控ID',
|
||||
field varchar(100) not null comment '参数标识符',
|
||||
value varchar(255) comment '参数值,最大字符长度255',
|
||||
value varchar(8126) comment '参数值,最大字符长度8126',
|
||||
type tinyint not null default 0 comment '参数类型 0:数字 1:字符串 2:加密串',
|
||||
gmt_create timestamp default current_timestamp comment 'create time',
|
||||
gmt_update datetime default current_timestamp on update current_timestamp comment 'update time',
|
||||
|
||||
@@ -23,7 +23,7 @@ excludedResource:
|
||||
- /**/*.ttf===get
|
||||
- /**/*.png===get
|
||||
- /**/*.gif===get
|
||||
- /**/*.png===*
|
||||
- /**/*.png===*
|
||||
# swagger ui 资源
|
||||
- /swagger-resources/**===get
|
||||
- /v2/api-docs===get
|
||||
|
||||
@@ -183,6 +183,7 @@ public class TdEngineDataStorage implements DisposableBean {
|
||||
String createTableSql = String.format(CREATE_SUPER_TABLE_SQL, superTable, fieldSqlBuilder);
|
||||
try {
|
||||
assert statement != null;
|
||||
log.info("[tdengine-data]: create {} use sql: {}.", superTable, createTableSql);
|
||||
statement.execute(createTableSql);
|
||||
statement.execute(insertDataSql);
|
||||
} catch (Exception createTableException) {
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
>
|
||||
</div>
|
||||
<div nz-row nzGutter="16">
|
||||
<div nz-col nzSpan="8"><p style="text-align: right">最近更新时间</p></div>
|
||||
<div nz-col nzSpan="8"><p style="text-align: right">更新时间</p></div>
|
||||
<div nz-col nzSpan="16"
|
||||
><p style="text-align: left">{{ monitor?.gmtUpdate | date: 'YYYY-MM-dd HH:mm:ss' }}</p></div
|
||||
>
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
</nz-form-item>
|
||||
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzFor="detect" nzTooltipTitle="新增监控前是否先探测检查监控可用性"> 是否探测 </nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzFor="detect" nzTooltipTitle="新增监控前是否先探测检查监控可用性"> 测试连接 </nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-switch [(ngModel)]="detected" name="detect" id="detect"></nz-switch>
|
||||
</nz-form-control>
|
||||
@@ -177,7 +177,7 @@
|
||||
|
||||
<div nz-row>
|
||||
<div nz-col nzSpan="8" nzOffset="9">
|
||||
<button nz-button nzType="primary" type="submit" (click)="onDetect(editForm.form)"> 探测 </button>
|
||||
<button nz-button nzType="primary" type="submit" (click)="onDetect(editForm.form)"> 测试 </button>
|
||||
<button nz-button nzType="primary" type="submit" (click)="onSubmit(editForm.form)"> 确定 </button>
|
||||
<button nz-button nzType="primary" type="reset" (click)="onCancel()"> 取消 </button>
|
||||
</div>
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
</nz-form-item>
|
||||
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzFor="detect" nzTooltipTitle="新增监控前是否先探测检查监控可用性"> 是否探测 </nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzFor="detect" nzTooltipTitle="新增监控前是否先探测检查监控可用性"> 测试连接 </nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-switch [(ngModel)]="detected" name="detect" id="detect"></nz-switch>
|
||||
</nz-form-control>
|
||||
@@ -186,7 +186,7 @@
|
||||
|
||||
<div nz-row>
|
||||
<div nz-col nzSpan="8" nzOffset="9">
|
||||
<button nz-button nzType="primary" type="submit" (click)="onDetect(newForm.form)"> 探测 </button>
|
||||
<button nz-button nzType="primary" type="submit" (click)="onDetect(newForm.form)"> 测试 </button>
|
||||
<button nz-button nzType="primary" type="submit" (click)="onSubmit(newForm.form)"> 确定 </button>
|
||||
<button nz-button nzType="primary" type="reset" (click)="onCancel()"> 取消 </button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user