mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 18:19:02 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
696432b59c | ||
|
|
299f41b769 | ||
|
|
0776480256 |
@@ -2325,42 +2325,6 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "JuJinPark",
|
||||
"name": "jujin",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/44892459?v=4",
|
||||
"profile": "https://github.com/JuJinPark",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "LL-LIN",
|
||||
"name": "LL-LIN",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/43002118?v=4",
|
||||
"profile": "https://github.com/LL-LIN",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "bigcyy",
|
||||
"name": "Yang Chen",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/73413979?v=4",
|
||||
"profile": "https://bigcyy.github.io/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "sarthakeash",
|
||||
"name": "Sarthak Arora",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/74091160?v=4",
|
||||
"profile": "https://github.com/sarthakeash",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
|
||||
/home export-ignore
|
||||
/hip export-ignore
|
||||
/template-marketplace export-ignore
|
||||
/.github export-ignore
|
||||
/.idea export-ignore
|
||||
/.devcontainer export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
|
||||
@@ -31,8 +31,6 @@ name: "CodeQL"
|
||||
on:
|
||||
schedule:
|
||||
- cron: '21 13 * * 4'
|
||||
push:
|
||||
branches: [ action* ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
|
||||
@@ -19,7 +19,7 @@ name: DOC CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, dev, action* ]
|
||||
branches: [ master, dev ]
|
||||
paths:
|
||||
- 'home/**'
|
||||
pull_request:
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
|
||||
name: 'HertzBeat Doc Pdf Builder'
|
||||
on:
|
||||
push:
|
||||
branches: [ page_build* ]
|
||||
page_build
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -22,7 +22,7 @@ name: Frontend CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, dev, action* ]
|
||||
branches: [ master, dev ]
|
||||
paths:
|
||||
- 'web-app/**'
|
||||
pull_request:
|
||||
|
||||
@@ -22,7 +22,7 @@ name: License Checker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, dev, action* ]
|
||||
branches: [ master, dev ]
|
||||
pull_request:
|
||||
branches: [ master, dev ]
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
run: |
|
||||
mvn clean install
|
||||
mvn clean package -Prelease -DskipTests
|
||||
cd hertzbeat-collector
|
||||
cd collector
|
||||
mvn clean package -Pcluster -DskipTests
|
||||
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
|
||||
@@ -13,7 +13,6 @@ mvnw.bat
|
||||
package-lock.json
|
||||
*.zip
|
||||
jdk/
|
||||
data/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
@@ -55,5 +54,3 @@ node_modules
|
||||
application-dev.yml
|
||||
application-mysql.yml
|
||||
application-pg.yml
|
||||
/package.json
|
||||
/yarn.lock
|
||||
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
FROM gitpod/workspace-full
|
||||
|
||||
USER gitpod
|
||||
|
||||
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && \
|
||||
sdk install java 17.0.3-ms && \
|
||||
sdk default java 17.0.3-ms"
|
||||
+2
-3
@@ -1,6 +1,3 @@
|
||||
image:
|
||||
file: .gitpod.Dockerfile
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Run backend
|
||||
@@ -18,6 +15,8 @@ tasks:
|
||||
|
||||
- name: Setup backend
|
||||
init: |
|
||||
sdk install java 17.0.11.fx-zulu < /dev/null
|
||||
sdk default java 17.0.11.fx-zulu < /dev/null
|
||||
mvn clean install -DskipTests
|
||||
command: |
|
||||
gp sync-done setup-backend
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Apache HertzBeat (incubating)
|
||||
Copyright 2024-2025 The Apache Software Foundation
|
||||
Copyright 2024 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
@@ -510,12 +510,6 @@ Thanks to these wonderful people, welcome to join us:
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yasminvo"><img src="https://avatars.githubusercontent.com/u/107528848?v=4?s=100" width="100px;" alt="yasminvo"/><br /><sub><b>yasminvo</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yasminvo" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/notbugggg"><img src="https://avatars.githubusercontent.com/u/147966331?v=4?s=100" width="100px;" alt="不关银渐层的事哦"/><br /><sub><b>不关银渐层的事哦</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=notbugggg" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yyahang"><img src="https://avatars.githubusercontent.com/u/90464876?v=4?s=100" width="100px;" alt="yyahang"/><br /><sub><b>yyahang</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yyahang" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/JuJinPark"><img src="https://avatars.githubusercontent.com/u/44892459?v=4?s=100" width="100px;" alt="jujin"/><br /><sub><b>jujin</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=JuJinPark" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/LL-LIN"><img src="https://avatars.githubusercontent.com/u/43002118?v=4?s=100" width="100px;" alt="LL-LIN"/><br /><sub><b>LL-LIN</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=LL-LIN" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://bigcyy.github.io/"><img src="https://avatars.githubusercontent.com/u/73413979?v=4?s=100" width="100px;" alt="Yang Chen"/><br /><sub><b>Yang Chen</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=bigcyy" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sarthakeash"><img src="https://avatars.githubusercontent.com/u/74091160?v=4?s=100" width="100px;" alt="Sarthak Arora"/><br /><sub><b>Sarthak Arora</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=sarthakeash" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -509,12 +509,6 @@ Thanks these wonderful people, welcome to join us:
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yasminvo"><img src="https://avatars.githubusercontent.com/u/107528848?v=4?s=100" width="100px;" alt="yasminvo"/><br /><sub><b>yasminvo</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yasminvo" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/notbugggg"><img src="https://avatars.githubusercontent.com/u/147966331?v=4?s=100" width="100px;" alt="不关银渐层的事哦"/><br /><sub><b>不关银渐层的事哦</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=notbugggg" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yyahang"><img src="https://avatars.githubusercontent.com/u/90464876?v=4?s=100" width="100px;" alt="yyahang"/><br /><sub><b>yyahang</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yyahang" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/JuJinPark"><img src="https://avatars.githubusercontent.com/u/44892459?v=4?s=100" width="100px;" alt="jujin"/><br /><sub><b>jujin</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=JuJinPark" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/LL-LIN"><img src="https://avatars.githubusercontent.com/u/43002118?v=4?s=100" width="100px;" alt="LL-LIN"/><br /><sub><b>LL-LIN</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=LL-LIN" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://bigcyy.github.io/"><img src="https://avatars.githubusercontent.com/u/73413979?v=4?s=100" width="100px;" alt="Yang Chen"/><br /><sub><b>Yang Chen</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=bigcyy" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sarthakeash"><img src="https://avatars.githubusercontent.com/u/74091160?v=4?s=100" width="100px;" alt="Sarthak Arora"/><br /><sub><b>Sarthak Arora</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=sarthakeash" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -73,11 +73,6 @@
|
||||
"field": "successCode",
|
||||
"type": 4,
|
||||
"paramValue": "200, 201"
|
||||
},
|
||||
{
|
||||
"field": "enableUrlEncoding",
|
||||
"type": 1,
|
||||
"paramValue": true
|
||||
}
|
||||
]
|
||||
}
|
||||
+18
-43
@@ -55,8 +55,6 @@ public class RealTimeAlertCalculator {
|
||||
private static final int CALCULATE_THREADS = 3;
|
||||
|
||||
private static final String KEY_INSTANCE = "__instance__";
|
||||
private static final String KEY_INSTANCE_NAME = "__instancename__";
|
||||
private static final String KEY_INSTANCE_HOST = "__instancehost__";
|
||||
private static final String KEY_APP = "__app__";
|
||||
private static final String KEY_METRICS = "__metrics__";
|
||||
private static final String KEY_PRIORITY = "__priority__";
|
||||
@@ -127,14 +125,10 @@ public class RealTimeAlertCalculator {
|
||||
private void calculate(CollectRep.MetricsData metricsData) {
|
||||
long currentTimeMilli = System.currentTimeMillis();
|
||||
String instance = String.valueOf(metricsData.getId());
|
||||
String instanceName = metricsData.getInstanceName();
|
||||
String instanceHost = metricsData.getInstanceHost();
|
||||
String app = metricsData.getApp();
|
||||
String metrics = metricsData.getMetrics();
|
||||
int priority = metricsData.getPriority();
|
||||
int code = metricsData.getCode().getNumber();
|
||||
Map<String, String> labels = metricsData.getLabels();
|
||||
Map<String, String> annotations = metricsData.getAnnotations();
|
||||
List<AlertDefine> thresholds = this.alertDefineService.getRealTimeAlertDefines();
|
||||
// Filter thresholds by app, metrics and instance
|
||||
thresholds = filterThresholdsByAppAndMetrics(thresholds, app, metrics, instance, priority);
|
||||
@@ -143,8 +137,6 @@ public class RealTimeAlertCalculator {
|
||||
}
|
||||
Map<String, Object> commonContext = new HashMap<>(8);
|
||||
commonContext.put(KEY_INSTANCE, instance);
|
||||
commonContext.put(KEY_INSTANCE_NAME, instanceName);
|
||||
commonContext.put(KEY_INSTANCE_HOST, instanceHost);
|
||||
commonContext.put(KEY_APP, app);
|
||||
commonContext.put(KEY_PRIORITY, priority);
|
||||
commonContext.put(KEY_CODE, code);
|
||||
@@ -152,9 +144,6 @@ public class RealTimeAlertCalculator {
|
||||
if (priority == 0) {
|
||||
commonContext.put(KEY_AVAILABLE, metricsData.getCode() == CollectRep.Code.SUCCESS ? UP : DOWN);
|
||||
}
|
||||
if (labels != null) {
|
||||
commonContext.putAll(labels);
|
||||
}
|
||||
List<CollectRep.Field> fields = metricsData.getFields();
|
||||
Map<String, Object> fieldValueMap = new HashMap<>(8);
|
||||
int valueRowCount = metricsData.getValuesCount();
|
||||
@@ -171,26 +160,21 @@ public class RealTimeAlertCalculator {
|
||||
if (StringUtils.isBlank(expr)) {
|
||||
continue;
|
||||
}
|
||||
Map<String, String> commonFingerPrints = new HashMap<>(8);
|
||||
commonFingerPrints.put(CommonConstants.LABEL_INSTANCE, instance);
|
||||
// here use the alert name as finger, not care the alert name may be changed
|
||||
commonFingerPrints.put(CommonConstants.LABEL_ALERT_NAME, define.getName());
|
||||
commonFingerPrints.put(CommonConstants.LABEL_INSTANCE_NAME, instanceName);
|
||||
commonFingerPrints.put(CommonConstants.LABEL_INSTANCE_HOST, instanceHost);
|
||||
commonFingerPrints.putAll(define.getLabels());
|
||||
if (labels != null) {
|
||||
commonFingerPrints.putAll(labels);
|
||||
}
|
||||
{
|
||||
// trigger the expr before the metrics data, due the available up down or others
|
||||
try {
|
||||
boolean match = execAlertExpression(fieldValueMap, expr, true);
|
||||
try {
|
||||
Map<String, String> fingerPrints = new HashMap<>(8);
|
||||
fingerPrints.put(CommonConstants.LABEL_INSTANCE, instance);
|
||||
// here use the alert name as finger, not care the alert name may be changed
|
||||
fingerPrints.put(CommonConstants.LABEL_ALERT_NAME, define.getName());
|
||||
fingerPrints.putAll(define.getLabels());
|
||||
if (match) {
|
||||
// If the threshold rule matches, the number of times the threshold has been triggered is determined and an alarm is triggered
|
||||
afterThresholdRuleMatch(currentTimeMilli, commonFingerPrints, fieldValueMap, define, annotations);
|
||||
afterThresholdRuleMatch(currentTimeMilli, fingerPrints, fieldValueMap, define);
|
||||
} else {
|
||||
handleRecoveredAlert(commonFingerPrints);
|
||||
handleRecoveredAlert(fingerPrints);
|
||||
}
|
||||
// if this threshold pre compile success, ignore blew
|
||||
continue;
|
||||
@@ -208,7 +192,9 @@ public class RealTimeAlertCalculator {
|
||||
fieldValueMap.put(KEY_ROW, valueRowCount);
|
||||
fieldValueMap.putAll(commonContext);
|
||||
fingerPrints.clear();
|
||||
fingerPrints.putAll(commonFingerPrints);
|
||||
fingerPrints.put(CommonConstants.LABEL_INSTANCE, instance);
|
||||
fingerPrints.put(CommonConstants.LABEL_ALERT_NAME, define.getName());
|
||||
fingerPrints.putAll(define.getLabels());
|
||||
for (int index = 0; index < valueRow.getColumnsList().size(); index++) {
|
||||
String valueStr = valueRow.getColumns(index);
|
||||
if (CommonConstants.NULL_VALUE.equals(valueStr)) {
|
||||
@@ -242,7 +228,7 @@ public class RealTimeAlertCalculator {
|
||||
boolean match = execAlertExpression(fieldValueMap, expr, false);
|
||||
try {
|
||||
if (match) {
|
||||
afterThresholdRuleMatch(currentTimeMilli, fingerPrints, fieldValueMap, define, annotations);
|
||||
afterThresholdRuleMatch(currentTimeMilli, fingerPrints, fieldValueMap, define);
|
||||
} else {
|
||||
handleRecoveredAlert(fingerPrints);
|
||||
}
|
||||
@@ -325,31 +311,20 @@ public class RealTimeAlertCalculator {
|
||||
pendingAlertMap.remove(fingerprint);
|
||||
}
|
||||
|
||||
private void afterThresholdRuleMatch(long currentTimeMilli, Map<String, String> fingerPrints,
|
||||
Map<String, Object> fieldValueMap, AlertDefine define, Map<String, String> annotations) {
|
||||
private void afterThresholdRuleMatch(long currentTimeMilli, Map<String, String> fingerPrints,
|
||||
Map<String, Object> fieldValueMap, AlertDefine define) {
|
||||
String fingerprint = calculateFingerprint(fingerPrints);
|
||||
SingleAlert existingAlert = pendingAlertMap.get(fingerprint);
|
||||
Map<String, String> labels = new HashMap<>(8);
|
||||
fieldValueMap.putAll(define.getLabels());
|
||||
labels.putAll(fingerPrints);
|
||||
int requiredTimes = define.getTimes() == null ? 1 : define.getTimes();
|
||||
if (existingAlert == null) {
|
||||
// First time triggering alert, create new alert and set to pending status
|
||||
Map<String, String> alertLabels = new HashMap<>(8);
|
||||
alertLabels.putAll(fingerPrints);
|
||||
Map<String, String> alertAnnotations = new HashMap<>(8);
|
||||
if (annotations != null) {
|
||||
alertAnnotations.putAll(annotations);
|
||||
}
|
||||
if (define.getAnnotations() != null) {
|
||||
alertAnnotations.putAll(define.getAnnotations());
|
||||
}
|
||||
// render var content in annotations
|
||||
for (Map.Entry<String, String> entry : alertAnnotations.entrySet()) {
|
||||
entry.setValue(AlertTemplateUtil.render(entry.getValue(), fieldValueMap));
|
||||
}
|
||||
SingleAlert newAlert = SingleAlert.builder()
|
||||
.labels(alertLabels)
|
||||
.annotations(alertAnnotations)
|
||||
// render var content in content
|
||||
.labels(labels)
|
||||
// todo render var content in annotations
|
||||
.annotations(define.getAnnotations())
|
||||
.content(AlertTemplateUtil.render(define.getTemplate(), fieldValueMap))
|
||||
.status(CommonConstants.ALERT_STATUS_PENDING)
|
||||
.triggerTimes(1)
|
||||
|
||||
-9
@@ -17,39 +17,30 @@
|
||||
|
||||
package org.apache.hertzbeat.alert.config;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Alibaba Cloud SMS configuration properties
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AlibabaSmsProperties {
|
||||
/**
|
||||
* Alibaba Cloud access key id
|
||||
*/
|
||||
@NotBlank(message = "AccessKeyId cannot be empty")
|
||||
private String accessKeyId;
|
||||
|
||||
/**
|
||||
* Alibaba Cloud access key secret
|
||||
*/
|
||||
@NotBlank(message = "AccessKeySecret cannot be empty")
|
||||
private String accessKeySecret;
|
||||
|
||||
/**
|
||||
* SMS signature
|
||||
*/
|
||||
@NotBlank(message = "SignName cannot be empty")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* SMS template Code
|
||||
*/
|
||||
@NotBlank(message = "TemplateCode cannot be null")
|
||||
private String templateCode;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
|
||||
package org.apache.hertzbeat.alert.config;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -28,8 +25,6 @@ import org.springframework.stereotype.Component;
|
||||
* SMS configuration
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "alerter.sms")
|
||||
public class SmsConfig {
|
||||
@@ -42,7 +37,6 @@ public class SmsConfig {
|
||||
/**
|
||||
* sms service provider
|
||||
*/
|
||||
@NotBlank(message = "Type cannot be empty")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
@@ -60,16 +54,6 @@ public class SmsConfig {
|
||||
*/
|
||||
private UniSmsProperties unisms;
|
||||
|
||||
/**
|
||||
* Aws configuration
|
||||
*/
|
||||
private AwsSmsProperties aws;
|
||||
|
||||
/**
|
||||
* Twilio SMS configuration
|
||||
*/
|
||||
private TwilioSmsProperties twilio;
|
||||
|
||||
/**
|
||||
* Smslocal SMS configuration
|
||||
*/
|
||||
|
||||
-4
@@ -18,16 +18,12 @@
|
||||
package org.apache.hertzbeat.alert.config;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Smslocal SMS Properties
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SmslocalSmsProperties {
|
||||
/**
|
||||
* SmsLocal account api key
|
||||
|
||||
-10
@@ -17,45 +17,35 @@
|
||||
|
||||
package org.apache.hertzbeat.alert.config;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Tencent Cloud SMS properties
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TencentSmsProperties {
|
||||
/**
|
||||
* Tencent cloud account secret id
|
||||
*/
|
||||
@NotBlank(message = "SecretId cannot be empty")
|
||||
private String secretId;
|
||||
|
||||
/**
|
||||
* Tencent cloud account secret key
|
||||
*/
|
||||
@NotBlank(message = "SecretKey cannot be empty")
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* SMS app id
|
||||
*/
|
||||
@NotBlank(message = "AppId cannot be null")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* SMS signature
|
||||
*/
|
||||
@NotBlank(message = "SignName cannot be empty")
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* SMS template ID
|
||||
*/
|
||||
@NotBlank(message = "templateId cannot be null")
|
||||
private String templateId;
|
||||
}
|
||||
-9
@@ -17,22 +17,16 @@
|
||||
|
||||
package org.apache.hertzbeat.alert.config;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* UniSMS properties
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UniSmsProperties {
|
||||
/**
|
||||
* UniSMS access key id
|
||||
*/
|
||||
@NotBlank(message = "accessKeyId cannot be empty")
|
||||
private String accessKeyId;
|
||||
|
||||
/**
|
||||
@@ -43,18 +37,15 @@ public class UniSmsProperties {
|
||||
/**
|
||||
* SMS signature
|
||||
*/
|
||||
@NotBlank(message = "signature cannot be null")
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* SMS template ID
|
||||
*/
|
||||
@NotBlank(message = "templateId cannot be null")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* Authentication mode: simple or hmac, default is simple
|
||||
*/
|
||||
@NotBlank(message = "authMode cannot be null")
|
||||
private String authMode = "simple";
|
||||
}
|
||||
+2
-2
@@ -118,11 +118,11 @@ public class TencentCloudExternAlert {
|
||||
/**
|
||||
* Transaction alarm
|
||||
*/
|
||||
public static final String EVENT = "event";
|
||||
private static final String EVENT = "event";
|
||||
|
||||
/**
|
||||
* Indicator alarm
|
||||
*/
|
||||
public static final String METRIC = "metric";
|
||||
private static final String METRIC = "metric";
|
||||
|
||||
}
|
||||
|
||||
-3
@@ -48,7 +48,6 @@ final class TelegramBotAlertNotifyHandlerImpl extends AbstractAlertNotifyHandler
|
||||
TelegramBotNotifyDTO notifyBody = TelegramBotNotifyDTO.builder()
|
||||
.chatId(receiver.getTgUserId())
|
||||
.text(renderContent(noticeTemplate, alert))
|
||||
.messageThreadId(receiver.getTgMessageThreadId())
|
||||
.disableWebPagePreview(true)
|
||||
.build();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -85,8 +84,6 @@ final class TelegramBotAlertNotifyHandlerImpl extends AbstractAlertNotifyHandler
|
||||
private String text;
|
||||
@JsonProperty("disable_web_page_preview")
|
||||
private Boolean disableWebPagePreview;
|
||||
@JsonProperty("message_thread_id")
|
||||
private String messageThreadId;
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
+1
-11
@@ -21,9 +21,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hertzbeat.alert.config.SmsConfig;
|
||||
import org.apache.hertzbeat.alert.service.impl.SmsLocalSmsClientImpl;
|
||||
import org.apache.hertzbeat.alert.service.impl.AwsSmsClientImpl;
|
||||
import org.apache.hertzbeat.alert.service.impl.TencentSmsClientImpl;
|
||||
import org.apache.hertzbeat.alert.service.impl.TwilioSmsClientImpl;
|
||||
import org.apache.hertzbeat.alert.service.impl.UniSmsClientImpl;
|
||||
import org.apache.hertzbeat.alert.service.impl.AlibabaSmsClientImpl;
|
||||
import org.apache.hertzbeat.base.dao.GeneralConfigDao;
|
||||
@@ -34,9 +32,7 @@ import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.ALIBABA;
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.AWS;
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.TENCENT;
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.TWILIO;
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.UNISMS;
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.SMSLOCAL;
|
||||
|
||||
@@ -140,15 +136,9 @@ public class SmsClientFactory {
|
||||
case SMSLOCAL:
|
||||
currentSmsClient = new SmsLocalSmsClientImpl(smsConfig.getSmslocal());
|
||||
break;
|
||||
case AWS:
|
||||
currentSmsClient = new AwsSmsClientImpl(smsConfig.getAws());
|
||||
break;
|
||||
case TWILIO:
|
||||
currentSmsClient = new TwilioSmsClientImpl(smsConfig.getTwilio());
|
||||
break;
|
||||
default:
|
||||
log.warn("[SmsClientFactory] Unsupported SMS provider type: {}", smsConfig.getType());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-287
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hertzbeat.alert.config.AwsSmsProperties;
|
||||
import org.apache.hertzbeat.alert.service.SmsClient;
|
||||
import org.apache.hertzbeat.alert.util.CryptoUtils;
|
||||
import org.apache.hertzbeat.common.entity.alerter.GroupAlert;
|
||||
import org.apache.hertzbeat.common.entity.alerter.NoticeReceiver;
|
||||
import org.apache.hertzbeat.common.entity.alerter.NoticeTemplate;
|
||||
import org.apache.hertzbeat.common.support.exception.SendMessageException;
|
||||
import org.apache.hertzbeat.common.util.JsonUtil;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.AWS;
|
||||
|
||||
/**
|
||||
* AWS Cloud SMS Client Implementation<br>
|
||||
* API doc:<a href="https://docs.aws.amazon.com/pinpoint/latest/apireference_smsvoicev2/API_SendTextMessage.html">https://docs.aws.amazon.com/pinpoint/latest/apireference_smsvoicev2/API_SendTextMessage.html</a><br>
|
||||
* Signature doc:<a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html"</a>https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html</a>
|
||||
*/
|
||||
@Slf4j
|
||||
public class AwsSmsClientImpl implements SmsClient {
|
||||
|
||||
|
||||
private static final String SERVICE = "sms-voice";
|
||||
private static final String MESSAGE_TEMPLATE = "Instance: %s, Priority: %s, Content: %s";
|
||||
|
||||
private final String accessKey;
|
||||
private final String secretKey;
|
||||
private final String region;
|
||||
|
||||
public AwsSmsClientImpl(AwsSmsProperties config) {
|
||||
if (config != null) {
|
||||
this.accessKey = config.getAccessKeyId();
|
||||
this.secretKey = config.getAccessKeySecret();
|
||||
this.region = config.getRegion();
|
||||
} else {
|
||||
this.accessKey = "";
|
||||
this.secretKey = "";
|
||||
this.region = "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(NoticeReceiver receiver, NoticeTemplate noticeTemplate, GroupAlert alert) {
|
||||
// Extract alert info
|
||||
String instance = null;
|
||||
String priority = null;
|
||||
String content = null;
|
||||
if (alert.getCommonLabels() != null) {
|
||||
instance = alert.getCommonLabels().get("instance") == null ? alert.getGroupKey() : alert.getCommonLabels().get("instance");
|
||||
priority = alert.getCommonLabels().get("priority") == null ? "unknown" : alert.getCommonLabels().get("priority");
|
||||
content = alert.getCommonAnnotations().get("summary");
|
||||
content = content == null ? alert.getCommonAnnotations().get("description") : content;
|
||||
if (content == null) {
|
||||
content = alert.getCommonAnnotations().values().stream().findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
this.send(receiver.getPhone(), createMessage(instance, priority, content));
|
||||
}
|
||||
|
||||
private String createMessage(String instance, String priority, String content) {
|
||||
return String.format(MESSAGE_TEMPLATE, instance, priority, content);
|
||||
}
|
||||
|
||||
private void send(String phoneNumber, String message) {
|
||||
Map<String, Object> payload = new HashMap<>();
|
||||
payload.put("MessageBody", message);
|
||||
payload.put("DestinationPhoneNumber", phoneNumber);
|
||||
payload.put("MessageType", "TRANSACTIONAL");
|
||||
|
||||
Instant now = Instant.now();
|
||||
String amzDate = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'").withZone(ZoneOffset.UTC).format(now);
|
||||
String endpoint = "https://" + SERVICE + "." + region + ".amazonaws.com";
|
||||
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||
String payloadInString = new ObjectMapper().writeValueAsString(payload);
|
||||
URI requestUri = new URI(endpoint);
|
||||
|
||||
HttpPost httpPost = createHttpPost(requestUri, amzDate, payloadInString);
|
||||
log.info("Sending AWS SMS request to {}", requestUri + "," + "headers: " + Arrays.toString(httpPost.getAllHeaders()));
|
||||
executeRequest(httpClient, httpPost, phoneNumber);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to send SMS: {}", e.getMessage());
|
||||
throw new SendMessageException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private HttpPost createHttpPost(URI requestUri, String amzDate, String payloadInString) throws Exception {
|
||||
// Define headers once to avoid repetition (Order of headers must be maintained)
|
||||
Map<String, String> headers = new LinkedHashMap<>();
|
||||
headers.put("content-type", "application/x-amz-json-1.0");
|
||||
headers.put("host", SERVICE + "." + this.region + ".amazonaws.com");
|
||||
headers.put("x-amz-date", amzDate);
|
||||
headers.put("x-amz-target", "PinpointSMSVoiceV2.SendTextMessage");
|
||||
|
||||
// Build authorization header using the same headers
|
||||
AwsAuthenticationBuilder authBuilder = new AwsAuthenticationBuilder()
|
||||
.credential(this.accessKey, this.secretKey)
|
||||
.region(this.region);
|
||||
headers.forEach(authBuilder::header);
|
||||
String authorizationHeader = authBuilder.build(requestUri, "POST", SERVICE, payloadInString);
|
||||
|
||||
// Create HTTP post and set all headers
|
||||
HttpPost httpPost = new HttpPost(requestUri);
|
||||
httpPost.setHeader("Authorization", authorizationHeader);
|
||||
headers.forEach(httpPost::setHeader);
|
||||
|
||||
httpPost.setEntity(new StringEntity(payloadInString, ContentType.APPLICATION_JSON));
|
||||
return httpPost;
|
||||
}
|
||||
|
||||
private void executeRequest(CloseableHttpClient httpClient, HttpPost httpPost, String phoneNumber) throws Exception {
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
String responseBody = EntityUtils.toString(response.getEntity());
|
||||
log.info("SMS response status: {}, body: {}", statusCode, responseBody);
|
||||
|
||||
if (statusCode != 200) {
|
||||
throw new SendMessageException("HTTP request failed with status code: " + statusCode + ", response: " + responseBody);
|
||||
}
|
||||
|
||||
JsonNode jsonResponse = JsonUtil.fromJson(responseBody);
|
||||
if (jsonResponse == null) {
|
||||
throw new SendMessageException(statusCode + ":" + responseBody);
|
||||
}
|
||||
|
||||
JsonNode responseNode = jsonResponse.get("MessageId");
|
||||
if (responseNode == null) {
|
||||
throw new SendMessageException(statusCode + ":" + responseBody);
|
||||
}
|
||||
|
||||
String messageId = responseNode.asText();
|
||||
log.info("Successfully sent SMS to phone: {}, messageId: {}", phoneNumber, messageId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return AWS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkConfig() {
|
||||
return !(accessKey.isBlank() || secretKey.isBlank() || region.isBlank());
|
||||
}
|
||||
|
||||
|
||||
private static class AwsAuthenticationBuilder {
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
private String region;
|
||||
private String service;
|
||||
private URI requestUri;
|
||||
private String method;
|
||||
private String payload;
|
||||
private final Map<String, String> headers = new LinkedHashMap<>();
|
||||
|
||||
public AwsAuthenticationBuilder region(String region) {
|
||||
this.region = region;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AwsAuthenticationBuilder credential(String accessKey, String secretKey) {
|
||||
this.accessKey = accessKey;
|
||||
this.secretKey = secretKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AwsAuthenticationBuilder header(String header, String value) {
|
||||
this.headers.put(header, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String build(URI requestUri, String method, String service, String payload) throws Exception {
|
||||
this.requestUri = requestUri;
|
||||
this.method = method;
|
||||
this.service = service;
|
||||
this.payload = payload;
|
||||
return "%s Credential=%s/%s, SignedHeaders=%s, Signature=%s".formatted(
|
||||
getAlgorithm(),
|
||||
this.accessKey,
|
||||
getCredentialScope(),
|
||||
getSignedHeaders(),
|
||||
getSignature()
|
||||
);
|
||||
}
|
||||
|
||||
private String getCredentialScope() {
|
||||
return getDateStamp() + "/" + region + "/" + service + "/aws4_request";
|
||||
}
|
||||
|
||||
private String getSignedHeaders() {
|
||||
return String.join(";", headers.keySet());
|
||||
}
|
||||
|
||||
private String getDateTime() {
|
||||
return headers.get("x-amz-date");
|
||||
}
|
||||
|
||||
private String getDateStamp() {
|
||||
return getDateTime().substring(0, 8);
|
||||
}
|
||||
|
||||
private String getSignature() {
|
||||
String canonicalRequest = getCanonicalRequest();
|
||||
String stringToSign = String.join("\n",
|
||||
getAlgorithm(),
|
||||
getDateTime(),
|
||||
getCredentialScope(),
|
||||
CryptoUtils.sha256Hex(canonicalRequest));
|
||||
|
||||
byte[] signingKey = getSignatureKey(secretKey, getDateStamp(), region, service);
|
||||
return CryptoUtils.hmacSha256Hex(signingKey, stringToSign);
|
||||
}
|
||||
|
||||
private String getCanonicalRequest() {
|
||||
return String.join("\n",
|
||||
method,
|
||||
requestUri.getPath().isEmpty() ? "/" : requestUri.getPath(),
|
||||
requestUri.getQuery() != null ? requestUri.getQuery() : "",
|
||||
getCanonicalHeaders(),
|
||||
getSignedHeaders(),
|
||||
CryptoUtils.sha256Hex(payload)
|
||||
);
|
||||
}
|
||||
|
||||
private String getCanonicalHeaders() {
|
||||
return headers.entrySet().stream()
|
||||
.map(entry -> entry.getKey() + ":" + entry.getValue())
|
||||
.collect(Collectors.joining("\n")) + "\n";
|
||||
}
|
||||
|
||||
private String getAlgorithm() {
|
||||
return "AWS4-HMAC-SHA256";
|
||||
}
|
||||
|
||||
private byte[] getSignatureKey(String key, String dateStamp, String regionName, String serviceName) {
|
||||
byte[] secret = ("AWS4" + key).getBytes(StandardCharsets.UTF_8);
|
||||
byte[] date = CryptoUtils.hmac256(secret, dateStamp);
|
||||
byte[] region = CryptoUtils.hmac256(date, regionName);
|
||||
byte[] service = CryptoUtils.hmac256(region, serviceName);
|
||||
return CryptoUtils.hmac256(service, "aws4_request");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -305,7 +305,7 @@ public class NoticeConfigServiceImpl implements NoticeConfigService, CommandLine
|
||||
Map<String, String> labels = new HashMap<>(8);
|
||||
labels.put(CommonConstants.LABEL_INSTANCE, "1000000");
|
||||
labels.put(CommonConstants.LABEL_ALERT_NAME, "CPU Usage Alert");
|
||||
labels.put(CommonConstants.LABEL_INSTANCE_HOST, "127.0.0.1");
|
||||
labels.put(CommonConstants.LABEL_HOST, "127.0.0.1");
|
||||
Map<String, String> annotations = new HashMap<>(8);
|
||||
annotations.put("suggest", "Please check the CPU usage of the server");
|
||||
SingleAlert singleAlert1 = SingleAlert.builder()
|
||||
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hertzbeat.alert.dto.SkyWalkingExternAlert;
|
||||
import org.apache.hertzbeat.alert.reduce.AlarmCommonReduce;
|
||||
import org.apache.hertzbeat.alert.service.ExternAlertService;
|
||||
import org.apache.hertzbeat.common.constants.CommonConstants;
|
||||
import org.apache.hertzbeat.common.entity.alerter.SingleAlert;
|
||||
import org.apache.hertzbeat.common.util.JsonUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SkyWalking external alarm service impl
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SkyWalkingExternAlertService implements ExternAlertService {
|
||||
|
||||
@Autowired
|
||||
private AlarmCommonReduce alarmCommonReduce;
|
||||
|
||||
|
||||
@Override
|
||||
public void addExternAlert(String content) {
|
||||
TypeReference<List<SkyWalkingExternAlert>> typeReference = new TypeReference<>() {};
|
||||
List<SkyWalkingExternAlert> alerts = JsonUtil.fromJson(content, typeReference);
|
||||
if (alerts == null || alerts.isEmpty()) {
|
||||
log.warn("Parse SkyWalking extern alert content failed! content: {}", content);
|
||||
return;
|
||||
}
|
||||
for (SkyWalkingExternAlert alert : alerts) {
|
||||
SingleAlert singleAlert = SingleAlert.builder()
|
||||
.content(alert.getAlarmMessage())
|
||||
.status(CommonConstants.ALERT_STATUS_FIRING)
|
||||
.activeAt(Instant.now().toEpochMilli())
|
||||
.startAt(alert.getStartTime() != null ? alert.getStartTime() : Instant.now().toEpochMilli())
|
||||
.labels(acquireAlertLabels(alert))
|
||||
.annotations(acquireAlertAnnotations(alert))
|
||||
.triggerTimes(1)
|
||||
.build();
|
||||
alarmCommonReduce.reduceAndSendAlarm(singleAlert);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String supportSource() {
|
||||
return "skywalking";
|
||||
}
|
||||
|
||||
private Map<String, String> acquireAlertLabels(SkyWalkingExternAlert externAlert){
|
||||
Map<String, String> labels = new HashMap<>(8);
|
||||
labels.put("__source__", "skywalking");
|
||||
List<SkyWalkingExternAlert.Tag> tags = externAlert.getTags();
|
||||
if (tags == null || tags.isEmpty()){
|
||||
return labels;
|
||||
}
|
||||
tags.forEach(tag -> labels.put(tag.getKey(), tag.getValue()));
|
||||
return labels;
|
||||
}
|
||||
|
||||
private Map<String, String> acquireAlertAnnotations(SkyWalkingExternAlert externAlert){
|
||||
Map<String, String> annotations = new HashMap<>(8);
|
||||
annotations.putIfAbsent("scope", externAlert.getScope());
|
||||
annotations.putIfAbsent("name", externAlert.getName());
|
||||
annotations.putIfAbsent("id0", externAlert.getId0());
|
||||
annotations.putIfAbsent("id1", externAlert.getId1());
|
||||
annotations.putIfAbsent("ruleName", externAlert.getRuleName());
|
||||
return annotations;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-174
@@ -18,22 +18,14 @@
|
||||
package org.apache.hertzbeat.alert.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hertzbeat.alert.dto.TencentCloudExternAlert;
|
||||
import org.apache.hertzbeat.alert.reduce.AlarmCommonReduce;
|
||||
import org.apache.hertzbeat.alert.service.ExternAlertService;
|
||||
import org.apache.hertzbeat.common.constants.CommonConstants;
|
||||
import org.apache.hertzbeat.common.entity.alerter.SingleAlert;
|
||||
import org.apache.hertzbeat.common.util.JsonUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Default external alarm service impl
|
||||
*/
|
||||
@@ -51,7 +43,8 @@ public class TencentExternAlertService implements ExternAlertService {
|
||||
log.warn("parse extern alert content failed! content: {}", content);
|
||||
return;
|
||||
}
|
||||
SingleAlert alert = new TencentCloudAlertConverter().convert(report);
|
||||
// todo convert TenCloudAlertReport to SingleAlert
|
||||
SingleAlert alert = new SingleAlert();
|
||||
alarmCommonReduce.reduceAndSendAlarm(alert);
|
||||
}
|
||||
|
||||
@@ -59,169 +52,4 @@ public class TencentExternAlertService implements ExternAlertService {
|
||||
public String supportSource() {
|
||||
return "tencent";
|
||||
}
|
||||
|
||||
/**
|
||||
* Converter: TencentCloud alert to SingleAlert
|
||||
*/
|
||||
public static class TencentCloudAlertConverter {
|
||||
|
||||
/**
|
||||
* Metric alert content template
|
||||
*/
|
||||
private final String metricTemplate = "Tencent Cloud Metric Alert: {metricShowName} {calcType} {calcValue}{calcUnit}, Current: {currentValue}{unit}";
|
||||
|
||||
/**
|
||||
* Event alert content template
|
||||
*/
|
||||
private final String eventTemplate = "Tencent Cloud Event Alert: {productShowName} - {eventShowName}";
|
||||
|
||||
|
||||
/**
|
||||
* Convert TencentCloud alert to SingleAlert
|
||||
*/
|
||||
public SingleAlert convert(TencentCloudExternAlert tencentAlert) {
|
||||
// Building basic information
|
||||
SingleAlert.SingleAlertBuilder builder = SingleAlert.builder()
|
||||
.status(convertStatus(tencentAlert.getAlarmStatus()))
|
||||
.startAt(parseTime(tencentAlert.getFirstOccurTime()))
|
||||
.activeAt(parseTime(tencentAlert.getFirstOccurTime()))
|
||||
.triggerTimes(1);
|
||||
// If it is a recovery state, set the end time.
|
||||
if ("0".equals(tencentAlert.getAlarmStatus())) {
|
||||
builder.endAt(parseTime(tencentAlert.getRecoverTime()));
|
||||
}
|
||||
|
||||
// Build labels
|
||||
Map<String, String> labels = new HashMap<>();
|
||||
buildLabels(labels, tencentAlert);
|
||||
|
||||
// Build annotations
|
||||
Map<String, String> annotations = new HashMap<>();
|
||||
buildAnnotations(annotations, tencentAlert);
|
||||
|
||||
// Build content
|
||||
String content = generateContent(tencentAlert);
|
||||
|
||||
return builder
|
||||
.labels(labels)
|
||||
.annotations(annotations)
|
||||
.content(content)
|
||||
.build();
|
||||
}
|
||||
|
||||
private void buildLabels(Map<String, String> labels, TencentCloudExternAlert alert) {
|
||||
labels.put("__source__", "tencent_cloud");
|
||||
labels.put("alert_type", alert.getAlarmType());
|
||||
if (TencentCloudExternAlert.METRIC.equals(alert.getAlarmType())) {
|
||||
labels.put("metric_name", alert.getAlarmPolicyInfo().getConditions().getMetricName());
|
||||
labels.put("namespace", alert.getAlarmObjInfo().getNamespace());
|
||||
} else {
|
||||
labels.put("event_name", alert.getAlarmPolicyInfo().getConditions().getEventName());
|
||||
labels.put("product_name", alert.getAlarmPolicyInfo().getConditions().getProductName());
|
||||
}
|
||||
}
|
||||
|
||||
private void buildAnnotations(Map<String, String> annotations, TencentCloudExternAlert alert) {
|
||||
TencentCloudExternAlert.AlarmPolicyInfo alarmPolicyInfo = alert.getAlarmPolicyInfo();
|
||||
TencentCloudExternAlert.AlarmObjInfo alarmObjInfo = alert.getAlarmObjInfo();
|
||||
TencentCloudExternAlert.Dimensions dimensions = alert.getAlarmObjInfo().getDimensions();
|
||||
|
||||
putIfNotNull(annotations, "policy_id", alarmPolicyInfo.getPolicyId());
|
||||
putIfNotNull(annotations, "policy_type", alarmPolicyInfo.getPolicyType());
|
||||
putIfNotNull(annotations, "policy_name", alarmPolicyInfo.getPolicyName());
|
||||
putIfNotNull(annotations, "policy_type_cname", alarmPolicyInfo.getPolicyTypeCname());
|
||||
|
||||
putIfNotNull(annotations, "namespace", alarmObjInfo.getNamespace());
|
||||
putIfNotNull(annotations, "region", alarmObjInfo.getRegion());
|
||||
putIfNotNull(annotations, "app_id", alarmObjInfo.getAppId());
|
||||
putIfNotNull(annotations, "uin", alarmObjInfo.getUin());
|
||||
|
||||
putIfNotNull(annotations, "instance_id", dimensions.getUnInstanceId());
|
||||
putIfNotNull(annotations, "obj_id", dimensions.getObjId());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate alert content with template
|
||||
*/
|
||||
private String generateContent(TencentCloudExternAlert alert) {
|
||||
if (TencentCloudExternAlert.METRIC.equals(alert.getAlarmType())) {
|
||||
return generateMetricContent(alert);
|
||||
} else {
|
||||
return generateEventContent(alert);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate metric alert content
|
||||
*/
|
||||
private String generateMetricContent(TencentCloudExternAlert alert) {
|
||||
TencentCloudExternAlert.Conditions conditions = alert.getAlarmPolicyInfo().getConditions();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
|
||||
params.put("metricShowName", conditions.getMetricShowName());
|
||||
|
||||
if (StringUtils.isNotEmpty(conditions.getCalcType())
|
||||
&& StringUtils.isNotEmpty(conditions.getCalcValue())) {
|
||||
params.put("calcType", conditions.getCalcType());
|
||||
params.put("calcValue", conditions.getCalcValue());
|
||||
params.put("calcUnit", Objects.toString(conditions.getCalcUnit(), ""));
|
||||
} else {
|
||||
params.put("calcType", "");
|
||||
params.put("calcValue", "N/A");
|
||||
params.put("calcUnit", "");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(conditions.getCurrentValue())) {
|
||||
params.put("currentValue", conditions.getCurrentValue());
|
||||
params.put("unit", Objects.toString(conditions.getUnit(), ""));
|
||||
} else {
|
||||
params.put("currentValue", "N/A");
|
||||
params.put("unit", "");
|
||||
}
|
||||
return replacePlaceholders(metricTemplate, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate event alert content
|
||||
*/
|
||||
private String generateEventContent(TencentCloudExternAlert alert) {
|
||||
TencentCloudExternAlert.Conditions conditions = alert.getAlarmPolicyInfo().getConditions();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("productShowName", conditions.getProductShowName());
|
||||
params.put("eventShowName", conditions.getEventShowName());
|
||||
return replacePlaceholders(eventTemplate, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace placeholders in template with actual values
|
||||
*/
|
||||
private String replacePlaceholders(String template, Map<String, String> params) {
|
||||
String result = template;
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
result = result.replace("{" + entry.getKey() + "}", Objects.toString(entry.getValue(), "NULL"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String convertStatus(String alarmStatus) {
|
||||
return "1".equals(alarmStatus) ? CommonConstants.ALERT_STATUS_FIRING : CommonConstants.ALERT_STATUS_RESOLVED;
|
||||
}
|
||||
|
||||
private Long parseTime(String timeStr) {
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.parse(timeStr).getTime();
|
||||
} catch (ParseException e) {
|
||||
log.error("Failed to parse time: {}", timeStr);
|
||||
throw new IllegalArgumentException("Failed to parse time: " + timeStr, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void putIfNotNull(Map<String, String> map, String key, String value){
|
||||
if (StringUtils.isNotEmpty(value)){
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-171
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hertzbeat.alert.config.TwilioSmsProperties;
|
||||
import org.apache.hertzbeat.alert.service.SmsClient;
|
||||
import org.apache.hertzbeat.common.entity.alerter.GroupAlert;
|
||||
import org.apache.hertzbeat.common.entity.alerter.NoticeReceiver;
|
||||
import org.apache.hertzbeat.common.entity.alerter.NoticeTemplate;
|
||||
import org.apache.hertzbeat.common.support.exception.SendMessageException;
|
||||
import org.apache.hertzbeat.common.util.JsonUtil;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.hertzbeat.common.constants.SmsConstants.TWILIO;
|
||||
|
||||
/**
|
||||
* Twilio SMS Client Implementation<br>
|
||||
* API doc: <a href=
|
||||
* "https://www.twilio.com/docs/sms/api">https://www.twilio.com/docs/sms/api</a>
|
||||
*/
|
||||
@Slf4j
|
||||
public class TwilioSmsClientImpl implements SmsClient {
|
||||
|
||||
private static final String API_URL_FORMAT = "https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json";
|
||||
private static final String MESSAGE_TEMPLATE = "Instance: %s, Priority: %s, Content: %s";
|
||||
|
||||
private final String accountSid;
|
||||
private final String authToken;
|
||||
private final String twilioPhoneNumber;
|
||||
|
||||
public TwilioSmsClientImpl(TwilioSmsProperties config) {
|
||||
if (config != null) {
|
||||
this.accountSid = config.getAccountSid();
|
||||
this.authToken = config.getAuthToken();
|
||||
this.twilioPhoneNumber = config.getTwilioPhoneNumber();
|
||||
} else {
|
||||
this.accountSid = "";
|
||||
this.authToken = "";
|
||||
this.twilioPhoneNumber = "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(NoticeReceiver receiver, NoticeTemplate noticeTemplate, GroupAlert alert) {
|
||||
String instance = null;
|
||||
String priority = null;
|
||||
String content = null;
|
||||
if (alert.getCommonLabels() != null) {
|
||||
instance = alert.getCommonLabels().get("instance") == null ? alert.getGroupKey()
|
||||
: alert.getCommonLabels().get("instance");
|
||||
priority = alert.getCommonLabels().get("priority") == null ? "unknown"
|
||||
: alert.getCommonLabels().get("priority");
|
||||
content = alert.getCommonAnnotations().get("summary");
|
||||
content = content == null ? alert.getCommonAnnotations().get("description") : content;
|
||||
if (content == null) {
|
||||
content = alert.getCommonAnnotations().values().stream().findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
this.send(receiver.getPhone(), createMessage(instance, priority, content));
|
||||
}
|
||||
|
||||
private String createMessage(String instance, String priority, String content) {
|
||||
return String.format(MESSAGE_TEMPLATE, instance, priority, content);
|
||||
}
|
||||
|
||||
private void send(String phoneNumber, String message) {
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||
String endpoint = String.format(API_URL_FORMAT, accountSid);
|
||||
URI requestUri = new URI(endpoint);
|
||||
|
||||
HttpPost httpPost = createHttpPost(requestUri, phoneNumber, message);
|
||||
log.info("Sending Twilio SMS request to {}", requestUri);
|
||||
executeRequest(httpClient, httpPost, phoneNumber);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to send SMS: {}", e.getMessage());
|
||||
throw new SendMessageException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private HttpPost createHttpPost(URI requestUri, String toNumber, String message) {
|
||||
HttpPost httpPost = new HttpPost(requestUri);
|
||||
|
||||
String auth = accountSid + ":" + authToken;
|
||||
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
|
||||
httpPost.setHeader("Authorization", "Basic " + encodedAuth);
|
||||
|
||||
List<BasicNameValuePair> parameters = new ArrayList<>();
|
||||
parameters.add(new BasicNameValuePair("To", toNumber));
|
||||
parameters.add(new BasicNameValuePair("From", twilioPhoneNumber));
|
||||
parameters.add(new BasicNameValuePair("Body", message));
|
||||
|
||||
try {
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(parameters));
|
||||
return httpPost;
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to create HTTP request: {}", e.getMessage());
|
||||
throw new SendMessageException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void executeRequest(CloseableHttpClient httpClient, HttpPost httpPost, String phoneNumber)
|
||||
throws Exception {
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
String responseBody = EntityUtils.toString(response.getEntity());
|
||||
log.info("SMS response status: {}, body: {}", statusCode, responseBody);
|
||||
|
||||
if (statusCode < 200 || statusCode >= 300) {
|
||||
|
||||
if (responseBody.contains("21608")) {
|
||||
throw new SendMessageException(
|
||||
"The Twilio trial account can only send SMS to verified phone numbers");
|
||||
} else {
|
||||
throw new SendMessageException(
|
||||
"HTTP request failed with status code: " + statusCode + ", response: " + responseBody);
|
||||
}
|
||||
}
|
||||
|
||||
JsonNode jsonResponse = JsonUtil.fromJson(responseBody);
|
||||
if (jsonResponse == null) {
|
||||
throw new SendMessageException(statusCode + ":" + responseBody);
|
||||
}
|
||||
|
||||
JsonNode sidNode = jsonResponse.get("sid");
|
||||
if (sidNode == null) {
|
||||
throw new SendMessageException(statusCode + ":" + responseBody);
|
||||
}
|
||||
|
||||
String sid = sidNode.asText();
|
||||
log.info("Successfully sent SMS to phone: {}, sid: {}", phoneNumber, sid);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return TWILIO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkConfig() {
|
||||
return !(accountSid.isBlank() || authToken.isBlank() || twilioPhoneNumber.isBlank());
|
||||
}
|
||||
}
|
||||
@@ -89,18 +89,7 @@ public class CryptoUtils {
|
||||
* @return lowercase hexadecimal string
|
||||
*/
|
||||
public static String hmacSha256Hex(String key, String data) {
|
||||
return hmacSha256Hex(hmac256(key.getBytes(UTF8), data), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate HMAC-SHA256 signature and convert to lowercase hexadecimal string
|
||||
* Note: This is necessary as, converting a String to byte[] and back may yield different results due to encoding differences or data loss.
|
||||
* @param key secret key in byte array
|
||||
* @param data data to be signed
|
||||
* @return lowercase hexadecimal string
|
||||
*/
|
||||
public static String hmacSha256Hex(byte[] key, String data) {
|
||||
byte[] hmacResult = hmac256(key, data);
|
||||
byte[] hmacResult = hmac256(key.getBytes(UTF8), data);
|
||||
return DatatypeConverter.printHexBinary(hmacResult).toLowerCase();
|
||||
}
|
||||
}
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.service;
|
||||
|
||||
import org.apache.hertzbeat.alert.config.AwsSmsProperties;
|
||||
import org.apache.hertzbeat.alert.service.impl.AwsSmsClientImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Test case for {@link AwsSmsClientImpl}
|
||||
*/
|
||||
class AwsSmsClientImplTest {
|
||||
|
||||
|
||||
@Test
|
||||
void getType() {
|
||||
AwsSmsProperties awsSmsProperties = new AwsSmsProperties();
|
||||
awsSmsProperties.setAccessKeyId("accessKeyId");
|
||||
awsSmsProperties.setAccessKeySecret("accessKeySecret");
|
||||
awsSmsProperties.setRegion("region");
|
||||
AwsSmsClientImpl awsSmsClient = new AwsSmsClientImpl(awsSmsProperties);
|
||||
|
||||
assertEquals("aws", awsSmsClient.getType());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({
|
||||
"accessKeyId, accessKeySecret, region, true",
|
||||
"accessKeyId, accessKeySecret, '', false",
|
||||
"accessKeyId, '', region, false",
|
||||
"accessKeyId, accessKeySecret, '', false",
|
||||
"accessKeyId, '', '', false",
|
||||
"'', accessKeySecret, region, false",
|
||||
"'', accessKeySecret, '', false",
|
||||
"'', '', region, false",
|
||||
"'', accessKeySecret, '', false",
|
||||
})
|
||||
void checkConfig(String accessKeyId, String accessKeySecret, String region, boolean expected) {
|
||||
AwsSmsProperties awsSmsProperties = new AwsSmsProperties();
|
||||
awsSmsProperties.setAccessKeyId(accessKeyId);
|
||||
awsSmsProperties.setAccessKeySecret(accessKeySecret);
|
||||
awsSmsProperties.setRegion(region);
|
||||
AwsSmsClientImpl awsSmsClient = new AwsSmsClientImpl(awsSmsProperties);
|
||||
|
||||
assertEquals(expected, awsSmsClient.checkConfig());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.service;
|
||||
|
||||
import org.apache.hertzbeat.alert.config.TwilioSmsProperties;
|
||||
import org.apache.hertzbeat.alert.service.impl.TwilioSmsClientImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Test case for {@link TwilioSmsClientImpl}
|
||||
*/
|
||||
class TwilioSmsClientImplTest {
|
||||
|
||||
@Test
|
||||
void getType() {
|
||||
TwilioSmsProperties twilioSmsProperties = new TwilioSmsProperties();
|
||||
twilioSmsProperties.setAccountSid("accountSid");
|
||||
twilioSmsProperties.setAuthToken("authToken");
|
||||
twilioSmsProperties.setTwilioPhoneNumber("twilioPhoneNumber");
|
||||
TwilioSmsClientImpl twilioSmsClient = new TwilioSmsClientImpl(twilioSmsProperties);
|
||||
|
||||
assertEquals("twilio", twilioSmsClient.getType());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({
|
||||
"accountSid, authToken, twilioPhoneNumber, true",
|
||||
"accountSid, authToken, '', false",
|
||||
"accountSid, '', twilioPhoneNumber, false",
|
||||
"accountSid, '', '', false",
|
||||
"'', authToken, twilioPhoneNumber, false",
|
||||
"'', authToken, '', false",
|
||||
"'', '', twilioPhoneNumber, false",
|
||||
"'', '', '', false",
|
||||
})
|
||||
void checkConfig(String accountSid, String authToken, String twilioPhoneNumber, boolean expected) {
|
||||
TwilioSmsProperties twilioSmsProperties = new TwilioSmsProperties();
|
||||
twilioSmsProperties.setAccountSid(accountSid);
|
||||
twilioSmsProperties.setAuthToken(authToken);
|
||||
twilioSmsProperties.setTwilioPhoneNumber(twilioPhoneNumber);
|
||||
TwilioSmsClientImpl twilioSmsClient = new TwilioSmsClientImpl(twilioSmsProperties);
|
||||
|
||||
assertEquals(expected, twilioSmsClient.checkConfig());
|
||||
}
|
||||
}
|
||||
+10
-59
@@ -86,7 +86,6 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
@@ -510,37 +509,13 @@ public class HttpCollectImpl extends AbstractCollect {
|
||||
}
|
||||
// params
|
||||
Map<String, String> params = httpProtocol.getParams();
|
||||
boolean enableUrlEncoding = Boolean.parseBoolean(httpProtocol.getEnableUrlEncoding());
|
||||
StringBuilder queryParams = new StringBuilder();
|
||||
|
||||
if (params != null && !params.isEmpty()) {
|
||||
for (Map.Entry<String, String> param : params.entrySet()) {
|
||||
String key = param.getKey();
|
||||
String value = param.getValue();
|
||||
|
||||
if (!StringUtils.hasText(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (queryParams.length() > 0) {
|
||||
queryParams.append("&");
|
||||
}
|
||||
|
||||
if (enableUrlEncoding) {
|
||||
key = UriUtils.encodeQueryParam(key, "UTF-8");
|
||||
}
|
||||
queryParams.append(key);
|
||||
|
||||
if (StringUtils.hasText(value)) {
|
||||
String calculatedValue = TimeExpressionUtil.calculate(value);
|
||||
if (enableUrlEncoding) {
|
||||
calculatedValue = UriUtils.encodeQueryParam(calculatedValue, "UTF-8");
|
||||
}
|
||||
queryParams.append("=").append(calculatedValue);
|
||||
if (StringUtils.hasText(param.getValue())) {
|
||||
requestBuilder.addParameter(param.getKey(), TimeExpressionUtil.calculate(param.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The default request header can be overridden if customized
|
||||
// keep-alive
|
||||
requestBuilder.addHeader(HttpHeaders.CONNECTION, NetworkConstants.KEEP_ALIVE);
|
||||
@@ -550,7 +525,8 @@ public class HttpCollectImpl extends AbstractCollect {
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
for (Map.Entry<String, String> header : headers.entrySet()) {
|
||||
if (StringUtils.hasText(header.getValue())) {
|
||||
requestBuilder.addHeader(header.getKey(), header.getValue());
|
||||
requestBuilder.addHeader(CollectUtil.replaceUriSpecialChar(header.getKey()),
|
||||
CollectUtil.replaceUriSpecialChar(header.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -584,29 +560,11 @@ public class HttpCollectImpl extends AbstractCollect {
|
||||
requestBuilder.setEntity(new StringEntity(httpProtocol.getPayload(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
// uri encode
|
||||
String uri;
|
||||
if (enableUrlEncoding) {
|
||||
// if the url contains parameters directly
|
||||
if (httpProtocol.getUrl().contains("?")) {
|
||||
String path = httpProtocol.getUrl().substring(0, httpProtocol.getUrl().indexOf("?"));
|
||||
String query = httpProtocol.getUrl().substring(httpProtocol.getUrl().indexOf("?") + 1);
|
||||
uri = UriUtils.encodePath(path, "UTF-8") + "?" + UriUtils.encodeQuery(query, "UTF-8");
|
||||
} else {
|
||||
uri = UriUtils.encodePath(httpProtocol.getUrl(), "UTF-8");
|
||||
}
|
||||
} else {
|
||||
uri = httpProtocol.getUrl();
|
||||
}
|
||||
|
||||
// append query params
|
||||
if (queryParams.length() > 0) {
|
||||
uri += (uri.contains("?") ? "&" : "?") + queryParams.toString();
|
||||
}
|
||||
|
||||
String finalUri;
|
||||
// uri
|
||||
String uri = CollectUtil.replaceUriSpecialChar(httpProtocol.getUrl());
|
||||
if (IpDomainUtil.isHasSchema(httpProtocol.getHost())) {
|
||||
finalUri = httpProtocol.getHost() + ":" + httpProtocol.getPort() + uri;
|
||||
|
||||
requestBuilder.setUri(httpProtocol.getHost() + ":" + httpProtocol.getPort() + uri);
|
||||
} else {
|
||||
String ipAddressType = IpDomainUtil.checkIpAddressType(httpProtocol.getHost());
|
||||
String baseUri = NetworkConstants.IPV6.equals(ipAddressType)
|
||||
@@ -614,18 +572,11 @@ public class HttpCollectImpl extends AbstractCollect {
|
||||
: String.format("%s:%s%s", httpProtocol.getHost(), httpProtocol.getPort(), uri);
|
||||
boolean ssl = Boolean.parseBoolean(httpProtocol.getSsl());
|
||||
if (ssl) {
|
||||
finalUri = NetworkConstants.HTTPS_HEADER + baseUri;
|
||||
requestBuilder.setUri(NetworkConstants.HTTPS_HEADER + baseUri);
|
||||
} else {
|
||||
finalUri = NetworkConstants.HTTP_HEADER + baseUri;
|
||||
requestBuilder.setUri(NetworkConstants.HTTP_HEADER + baseUri);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
requestBuilder.setUri(finalUri);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.warn("Invalid URI with illegal characters: {}. User has disabled URL encoding, not applying any encoding.", finalUri);
|
||||
throw e;
|
||||
}
|
||||
|
||||
// custom timeout
|
||||
int timeout = CollectUtil.getTimeout(httpProtocol.getTimeout(), 0);
|
||||
|
||||
+1
@@ -173,6 +173,7 @@ public class PrometheusAutoCollectImpl {
|
||||
Map<String, MetricFamily> metricFamilyMap = TextParser.textToMetricFamilies(resp);
|
||||
List<CollectRep.MetricsData> metricsDataList = new LinkedList<>();
|
||||
for (Map.Entry<String, MetricFamily> entry : metricFamilyMap.entrySet()) {
|
||||
builder.clearMetrics();
|
||||
builder.clearFields();
|
||||
builder.clearValues();
|
||||
String metricsName = entry.getKey();
|
||||
|
||||
+7
-5
@@ -79,12 +79,11 @@ public class SshCollectImpl extends AbstractCollect {
|
||||
long startTime = System.currentTimeMillis();
|
||||
SshProtocol sshProtocol = metrics.getSsh();
|
||||
boolean reuseConnection = Boolean.parseBoolean(sshProtocol.getReuseConnection());
|
||||
boolean useProxy = Boolean.parseBoolean(sshProtocol.getUseProxy());
|
||||
int timeout = CollectUtil.getTimeout(sshProtocol.getTimeout(), DEFAULT_TIMEOUT);
|
||||
ClientChannel channel = null;
|
||||
ClientSession clientSession = null;
|
||||
try {
|
||||
clientSession = getConnectSession(sshProtocol, timeout, reuseConnection, useProxy);
|
||||
clientSession = getConnectSession(sshProtocol, timeout, reuseConnection);
|
||||
if (CommonSshBlacklist.isCommandBlacklisted(sshProtocol.getScript())) {
|
||||
builder.setCode(CollectRep.Code.FAIL);
|
||||
builder.setMsg("The command is blacklisted: " + sshProtocol.getScript());
|
||||
@@ -157,7 +156,7 @@ public class SshCollectImpl extends AbstractCollect {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
if (clientSession != null && !reuseConnection && !useProxy) {
|
||||
if (clientSession != null && !reuseConnection) {
|
||||
try {
|
||||
clientSession.close();
|
||||
} catch (Exception e) {
|
||||
@@ -281,8 +280,11 @@ public class SshCollectImpl extends AbstractCollect {
|
||||
connectionCommonCache.removeCache(identifier);
|
||||
}
|
||||
|
||||
private ClientSession getConnectSession(SshProtocol sshProtocol, int timeout, boolean reuseConnection, boolean useProxy)
|
||||
private ClientSession getConnectSession(SshProtocol sshProtocol, int timeout, boolean reuseConnection)
|
||||
throws IOException, GeneralSecurityException {
|
||||
return SshHelper.getConnectSession(sshProtocol, timeout, reuseConnection, useProxy);
|
||||
return SshHelper.getConnectSession(
|
||||
sshProtocol.getHost(), sshProtocol.getPort(), sshProtocol.getUsername(), sshProtocol.getPassword(),
|
||||
sshProtocol.getPrivateKey(), sshProtocol.getPrivateKeyPassphrase(), timeout, reuseConnection
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-12
@@ -183,18 +183,21 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
||||
Job job = timerTask.getJob();
|
||||
job.constructPriorMetrics();
|
||||
Set<Metrics> metricsSet = job.getNextCollectMetrics(null, true);
|
||||
metricsSet.forEach(metrics -> {
|
||||
MetricsCollect metricsCollect = new MetricsCollect(metrics, timeout, this,
|
||||
collectorIdentity, unitConvertList);
|
||||
jobRequestQueue.addJob(metricsCollect);
|
||||
if (metrics.getPrometheus() != null) {
|
||||
metricsTimeoutMonitorMap.put(String.valueOf(job.getId()),
|
||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||
} else {
|
||||
metricsTimeoutMonitorMap.put(job.getId() + "-" + metrics.getName(),
|
||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||
}
|
||||
});
|
||||
// Avoid NullPointerException
|
||||
if (null != metricsSet){
|
||||
metricsSet.forEach(metrics -> {
|
||||
MetricsCollect metricsCollect = new MetricsCollect(metrics, timeout, this,
|
||||
collectorIdentity, unitConvertList);
|
||||
jobRequestQueue.addJob(metricsCollect);
|
||||
if (metrics.getPrometheus() != null) {
|
||||
metricsTimeoutMonitorMap.put(String.valueOf(job.getId()),
|
||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||
} else {
|
||||
metricsTimeoutMonitorMap.put(job.getId() + "-" + metrics.getName(),
|
||||
new MetricsTime(System.currentTimeMillis(), metrics, timeout));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -234,6 +237,8 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
||||
long spendTime = System.currentTimeMillis() - job.getDispatchTime();
|
||||
long interval = job.getInterval() - spendTime / 1000;
|
||||
interval = interval <= 0 ? 0 : interval;
|
||||
// Reset Construction Execution Metrics Task View
|
||||
job.constructPriorMetrics();
|
||||
timerDispatch.cyclicJob(timerJob, interval, TimeUnit.SECONDS);
|
||||
}
|
||||
} else if (!metricsSet.isEmpty()) {
|
||||
@@ -330,6 +335,8 @@ public class CommonDispatcher implements MetricsTaskDispatch, CollectDataDispatc
|
||||
long spendTime = System.currentTimeMillis() - job.getDispatchTime();
|
||||
long interval = job.getInterval() - spendTime / 1000;
|
||||
interval = interval <= 0 ? 0 : interval;
|
||||
// Reset Construction Execution Metrics Task View
|
||||
job.constructPriorMetrics();
|
||||
timerDispatch.cyclicJob(timerJob, interval, TimeUnit.SECONDS);
|
||||
}
|
||||
// it is an asynchronous periodic cyclic task, directly response the collected data
|
||||
|
||||
+3
-17
@@ -75,18 +75,6 @@ public class MetricsCollect implements Runnable, Comparable<MetricsCollect> {
|
||||
* metrics configuration
|
||||
*/
|
||||
protected Metrics metrics;
|
||||
/**
|
||||
* metadata
|
||||
*/
|
||||
protected Map<String, String> metadata;
|
||||
/**
|
||||
* labels
|
||||
*/
|
||||
protected Map<String, String> labels;
|
||||
/**
|
||||
* annotations
|
||||
*/
|
||||
protected Map<String, String> annotations;
|
||||
/**
|
||||
* time wheel timeout
|
||||
*/
|
||||
@@ -131,9 +119,6 @@ public class MetricsCollect implements Runnable, Comparable<MetricsCollect> {
|
||||
this.id = job.getMonitorId();
|
||||
this.tenantId = job.getTenantId();
|
||||
this.app = job.getApp();
|
||||
this.metadata = job.getMetadata();
|
||||
this.labels = job.getLabels();
|
||||
this.annotations = job.getAnnotations();
|
||||
this.collectDataDispatch = collectDataDispatch;
|
||||
this.isCyclic = job.isCyclic();
|
||||
this.isSd = job.isSd();
|
||||
@@ -151,8 +136,9 @@ public class MetricsCollect implements Runnable, Comparable<MetricsCollect> {
|
||||
this.startTime = System.currentTimeMillis();
|
||||
setNewThreadName(id, app, startTime, metrics);
|
||||
CollectRep.MetricsData.Builder response = CollectRep.MetricsData.newBuilder();
|
||||
response.setApp(app).setId(id).setTenantId(tenantId)
|
||||
.setLabels(labels).setAnnotations(annotations).addMetadataAll(metadata);
|
||||
response.setApp(app);
|
||||
response.setId(id);
|
||||
response.setTenantId(tenantId);
|
||||
// for prometheus auto
|
||||
if (DispatchConstants.PROTOCOL_PROMETHEUS.equalsIgnoreCase(metrics.getProtocol())) {
|
||||
List<CollectRep.MetricsData> metricsData = PrometheusAutoCollectImpl
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ spring:
|
||||
|
||||
collector:
|
||||
info:
|
||||
version: ${COLLECTOR_VERSION:1.7.0}
|
||||
version: ${COLLECTOR_VERSION:1.6.1}
|
||||
ip: ${COLLECTOR_IP:}
|
||||
dispatch:
|
||||
entrance:
|
||||
|
||||
-102
@@ -17,18 +17,13 @@
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.common.ssh;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyPair;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hertzbeat.collector.collect.common.cache.AbstractConnection;
|
||||
import org.apache.hertzbeat.collector.collect.common.cache.CacheIdentifier;
|
||||
import org.apache.hertzbeat.collector.collect.common.cache.GlobalConnectionCache;
|
||||
import org.apache.hertzbeat.collector.collect.common.cache.SshConnect;
|
||||
import org.apache.hertzbeat.collector.util.PrivateKeyUtils;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.SshProtocol;
|
||||
import org.apache.sshd.client.SshClient;
|
||||
import org.apache.sshd.client.config.hosts.HostConfigEntry;
|
||||
import org.apache.sshd.client.session.ClientSession;
|
||||
import org.apache.sshd.common.config.keys.FilePasswordProvider;
|
||||
import org.apache.sshd.common.util.security.SecurityUtils;
|
||||
@@ -106,101 +101,4 @@ public class SshHelper {
|
||||
return clientSession;
|
||||
}
|
||||
|
||||
public static ClientSession getConnectSession(SshProtocol sshProtocol, int timeout, boolean reuseConnection, boolean useProxy)
|
||||
throws IOException, GeneralSecurityException {
|
||||
CacheIdentifier identifier = CacheIdentifier.builder()
|
||||
.ip(sshProtocol.getHost()).port(sshProtocol.getPort())
|
||||
.username(sshProtocol.getUsername()).password(sshProtocol.getPassword())
|
||||
.build();
|
||||
ClientSession clientSession = null;
|
||||
// When using ProxyJump, force connection reuse:
|
||||
// Apache MINA SSHD will pass the proxy password error to the target host in proxy scenarios, causing the first connection to fail.
|
||||
// Reusing connections can skip duplicate authentication and avoid this problem.
|
||||
if (reuseConnection || useProxy) {
|
||||
Optional<AbstractConnection<?>> cacheOption = CONNECTION_COMMON_CACHE.getCache(identifier, true);
|
||||
if (cacheOption.isPresent()) {
|
||||
SshConnect sshConnect = (SshConnect) cacheOption.get();
|
||||
clientSession = sshConnect.getConnection();
|
||||
try {
|
||||
if (clientSession == null || clientSession.isClosed() || clientSession.isClosing()) {
|
||||
clientSession = null;
|
||||
CONNECTION_COMMON_CACHE.removeCache(identifier);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn(e.getMessage());
|
||||
clientSession = null;
|
||||
CONNECTION_COMMON_CACHE.removeCache(identifier);
|
||||
}
|
||||
}
|
||||
if (clientSession != null) {
|
||||
return clientSession;
|
||||
}
|
||||
}
|
||||
SshClient sshClient = CommonSshClient.getSshClient();
|
||||
HostConfigEntry proxyConfig = new HostConfigEntry();
|
||||
if (useProxy && StringUtils.hasText(sshProtocol.getProxyHost())) {
|
||||
String proxySpec = String.format("%s@%s:%d", sshProtocol.getProxyUsername(), sshProtocol.getProxyHost(), Integer.parseInt(sshProtocol.getProxyPort()));
|
||||
proxyConfig.setHostName(sshProtocol.getHost());
|
||||
proxyConfig.setHost(sshProtocol.getHost());
|
||||
proxyConfig.setPort(Integer.parseInt(sshProtocol.getPort()));
|
||||
proxyConfig.setUsername(sshProtocol.getUsername());
|
||||
proxyConfig.setProxyJump(proxySpec);
|
||||
|
||||
// Apache SSHD requires the password for the proxy to be preloaded into the sshClient instance before connecting
|
||||
if (StringUtils.hasText(sshProtocol.getProxyPassword())) {
|
||||
sshClient.addPasswordIdentity(sshProtocol.getProxyPassword());
|
||||
log.debug("Loaded proxy server password authentication: {}@{}", sshProtocol.getProxyUsername(), sshProtocol.getProxyHost());
|
||||
}
|
||||
if (StringUtils.hasText(sshProtocol.getProxyPrivateKey())) {
|
||||
proxyConfig.setIdentities(List.of(sshProtocol.getProxyPrivateKey()));
|
||||
log.debug("Proxy private key loaded into HostConfigEntry");
|
||||
}
|
||||
}
|
||||
|
||||
if (useProxy && StringUtils.hasText(sshProtocol.getProxyHost())) {
|
||||
try {
|
||||
clientSession = sshClient.connect(proxyConfig)
|
||||
.verify(timeout, TimeUnit.MILLISECONDS).getSession();
|
||||
}
|
||||
finally {
|
||||
sshClient.removePasswordIdentity(sshProtocol.getProxyPassword());
|
||||
}
|
||||
} else {
|
||||
clientSession = sshClient.connect(sshProtocol.getUsername(), sshProtocol.getHost(), Integer.parseInt(sshProtocol.getPort()))
|
||||
.verify(timeout, TimeUnit.MILLISECONDS).getSession();
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(sshProtocol.getPassword())) {
|
||||
clientSession.addPasswordIdentity(sshProtocol.getPassword());
|
||||
} else if (StringUtils.hasText(sshProtocol.getPrivateKey())) {
|
||||
var resourceKey = PrivateKeyUtils.writePrivateKey(sshProtocol.getHost(), sshProtocol.getPrivateKey());
|
||||
try (InputStream keyStream = new FileInputStream(resourceKey)) {
|
||||
FilePasswordProvider passwordProvider = (session, resource, index) -> {
|
||||
if (StringUtils.hasText(sshProtocol.getPrivateKeyPassphrase())) {
|
||||
return sshProtocol.getPrivateKeyPassphrase();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Iterable<KeyPair> keyPairs = SecurityUtils.loadKeyPairIdentities(null, () -> resourceKey, keyStream, passwordProvider);
|
||||
if (keyPairs != null) {
|
||||
keyPairs.forEach(clientSession::addPublicKeyIdentity);
|
||||
} else {
|
||||
log.error("Failed to load private key pairs from: {}", resourceKey);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Error reading private key file: {}", e.getMessage());
|
||||
}
|
||||
} // else auth with localhost private public key certificates
|
||||
|
||||
// auth
|
||||
if (!clientSession.auth().verify(timeout, TimeUnit.MILLISECONDS).isSuccess()) {
|
||||
clientSession.close();
|
||||
throw new IllegalArgumentException("ssh auth failed.");
|
||||
}
|
||||
if (reuseConnection || useProxy) {
|
||||
SshConnect sshConnect = new SshConnect(clientSession);
|
||||
CONNECTION_COMMON_CACHE.addCache(identifier, sshConnect);
|
||||
}
|
||||
return clientSession;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-7
@@ -93,14 +93,9 @@ public interface CommonConstants {
|
||||
String LABEL_ALERT_NAME = "alertname";
|
||||
|
||||
/**
|
||||
* label key: instance host
|
||||
* label key: host
|
||||
*/
|
||||
String LABEL_INSTANCE_HOST = "instancehost";
|
||||
|
||||
/**
|
||||
* label key: instance name
|
||||
*/
|
||||
String LABEL_INSTANCE_NAME = "instancename";
|
||||
String LABEL_HOST = "host";
|
||||
|
||||
/**
|
||||
* Alarm severity label key
|
||||
|
||||
+1
-5
@@ -27,16 +27,12 @@ public interface MetricDataConstants {
|
||||
String UNIT = "unit";
|
||||
|
||||
// key in Schema metadata
|
||||
String ID = "id";
|
||||
String MONITOR_ID = "id";
|
||||
String TENANT_ID = "tenantId";
|
||||
String APP = "app";
|
||||
String METRICS = "metrics";
|
||||
String LABELS = "labels";
|
||||
String ANNOTATIONS = "annotations";
|
||||
String PRIORITY = "priority";
|
||||
String TIME = "time";
|
||||
String CODE = "code";
|
||||
String MSG = "msg";
|
||||
String INSTANCE_NAME = "instancename";
|
||||
String INSTANCE_HOST = "instancehost";
|
||||
}
|
||||
|
||||
@@ -32,10 +32,4 @@ public interface SmsConstants {
|
||||
|
||||
// Smslocal SMS
|
||||
String SMSLOCAL = "smslocal";
|
||||
|
||||
// Aws cloud SMS
|
||||
String AWS = "aws";
|
||||
|
||||
// Twilio SMS
|
||||
String TWILIO = "twilio";
|
||||
}
|
||||
|
||||
-5
@@ -122,11 +122,6 @@ public class NoticeReceiver {
|
||||
example = "779294123", accessMode = READ_WRITE)
|
||||
private String tgUserId;
|
||||
|
||||
@Schema(title = "Telegram message thread id: The notification method is valid for Telegram Bot",
|
||||
description = "TTelegram message thread id: The notification method is valid for Telegram Bot",
|
||||
example = "779294123", accessMode = READ_WRITE)
|
||||
private String tgMessageThreadId;
|
||||
|
||||
@Schema(title = "DingTalk,FeiShu,WeWork user id: The notification method is valid for DingTalk,FeiShu,WeWork Bot",
|
||||
description = "DingTalk,FeiShu,WeWork user id: The notification method is valid for DingTalk,FeiShu,WeWork Bot",
|
||||
example = "779294123", accessMode = READ_WRITE)
|
||||
|
||||
@@ -61,19 +61,6 @@ public class Job {
|
||||
* Monitoring Task ID
|
||||
*/
|
||||
private long monitorId;
|
||||
/**
|
||||
* metadata info bind with this job
|
||||
* eg: instancename, instancehost
|
||||
*/
|
||||
private Map<String, String> metadata;
|
||||
/**
|
||||
* bind labels
|
||||
*/
|
||||
private Map<String, String> labels;
|
||||
/**
|
||||
* bind annotations
|
||||
*/
|
||||
private Map<String, String> annotations;
|
||||
/**
|
||||
* Is hide this app in main menus layout, only for app type, default true.
|
||||
*/
|
||||
@@ -172,36 +159,23 @@ public class Job {
|
||||
* collector use - construct to initialize metrics execution view
|
||||
*/
|
||||
public synchronized void constructPriorMetrics() {
|
||||
long now = System.currentTimeMillis();
|
||||
Map<Byte, List<Metrics>> currentCollectMetrics = metrics.stream()
|
||||
.filter(metrics -> (now >= metrics.getCollectTime() + metrics.getInterval() * 1000))
|
||||
.peek(metric -> {
|
||||
metric.setCollectTime(now);
|
||||
// Determine whether to configure aliasFields If not, configure the default
|
||||
if ((metric.getAliasFields() == null || metric.getAliasFields().isEmpty()) && metric.getFields() != null) {
|
||||
metric.setAliasFields(metric.getFields().stream().map(Metrics.Field::getField).collect(Collectors.toList()));
|
||||
}
|
||||
// Set the default metrics execution priority, if not filled, the default last priority
|
||||
if (metric.getPriority() == null) {
|
||||
metric.setPriority(Byte.MAX_VALUE);
|
||||
}
|
||||
})
|
||||
.collect(Collectors.groupingBy(Metrics::getPriority));
|
||||
// the current collect metrics can not empty, if empty, add a default availability metrics
|
||||
// due the metric collect is trigger by the previous metric collect
|
||||
if (currentCollectMetrics.isEmpty()) {
|
||||
Optional<Metrics> defaultMetricOption = metrics.stream().filter(metric -> metric.getPriority() == 0).findFirst();
|
||||
if (defaultMetricOption.isPresent()) {
|
||||
Metrics defaultMetric = defaultMetricOption.get();
|
||||
defaultMetric.setCollectTime(now);
|
||||
currentCollectMetrics.put((byte) 0, Collections.singletonList(defaultMetric));
|
||||
} else {
|
||||
log.error("metrics must has one priority 0 metrics at least.");
|
||||
}
|
||||
}
|
||||
Map<Byte, List<Metrics>> map = metrics.stream()
|
||||
.filter(metrics -> (System.currentTimeMillis() >= metrics.getCollectTime() + metrics.getInterval() * 1000))
|
||||
.peek(metric -> {
|
||||
metric.setCollectTime(System.currentTimeMillis());
|
||||
// Determine whether to configure aliasFields If not, configure the default
|
||||
if ((metric.getAliasFields() == null || metric.getAliasFields().isEmpty()) && metric.getFields() != null) {
|
||||
metric.setAliasFields(metric.getFields().stream().map(Metrics.Field::getField).collect(Collectors.toList()));
|
||||
}
|
||||
// Set the default metrics execution priority, if not filled, the default last priority
|
||||
if (metric.getPriority() == null) {
|
||||
metric.setPriority(Byte.MAX_VALUE);
|
||||
}
|
||||
})
|
||||
.collect(Collectors.groupingBy(Metrics::getPriority));
|
||||
// Construct a linked list of task execution order of the metrics
|
||||
priorMetrics = new LinkedList<>();
|
||||
currentCollectMetrics.values().forEach(metric -> {
|
||||
map.values().forEach(metric -> {
|
||||
Set<Metrics> metricsSet = Collections.synchronizedSet(new HashSet<>(metric));
|
||||
priorMetrics.add(metricsSet);
|
||||
});
|
||||
@@ -286,7 +260,7 @@ public class Job {
|
||||
public void initIntervals() {
|
||||
List<Long> metricsIntervals = new LinkedList<>();
|
||||
for (Metrics metrics: getMetrics()) {
|
||||
metrics.setCollectTime(0L);
|
||||
metrics.setCollectTime(System.currentTimeMillis());
|
||||
if (metrics.getInterval() <= 0) {
|
||||
metrics.setInterval(defaultInterval);
|
||||
}
|
||||
@@ -313,10 +287,10 @@ public class Job {
|
||||
* The least common multiple
|
||||
*/
|
||||
public static long lcm(List<Long> array) {
|
||||
if (array != null && !array.isEmpty()) {
|
||||
if (array != null) {
|
||||
long result = array.get(0);
|
||||
for (int i = 1; i < array.size(); i++) {
|
||||
result = result / gcd(result, array.get(i)) * array.get(i);
|
||||
result = (result * array.get(i)) / gcd(result, array.get(i));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
-6
@@ -95,12 +95,6 @@ public class HttpProtocol implements CommonRequestProtocol, Protocol {
|
||||
*/
|
||||
private List<String> successCodes;
|
||||
|
||||
/**
|
||||
* Whether to enable URL encoding for the path. Default is true.
|
||||
* When true, the URL path will be encoded. When false, the URL path will not be encoded.
|
||||
*/
|
||||
private String enableUrlEncoding = "true";
|
||||
|
||||
/**
|
||||
* authentication information
|
||||
*/
|
||||
|
||||
-30
@@ -80,34 +80,4 @@ public class SshProtocol implements CommonRequestProtocol, Protocol {
|
||||
* Response data parsing mode:oneRow, multiRow
|
||||
*/
|
||||
private String parseType;
|
||||
|
||||
/**
|
||||
* IP ADDRESS OR DOMAIN NAME OF THE PEER PROXY HOST
|
||||
*/
|
||||
private String proxyHost;
|
||||
|
||||
/**
|
||||
* Peer proxy host port
|
||||
*/
|
||||
private String proxyPort;
|
||||
|
||||
/**
|
||||
* Proxy UserName
|
||||
*/
|
||||
private String proxyUsername;
|
||||
|
||||
/**
|
||||
* Proxy Password (optional)
|
||||
*/
|
||||
private String proxyPassword;
|
||||
|
||||
/**
|
||||
* flag of use proxy
|
||||
*/
|
||||
private String useProxy = "false";
|
||||
|
||||
/**
|
||||
* Proxy private key (optional)
|
||||
*/
|
||||
private String proxyPrivateKey;
|
||||
}
|
||||
|
||||
+61
-130
@@ -43,7 +43,6 @@ import org.apache.arrow.vector.types.pojo.FieldType;
|
||||
import org.apache.arrow.vector.types.pojo.Schema;
|
||||
import org.apache.hertzbeat.common.constants.MetricDataConstants;
|
||||
import org.apache.hertzbeat.common.entity.arrow.RowWrapper;
|
||||
import org.apache.hertzbeat.common.util.JsonUtil;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Slf4j
|
||||
@@ -139,7 +138,17 @@ public final class CollectRep {
|
||||
|
||||
public static Builder newBuilder(MetricsData metricsData) {
|
||||
Builder builder = new Builder();
|
||||
builder.addMetadataAll(metricsData.getMetadata());
|
||||
// get metadata from metricsData
|
||||
Map<String, String> metadata = metricsData.getMetadata();
|
||||
builder.setId(Long.parseLong(metadata.getOrDefault(MetricDataConstants.MONITOR_ID, "0")))
|
||||
.setTenantId(Long.parseLong(metadata.getOrDefault(MetricDataConstants.TENANT_ID, "0")))
|
||||
.setApp(metadata.getOrDefault(MetricDataConstants.APP, ""))
|
||||
.setMetrics(metadata.getOrDefault(MetricDataConstants.METRICS, ""))
|
||||
.setPriority(Integer.parseInt(metadata.getOrDefault(MetricDataConstants.PRIORITY, "0")))
|
||||
.setTime(Long.parseLong(metadata.getOrDefault(MetricDataConstants.TIME, "0")))
|
||||
.setCode(Code.forNumber(Integer.parseInt(metadata.getOrDefault(MetricDataConstants.CODE, "0"))))
|
||||
.setMsg(metadata.getOrDefault(MetricDataConstants.MSG, ""));
|
||||
|
||||
metricsData.getFields().forEach(builder::addField);
|
||||
metricsData.getValues().forEach(builder::addValueRow);
|
||||
return builder;
|
||||
@@ -182,70 +191,42 @@ public final class CollectRep {
|
||||
|
||||
public long getId() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return Long.parseLong(metadata.getOrDefault(MetricDataConstants.ID, "0"));
|
||||
return Long.parseLong(metadata.getOrDefault("id", "0"));
|
||||
}
|
||||
|
||||
public long getTenantId() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return Long.parseLong(metadata.getOrDefault(MetricDataConstants.TENANT_ID, "0"));
|
||||
return Long.parseLong(metadata.getOrDefault("tenantId", "0"));
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return metadata.getOrDefault(MetricDataConstants.APP, "");
|
||||
return metadata.getOrDefault("app", "");
|
||||
}
|
||||
|
||||
public String getMetrics() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return metadata.getOrDefault(MetricDataConstants.METRICS, "");
|
||||
return metadata.getOrDefault("metrics", "");
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return Integer.parseInt(metadata.getOrDefault(MetricDataConstants.PRIORITY, "0"));
|
||||
return Integer.parseInt(metadata.getOrDefault("priority", "0"));
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return Long.parseLong(metadata.getOrDefault(MetricDataConstants.TIME, "0"));
|
||||
return Long.parseLong(metadata.getOrDefault("time", "0"));
|
||||
}
|
||||
|
||||
public Code getCode() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return Code.forNumber(Integer.parseInt(metadata.getOrDefault(MetricDataConstants.CODE, "0")));
|
||||
return Code.forNumber(Integer.parseInt(metadata.getOrDefault("code", "0")));
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return metadata.getOrDefault(MetricDataConstants.MSG, "");
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return metadata.getOrDefault(MetricDataConstants.INSTANCE_NAME, null);
|
||||
}
|
||||
|
||||
public String getInstanceHost() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
return metadata.getOrDefault(MetricDataConstants.INSTANCE_HOST, null);
|
||||
}
|
||||
|
||||
public Map<String, String> getLabels() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
String labelStr = metadata.getOrDefault(MetricDataConstants.LABELS, "");
|
||||
if (labelStr == null || "".equals(labelStr)) {
|
||||
return null;
|
||||
}
|
||||
return JsonUtil.fromJson(labelStr, Map.class);
|
||||
}
|
||||
|
||||
public Map<String, String> getAnnotations() {
|
||||
Map<String, String> metadata = getMetadata();
|
||||
String annotationStr = metadata.getOrDefault(MetricDataConstants.ANNOTATIONS, "");
|
||||
if (annotationStr == null || "".equals(annotationStr)) {
|
||||
return null;
|
||||
}
|
||||
return JsonUtil.fromJson(annotationStr, Map.class);
|
||||
return metadata.getOrDefault("msg", "");
|
||||
}
|
||||
|
||||
private Map<String, String> getMetadata() {
|
||||
@@ -317,82 +298,54 @@ public final class CollectRep {
|
||||
|
||||
// Builder remains mostly the same, but build() method changes
|
||||
public static class Builder {
|
||||
|
||||
private Map<String, String> metadata = new HashMap<>();
|
||||
private long id;
|
||||
private long tenantId;
|
||||
private String app = "";
|
||||
private String metrics = "";
|
||||
private int priority;
|
||||
private long time;
|
||||
private Code code = Code.SUCCESS;
|
||||
private String msg = "";
|
||||
private List<Field> fields = new ArrayList<>();
|
||||
private List<ValueRow> values = new ArrayList<>();
|
||||
|
||||
public Builder setId(long id) {
|
||||
metadata.put(MetricDataConstants.ID, String.valueOf(id));
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTenantId(long tenantId) {
|
||||
metadata.put(MetricDataConstants.TENANT_ID, String.valueOf(tenantId));
|
||||
this.tenantId = tenantId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setApp(String app) {
|
||||
metadata.put(MetricDataConstants.APP, app != null ? app : "");
|
||||
this.app = app;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMetrics(String metrics) {
|
||||
metadata.put(MetricDataConstants.METRICS, metrics != null ? metrics : "");
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setLabels(Map<String, String> labels) {
|
||||
if (labels == null || labels.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
String labelStr = JsonUtil.toJson(labels);
|
||||
metadata.put(MetricDataConstants.LABELS, labelStr);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAnnotations(Map<String, String> annotations) {
|
||||
if (annotations == null || annotations.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
String annotationStr = JsonUtil.toJson(annotations);
|
||||
metadata.put(MetricDataConstants.ANNOTATIONS, annotationStr);
|
||||
this.metrics = metrics;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPriority(int priority) {
|
||||
metadata.put(MetricDataConstants.PRIORITY, String.valueOf(priority));
|
||||
this.priority = priority;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTime(long time) {
|
||||
metadata.put(MetricDataConstants.TIME, String.valueOf(time));
|
||||
this.time = time;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCode(Code code) {
|
||||
metadata.put(MetricDataConstants.CODE, String.valueOf(code != null ? code.value : 0));
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMsg(String msg) {
|
||||
metadata.put(MetricDataConstants.MSG, msg != null ? msg : "");
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addMetadata(String key, String value) {
|
||||
if (key == null || "".equals(key)) {
|
||||
return this;
|
||||
}
|
||||
metadata.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addMetadataAll(Map<String, String> meta) {
|
||||
if (meta == null || meta.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
this.metadata.putAll(meta);
|
||||
this.msg = msg;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -407,6 +360,17 @@ public final class CollectRep {
|
||||
}
|
||||
|
||||
public MetricsData build() {
|
||||
// Create metadata
|
||||
Map<String, String> metadata = new HashMap<>();
|
||||
metadata.put(MetricDataConstants.MONITOR_ID, String.valueOf(id));
|
||||
metadata.put(MetricDataConstants.TENANT_ID, String.valueOf(tenantId));
|
||||
metadata.put(MetricDataConstants.APP, app != null ? app : "");
|
||||
metadata.put(MetricDataConstants.METRICS, metrics != null ? metrics : "");
|
||||
metadata.put(MetricDataConstants.PRIORITY, String.valueOf(priority));
|
||||
metadata.put(MetricDataConstants.TIME, String.valueOf(time));
|
||||
metadata.put(MetricDataConstants.CODE, String.valueOf(code != null ? code.value : 0));
|
||||
metadata.put(MetricDataConstants.MSG, msg != null ? msg : "");
|
||||
|
||||
BufferAllocator allocator = new RootAllocator();
|
||||
try {
|
||||
// Create Arrow fields with metadata
|
||||
@@ -443,17 +407,7 @@ public final class CollectRep {
|
||||
fieldIndex < row.getColumnsList().size()) {
|
||||
String value = row.getColumns(fieldIndex);
|
||||
if (value != null) {
|
||||
// Check byte array size, Arrow buffer size is 32768 bytes
|
||||
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
|
||||
if (bytes.length > 32700) {
|
||||
log.warn("Value too large for Arrow buffer ({}), truncating to 32700 bytes. Meta: {}",
|
||||
bytes.length, JsonUtil.toJson(metadata));
|
||||
byte[] truncatedBytes = new byte[32700];
|
||||
System.arraycopy(bytes, 0, truncatedBytes, 0, 32700);
|
||||
vector.set(rowIndex, truncatedBytes);
|
||||
} else {
|
||||
vector.set(rowIndex, bytes);
|
||||
}
|
||||
vector.set(rowIndex, value.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -471,65 +425,38 @@ public final class CollectRep {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add getter methods
|
||||
public long getId() {
|
||||
return Long.parseLong(metadata.getOrDefault(MetricDataConstants.ID, "0"));
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getTenantId() {
|
||||
return Long.parseLong(metadata.getOrDefault(MetricDataConstants.TENANT_ID, "0"));
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
return metadata.getOrDefault(MetricDataConstants.APP, "");
|
||||
return app;
|
||||
}
|
||||
|
||||
public String getMetrics() {
|
||||
return metadata.getOrDefault(MetricDataConstants.METRICS, "");
|
||||
return metrics;
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
return Integer.parseInt(metadata.getOrDefault(MetricDataConstants.PRIORITY, "0"));
|
||||
return priority;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return Integer.parseInt(metadata.getOrDefault(MetricDataConstants.TIME, "0"));
|
||||
return time;
|
||||
}
|
||||
|
||||
public Code getCode() {
|
||||
return Code.forNumber(Integer.parseInt(metadata.getOrDefault(MetricDataConstants.CODE, "0")));
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return metadata.getOrDefault(MetricDataConstants.MSG, "");
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
return metadata.getOrDefault(MetricDataConstants.INSTANCE_NAME, null);
|
||||
}
|
||||
|
||||
public String getInstanceHost() {
|
||||
return metadata.getOrDefault(MetricDataConstants.INSTANCE_HOST, null);
|
||||
}
|
||||
|
||||
public Map<String, String> getLabels() {
|
||||
String labelStr = metadata.getOrDefault(MetricDataConstants.LABELS, "");
|
||||
if (labelStr == null || "".equals(labelStr)) {
|
||||
return null;
|
||||
}
|
||||
return JsonUtil.fromJson(labelStr, Map.class);
|
||||
}
|
||||
|
||||
public Map<String, String> getAnnotations() {
|
||||
String annotationStr = metadata.getOrDefault(MetricDataConstants.ANNOTATIONS, "");
|
||||
if (annotationStr == null || "".equals(annotationStr)) {
|
||||
return null;
|
||||
}
|
||||
return JsonUtil.fromJson(annotationStr, Map.class);
|
||||
}
|
||||
|
||||
public Map<String, String> getMetadata() {
|
||||
return metadata;
|
||||
return msg;
|
||||
}
|
||||
|
||||
public List<Field> getFieldsList() {
|
||||
@@ -564,6 +491,10 @@ public final class CollectRep {
|
||||
values = new LinkedList<>();
|
||||
}
|
||||
|
||||
public void clearMetrics() {
|
||||
metrics = null;
|
||||
}
|
||||
|
||||
public void clearFields() {
|
||||
fields = new LinkedList<>();
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public abstract class AbstractCollectE2eTest {
|
||||
metricsCollect = new MetricsCollect(mock(Metrics.class), timeout, mock(CollectDataDispatch.class), null, List.of());
|
||||
|
||||
// Initialize services and components
|
||||
appService.afterPropertiesSet();
|
||||
appService.run();
|
||||
metrics = new Metrics();
|
||||
}
|
||||
|
||||
|
||||
+9
-15
@@ -15,32 +15,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.config;
|
||||
package org.apache.hertzbeat.manager.pojo.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* AWS Cloud SMS configuration properties
|
||||
* Alibaba Sms Sender configuration dto
|
||||
*/
|
||||
@Data
|
||||
public class AwsSmsProperties {
|
||||
/**
|
||||
* AWS Cloud access key id
|
||||
*/
|
||||
public class SmsAlibabaConfig {
|
||||
|
||||
@NotBlank(message = "AccessKeyId cannot be empty")
|
||||
private String accessKeyId;
|
||||
|
||||
/**
|
||||
* AWS Cloud access key secret
|
||||
*/
|
||||
|
||||
@NotBlank(message = "AccessKeySecret cannot be empty")
|
||||
private String accessKeySecret;
|
||||
|
||||
/**
|
||||
* AWS Cloud region
|
||||
*/
|
||||
@NotBlank(message = "region cannot be empty")
|
||||
private String region;
|
||||
@NotBlank(message = "SignName cannot be empty")
|
||||
private String signName;
|
||||
|
||||
@NotBlank(message = "TemplateCode cannot be null")
|
||||
private String templateCode;
|
||||
}
|
||||
+16
-20
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.config;
|
||||
package org.apache.hertzbeat.manager.pojo.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -23,27 +23,23 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Twilio SMS configuration properties
|
||||
* Sms Sender configuration dto
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TwilioSmsProperties {
|
||||
/**
|
||||
* Twilio Account SID
|
||||
*/
|
||||
@NotBlank(message = "Account SID cannot be empty")
|
||||
private String accountSid;
|
||||
@AllArgsConstructor
|
||||
public class SmsNoticeSender {
|
||||
|
||||
@NotBlank(message = "Type cannot be empty")
|
||||
private String type;
|
||||
|
||||
private SmsTencentConfig tencent;
|
||||
|
||||
private SmsAlibabaConfig alibaba;
|
||||
|
||||
/**
|
||||
* Twilio Auth Token
|
||||
*/
|
||||
@NotBlank(message = "Auth Token cannot be empty")
|
||||
private String authToken;
|
||||
private SmsUniSmsConfig unisms;
|
||||
|
||||
/**
|
||||
* Twilio Issued Phone Number
|
||||
*/
|
||||
@NotBlank(message = "Twilio Phone Number cannot be empty")
|
||||
private String twilioPhoneNumber;
|
||||
}
|
||||
private SmslocalConfig smslocal;
|
||||
|
||||
private boolean enable = true;
|
||||
}
|
||||
+16
-34
@@ -15,52 +15,34 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.alert.dto;
|
||||
package org.apache.hertzbeat.manager.pojo.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* SkyWalking Alert Content Entity
|
||||
* @see <a href="https://skywalking.apache.org/docs/main/latest/en/setup/backend/backend-alarm/">backend-alarm</a>
|
||||
* Tencent Sms Sender configuration dto
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SkyWalkingExternAlert {
|
||||
@AllArgsConstructor
|
||||
public class SmsTencentConfig {
|
||||
|
||||
@NotBlank(message = "SecretId cannot be empty")
|
||||
private String secretId;
|
||||
|
||||
private Long scopeId;
|
||||
@NotBlank(message = "SecretKey cannot be empty")
|
||||
private String secretKey;
|
||||
|
||||
private String scope;
|
||||
@NotBlank(message = "SignName cannot be empty")
|
||||
private String signName;
|
||||
|
||||
private String name;
|
||||
@NotBlank(message = "AppId cannot be null")
|
||||
private String appId;
|
||||
|
||||
private String id0;
|
||||
@NotBlank(message = "templateId cannot be null")
|
||||
private String templateId;
|
||||
|
||||
private String id1;
|
||||
|
||||
private String ruleName;
|
||||
|
||||
private String alarmMessage;
|
||||
|
||||
private Long startTime;
|
||||
|
||||
private List<Tag> tags;
|
||||
|
||||
/**
|
||||
* SkyWalking Tag Entity
|
||||
*/
|
||||
@Data
|
||||
public static class Tag {
|
||||
|
||||
private String key;
|
||||
|
||||
private String value;
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.manager.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* UniSMS configuration
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SmsUniSmsConfig {
|
||||
/**
|
||||
* UniSMS access key id
|
||||
*/
|
||||
@NotBlank(message = "accessKeyId cannot be empty")
|
||||
private String accessKeyId;
|
||||
|
||||
/**
|
||||
* UniSMS access key secret, required for HMAC mode
|
||||
*/
|
||||
private String accessKeySecret;
|
||||
|
||||
/**
|
||||
* SMS signature
|
||||
*/
|
||||
@NotBlank(message = "signature cannot be null")
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* SMS template ID
|
||||
*/
|
||||
@NotBlank(message = "templateId cannot be null")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* Authentication mode: simple or hmac, default is simple
|
||||
*/
|
||||
@NotBlank(message = "authMode cannot be null")
|
||||
private String authMode = "simple";
|
||||
}
|
||||
+18
-4
@@ -17,8 +17,22 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export class AwsSmsConfig {
|
||||
accessKeyId!: string;
|
||||
accessKeySecret!: string;
|
||||
region!: string;
|
||||
package org.apache.hertzbeat.manager.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* Smslocal SMS configuration
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SmslocalConfig {
|
||||
/**
|
||||
* Smslocal api key
|
||||
*/
|
||||
private String apiKey;
|
||||
}
|
||||
+1
-5
@@ -120,11 +120,7 @@ public class SchedulerInit implements CommandLineRunner {
|
||||
appDefine.setDefaultInterval(monitor.getIntervals());
|
||||
appDefine.setCyclic(true);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, monitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, monitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(monitor.getLabels());
|
||||
appDefine.setAnnotations(monitor.getAnnotations());
|
||||
|
||||
List<Configmap> configmaps = params.stream()
|
||||
.map(param -> new Configmap(param.getField(), param.getParamValue(),
|
||||
param.getType())).collect(Collectors.toList());
|
||||
|
||||
+4
-5
@@ -63,7 +63,7 @@ import org.apache.hertzbeat.manager.service.AppService;
|
||||
import org.apache.hertzbeat.manager.service.MonitorService;
|
||||
import org.apache.hertzbeat.manager.service.ObjectStoreService;
|
||||
import org.apache.hertzbeat.warehouse.service.WarehouseService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
@@ -75,13 +75,12 @@ import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
/**
|
||||
* Monitoring Type Management Implementation
|
||||
* Temporarily stores the monitoring configuration and parameter configuration in memory,
|
||||
* and then persists it to a storage system.
|
||||
* temporarily stores the monitoring configuration and parameter configuration in memory and then stores it in the
|
||||
*/
|
||||
@Service
|
||||
@Order(value = Ordered.HIGHEST_PRECEDENCE)
|
||||
@Slf4j
|
||||
public class AppServiceImpl implements AppService, InitializingBean {
|
||||
public class AppServiceImpl implements AppService, CommandLineRunner {
|
||||
|
||||
private static final String PUSH_PROTOCOL_METRICS_NAME = "metrics";
|
||||
|
||||
@@ -501,7 +500,7 @@ public class AppServiceImpl implements AppService, InitializingBean {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void run(String... args) throws Exception {
|
||||
var objectStoreConfig = objectStoreConfigService.getConfig();
|
||||
refreshStore(objectStoreConfig);
|
||||
}
|
||||
|
||||
+11
-35
@@ -42,6 +42,7 @@ import org.apache.hertzbeat.common.entity.manager.MonitorBind;
|
||||
import org.apache.hertzbeat.common.entity.manager.Param;
|
||||
import org.apache.hertzbeat.common.entity.manager.ParamDefine;
|
||||
import org.apache.hertzbeat.common.entity.manager.SdMonitorParam;
|
||||
import org.apache.hertzbeat.common.entity.manager.Tag;
|
||||
import org.apache.hertzbeat.common.entity.message.CollectRep;
|
||||
import org.apache.hertzbeat.common.entity.sd.ServiceDiscoveryProtocol;
|
||||
import org.apache.hertzbeat.common.support.event.MonitorDeletedEvent;
|
||||
@@ -90,6 +91,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -431,11 +433,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setDefaultInterval(monitor.getIntervals());
|
||||
appDefine.setCyclic(true);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, monitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, monitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(monitor.getLabels());
|
||||
appDefine.setAnnotations(monitor.getAnnotations());
|
||||
List<Configmap> configmaps = params.stream().map(param ->
|
||||
new Configmap(param.getField(), param.getParamValue(), param.getType())).collect(Collectors.toList());
|
||||
appDefine.setConfigmap(configmaps);
|
||||
@@ -683,11 +680,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setDefaultInterval(monitor.getIntervals());
|
||||
appDefine.setCyclic(true);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, monitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, monitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(monitor.getLabels());
|
||||
appDefine.setAnnotations(monitor.getAnnotations());
|
||||
List<Configmap> configmaps = params.stream().map(param ->
|
||||
new Configmap(param.getField(), param.getParamValue(), param.getType())).collect(Collectors.toList());
|
||||
List<ParamDefine> paramDefaultValue = appDefine.getParams().stream()
|
||||
@@ -798,11 +790,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setDefaultInterval(monitor.getIntervals());
|
||||
appDefine.setCyclic(true);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, monitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, monitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(monitor.getLabels());
|
||||
appDefine.setAnnotations(monitor.getAnnotations());
|
||||
List<Param> params = paramDao.findParamsByMonitorId(monitor.getId());
|
||||
List<Configmap> configmaps = params.stream().map(param -> new Configmap(param.getField(),
|
||||
param.getParamValue(), param.getType())).collect(Collectors.toList());
|
||||
@@ -854,11 +841,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setDefaultInterval(monitor.getIntervals());
|
||||
appDefine.setCyclic(true);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, monitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, monitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(monitor.getLabels());
|
||||
appDefine.setAnnotations(monitor.getAnnotations());
|
||||
resetMetricsCommonField(monitor, appDefine, sdMonitorParam);
|
||||
|
||||
List<Configmap> configmaps = params.stream().map(param -> {
|
||||
@@ -969,11 +951,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setMonitorId(monitorId);
|
||||
appDefine.setCyclic(false);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, monitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, monitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(monitor.getLabels());
|
||||
appDefine.setAnnotations(monitor.getAnnotations());
|
||||
final Job sdJob = SdMonitorOperator.constructSdJob(appDefine, sdParam);
|
||||
List<CollectRep.MetricsData> collectRep;
|
||||
if (collector != null) {
|
||||
@@ -1007,11 +984,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setMonitorId(monitorId);
|
||||
appDefine.setCyclic(false);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, monitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, monitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(monitor.getLabels());
|
||||
appDefine.setAnnotations(monitor.getAnnotations());
|
||||
List<Configmap> configmaps = params.stream().map(param ->
|
||||
new Configmap(param.getField(), param.getParamValue(), param.getType())).collect(Collectors.toList());
|
||||
appDefine.setConfigmap(configmaps);
|
||||
@@ -1039,6 +1011,15 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
collectRep.forEach(CollectRep.MetricsData::close);
|
||||
}
|
||||
|
||||
private List<Tag> filterTags(List<Tag> tags) {
|
||||
if (tags == null || tags.isEmpty()) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
return tags.stream()
|
||||
.filter(tag -> !(tag.getName().equals(CommonConstants.TAG_MONITOR_ID) || tag.getName().equals(CommonConstants.TAG_MONITOR_NAME)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void copyMonitor(Long id) {
|
||||
@@ -1096,11 +1077,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
appDefine.setDefaultInterval(newMonitor.getIntervals());
|
||||
appDefine.setCyclic(true);
|
||||
appDefine.setTimestamp(System.currentTimeMillis());
|
||||
Map<String, String> metadata = Map.of(CommonConstants.LABEL_INSTANCE_NAME, newMonitor.getName(),
|
||||
CommonConstants.LABEL_INSTANCE_HOST, newMonitor.getHost());
|
||||
appDefine.setMetadata(metadata);
|
||||
appDefine.setLabels(newMonitor.getLabels());
|
||||
appDefine.setAnnotations(newMonitor.getAnnotations());
|
||||
List<Configmap> configmaps = sourceParams.stream()
|
||||
.map(param -> new Configmap(param.getField(), param.getParamValue(), param.getType()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
+5
-16
@@ -285,8 +285,11 @@ public class PluginServiceImpl implements PluginService {
|
||||
String jarPath = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
|
||||
Path extLibPath = Paths.get(new File(jarPath).getParent(), "plugin-lib");
|
||||
File extLibDir = extLibPath.toFile();
|
||||
|
||||
String fileName = pluginUpload.getJarFile().getOriginalFilename();
|
||||
validateFileName(fileName);
|
||||
if (fileName == null) {
|
||||
throw new CommonException("Failed to upload plugin");
|
||||
}
|
||||
fileName = UUID.randomUUID().toString().replace("-", "") + "_" + fileName;
|
||||
File destFile = new File(extLibDir, fileName);
|
||||
FileUtils.createParentDirectories(destFile);
|
||||
@@ -318,20 +321,6 @@ public class PluginServiceImpl implements PluginService {
|
||||
syncPluginStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* validate file name if file name is invalid, throw exception
|
||||
*
|
||||
* @param fileName file name
|
||||
*/
|
||||
private void validateFileName(String fileName) {
|
||||
if (fileName == null) {
|
||||
throw new CommonException("Failed to upload plugin");
|
||||
}
|
||||
if (fileName.matches(".*(\\.\\.|[\n\t\r/\\\\]).*")) {
|
||||
throw new CommonException("Invalid plugin file name: " + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pluginIsEnable(Class<?> clazz) {
|
||||
return Boolean.TRUE.equals(PLUGIN_ENABLE_STATUS.get(clazz.getName()));
|
||||
@@ -380,7 +369,7 @@ public class PluginServiceImpl implements PluginService {
|
||||
}
|
||||
|
||||
private void syncSinglePluginStatus(PluginMetadata plugin) {
|
||||
if (plugin == null || CollectionUtils.isEmpty(plugin.getItems())) {
|
||||
if (plugin == null || CollectionUtils.isEmpty(plugin.getItems())){
|
||||
return;
|
||||
}
|
||||
for (PluginItem item : plugin.getItems()) {
|
||||
|
||||
+5
-5
@@ -22,10 +22,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.hertzbeat.alert.config.SmsConfig;
|
||||
import org.apache.hertzbeat.common.constants.GeneralConfigTypeEnum;
|
||||
import org.apache.hertzbeat.base.dao.GeneralConfigDao;
|
||||
import org.apache.hertzbeat.common.support.event.SmsConfigChangeEvent;
|
||||
import org.apache.hertzbeat.manager.pojo.dto.SmsNoticeSender;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class SmsGeneralConfigServiceImpl extends AbstractGeneralConfigServiceImpl<SmsConfig> {
|
||||
public class SmsGeneralConfigServiceImpl extends AbstractGeneralConfigServiceImpl<SmsNoticeSender> {
|
||||
@Resource
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SmsGeneralConfigServiceImpl extends AbstractGeneralConfigServiceImp
|
||||
* This method is used to handle the sms configuration change event.
|
||||
*/
|
||||
@Override
|
||||
public void handler(SmsConfig smsConfig) {
|
||||
public void handler(SmsNoticeSender smsNoticeSender) {
|
||||
applicationContext.publishEvent(new SmsConfigChangeEvent(applicationContext));
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ public class SmsGeneralConfigServiceImpl extends AbstractGeneralConfigServiceImp
|
||||
* a TypeReference of NoticeSender type
|
||||
*/
|
||||
@Override
|
||||
public TypeReference<SmsConfig> getTypeReference() {
|
||||
public TypeReference<SmsNoticeSender> getTypeReference() {
|
||||
return new TypeReference<>() {
|
||||
@Override
|
||||
public Type getType() {
|
||||
return SmsConfig.class;
|
||||
return SmsNoticeSender.class;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -72,22 +72,14 @@ warehouse:
|
||||
rpc-port: 6667
|
||||
username: root
|
||||
password: root
|
||||
# store real-time metrics data, enable only one below
|
||||
real-time:
|
||||
redis:
|
||||
enabled: false
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: 123456
|
||||
memory:
|
||||
enabled: true
|
||||
init-size: 16
|
||||
redis:
|
||||
enabled: false
|
||||
# redis mode: single, sentinel, cluster. Default is single
|
||||
mode: single
|
||||
# separate each address with comma when using cluster mode, eg: 127.0.0.1:6379,127.0.0.1:6380
|
||||
address: 127.0.0.1:6379
|
||||
# enter master name when using sentinel mode
|
||||
masterName: mymaster
|
||||
password: 123456
|
||||
# redis db index, default: DB0
|
||||
db: 0
|
||||
|
||||
scheduler:
|
||||
server:
|
||||
@@ -110,4 +102,4 @@ ai:
|
||||
# api key
|
||||
api-key:
|
||||
#At present, only IFLYTEK large model needs to be filled in
|
||||
api-secret:
|
||||
api-secret:
|
||||
@@ -227,14 +227,7 @@ alerter:
|
||||
template-id: YOUR_TEMPLATE_ID
|
||||
smslocal:
|
||||
api-key: YOUR_API_KEY_HERE
|
||||
aws:
|
||||
access-key-id: YOUR_ACCESS_KEY_ID
|
||||
access-key-secret: YOUR_ACCESS_KEY_SECRET
|
||||
region: AWS_REGION_FOR_END_USER_MESSAGING
|
||||
twilio:
|
||||
account-sid: YOUR_ACCOUNT_SID
|
||||
auth-token: YOUR_AUTH_TOKEN
|
||||
twilio-phone-number: YOUR_TWILIO_PHONE_NUMBER
|
||||
|
||||
scheduler:
|
||||
server:
|
||||
enabled: true
|
||||
@@ -256,4 +249,4 @@ ai:
|
||||
# api key
|
||||
api-key:
|
||||
#At present, only IFLYTEK large model needs to be filled in
|
||||
api-secret:
|
||||
api-secret:
|
||||
|
||||
@@ -17,44 +17,71 @@
|
||||
|
||||
-- ensure every sql can rerun without error
|
||||
|
||||
-- add repair table sql
|
||||
REPAIR TABLE HZB_ALERT_DEFINE;
|
||||
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE AddOrDropColumns()
|
||||
BEGIN
|
||||
DECLARE col_exists INT;
|
||||
|
||||
-- Check and add 'app' column if it does not exist
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='app';
|
||||
IF col_exists = 0 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE ADD COLUMN app VARCHAR(255);
|
||||
END IF;
|
||||
-- Drop 'app' column if it exists
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='app';
|
||||
IF col_exists = 1 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE DROP COLUMN app;
|
||||
END IF;
|
||||
|
||||
-- Check and add 'metric' column if it does not exist
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='metric';
|
||||
IF col_exists = 0 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE ADD COLUMN metric VARCHAR(255);
|
||||
END IF;
|
||||
-- Drop 'metric' column if it exists
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='metric';
|
||||
IF col_exists = 1 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE DROP COLUMN metric;
|
||||
END IF;
|
||||
|
||||
-- Check and add 'field' column if it does not exist
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='field';
|
||||
IF col_exists = 0 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE ADD COLUMN field VARCHAR(255);
|
||||
END IF;
|
||||
-- Drop 'field' column if it exists
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='field';
|
||||
IF col_exists = 1 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE DROP COLUMN field;
|
||||
END IF;
|
||||
|
||||
-- Check and add 'preset' column if it does not exist
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='preset';
|
||||
IF col_exists = 0 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE ADD COLUMN preset BOOLEAN;
|
||||
END IF;
|
||||
-- Drop 'preset' column if it exists
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='preset';
|
||||
IF col_exists = 1 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE DROP COLUMN preset;
|
||||
END IF;
|
||||
|
||||
-- Check and add 'priority' column if it does not exist
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='priority';
|
||||
IF col_exists = 0 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE ADD COLUMN priority INTEGER;
|
||||
END IF;
|
||||
-- Drop 'priority' column if it exists
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='priority';
|
||||
IF col_exists = 1 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE DROP COLUMN priority;
|
||||
END IF;
|
||||
|
||||
-- Check and add 'tags' column if it does not exist
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='tags';
|
||||
IF col_exists = 0 THEN
|
||||
ALTER TABLE HZB_ALERT_DEFINE ADD COLUMN tags VARCHAR(255);
|
||||
END IF;
|
||||
-- Drop 'tags' column if it exists
|
||||
SELECT COUNT(*) INTO col_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='HZB_ALERT_DEFINE' AND COLUMN_NAME='tags';
|
||||
IF col_exists = 1 THEN
|
||||
@@ -66,5 +93,4 @@ DELIMITER ;
|
||||
|
||||
|
||||
CALL AddOrDropColumns();
|
||||
DROP PROCEDURE IF EXISTS AddOrDropColumns;
|
||||
commit;
|
||||
DROP PROCEDURE IF EXISTS AddOrDropColumns;
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -251,18 +174,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -332,18 +243,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -412,18 +311,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -469,18 +356,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -521,18 +396,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -581,18 +444,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -635,18 +486,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -689,17 +528,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -246,20 +246,6 @@ params:
|
||||
defaultValue: '200, 201'
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: enableUrlEncoding
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 启用URL编码(UTF-8)
|
||||
en-US: Enable URL Encoding(UTF-8)
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
# default value
|
||||
defaultValue: true
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - summary
|
||||
@@ -300,8 +286,6 @@ metrics:
|
||||
method: ^_^httpMethod^_^
|
||||
# if enabled https
|
||||
ssl: ^_^ssl^_^
|
||||
# enable url encoding
|
||||
enableUrlEncoding: ^_^enableUrlEncoding^_^
|
||||
# http request payload
|
||||
payload: ^_^payload^_^
|
||||
# http request header content
|
||||
@@ -360,8 +344,6 @@ metrics:
|
||||
method: GET
|
||||
# if enabled https
|
||||
ssl: ^_^ssl^_^
|
||||
# enable url encoding
|
||||
enableUrlEncoding: ^_^enableUrlEncoding^_^
|
||||
authorization:
|
||||
# http auth type: Basic Auth, Digest Auth, Bearer Token
|
||||
type: ^_^authType^_^
|
||||
|
||||
@@ -82,17 +82,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -139,72 +128,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -252,18 +175,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -333,18 +244,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -413,18 +312,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -470,18 +357,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -522,18 +397,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {gsub(":", "", $1); print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -582,18 +445,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -636,18 +487,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -690,18 +529,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -251,18 +174,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -332,18 +243,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -412,18 +311,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -469,18 +356,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -521,18 +396,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -581,18 +444,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -635,18 +486,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -689,17 +528,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -137,72 +126,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -250,18 +173,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -331,18 +242,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -411,18 +310,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -468,18 +355,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -520,18 +395,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -580,18 +443,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -634,18 +485,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps --no-headers -eo pid,%cpu,%mem,cmd --sort=-%cpu | head -n 10 | awk 'BEGIN {print "pid cpu_usage mem_usage command"} {print $1, $2, $3, $4}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -688,17 +527,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps --no-headers -eo pid,%cpu,%mem,cmd --sort=-%mem | head -n 10 | awk 'BEGIN {print "pid cpu_usage mem_usage command"} {print $1, $2, $3, $4}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -251,18 +174,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -332,18 +243,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -412,18 +311,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -469,18 +356,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -521,18 +396,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -581,18 +444,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -635,18 +486,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -689,17 +528,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -251,18 +174,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
script: uname -r ; hostname ; uptime | awk -F "," '{print $1}' | sed "s/ //g"
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -333,18 +244,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "dmesg | grep -i cpu | awk 'NR==1';sysctl hw.ncpu | awk '{print $2}';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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -410,18 +309,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: sysctl hw | egrep 'hw.(phys|user|real)' | awk '{print $2}';dmesg | grep memory | grep avail | awk '{print $4}';
|
||||
parseType: oneRow
|
||||
|
||||
@@ -470,18 +357,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -m | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -524,18 +399,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -578,17 +441,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -137,72 +126,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -250,18 +173,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -331,18 +242,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -411,18 +310,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -468,18 +355,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -520,18 +395,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -580,18 +443,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -634,18 +485,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -688,17 +527,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -82,17 +82,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -127,139 +116,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -336,18 +192,6 @@ metrics:
|
||||
privateKey: ^_^privateKey^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
script: nvidia-smi --query-gpu=index,name,utilization.gpu,utilization.memory,memory.total,memory.used,memory.free,temperature.gpu --format=csv,nounits | sed 's/ *, */,/g' | sed 's/ / /g' | sed 's/,/ /g'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -137,72 +126,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -250,18 +173,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -331,18 +242,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -411,18 +310,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -468,18 +355,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -520,18 +395,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -580,18 +443,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -m | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -634,18 +485,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -688,17 +527,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -82,17 +82,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
limit: 100
|
||||
# required-true or false
|
||||
required: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -269,18 +192,6 @@ metrics:
|
||||
privateKey: ^_^privateKey^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
script: output=$(ps -ef|grep '^_^process_name^_^'|grep -v grep); [ -n "$output" ] && ps -eo pid,user,%cpu,%mem,rss,cmd | grep -v grep | grep '^_^process_name^_^' | awk 'BEGIN {print "pid user cpu mem rss cmd"} {cmd=substr($0, index($0, $6)); gsub(/ /, " ", cmd); print $1, $2, $3, $4, $5, cmd}'
|
||||
@@ -406,18 +317,6 @@ metrics:
|
||||
privateKey: ^_^privateKey^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
script: echo -e "pid VmPeak VmSize VmLck VmPin VmHWM VmRSS VmData VmStk VmExe VmLib VmPTE VmSwap";ps -eo pid,cmd | grep -v grep | grep '^_^process_name^_^' | awk '{ cmd=substr($0, index($0, $3)); sub(/ /, " ", cmd); print $1, cmd }' | while read pid _; do echo -n "$pid ";cat /proc/$pid/status | grep Vm | awk -F ':\t' '{gsub(/^ +| +$/, "", $2); print $2}' | paste -d' ' -s - | sed 's/[[:space:]]*[kKMmGg]*B//g';done
|
||||
@@ -470,18 +369,6 @@ metrics:
|
||||
privateKey: ^_^privateKey^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
script: echo "pid path date fd_count" ; ps -eo pid,cmd | grep -v grep | grep '^_^process_name^_^' | awk '{cmd=substr($0, index($0, $3)); gsub(/ /, " ", cmd); print $1, cmd}' | while read pid _; do cwd=$(readlink -f "/proc/$pid/cwd"); start_time=$(ps -p $pid -o lstart | tail -n 1 | sed 's/ / /g'); fd_count=$(ls -l /proc/$pid/fd/ 2>/dev/null | wc -l); echo "$pid $cwd $start_time $fd_count"; done
|
||||
@@ -554,18 +441,6 @@ metrics:
|
||||
privateKey: ^_^privateKey^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
script: echo -e "pid rchar wchar syscr syscw read_bytes write_bytes cancelled_write_bytes";ps -eo pid,cmd | grep -v grep | grep '^_^process_name^_^' | awk '{ cmd=substr($0, index($0, $3)); gsub(/ /, " ", cmd); print $1, cmd }' | while read pid _; do echo -n "$pid ";cat /proc/$pid/io | awk -F ':' '{gsub(/^ +| +$/, "", $2); print $2}' | paste -d' ' -s -;done
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -251,18 +174,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -332,18 +243,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -412,18 +311,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -469,18 +356,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -521,18 +396,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -581,18 +444,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -635,18 +486,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -689,17 +528,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -251,18 +174,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -332,18 +243,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}' | awk 'NR==1';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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -412,18 +311,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -469,18 +356,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -521,18 +396,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -581,18 +444,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -m | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -635,18 +486,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -689,17 +528,5 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -81,17 +81,6 @@ params:
|
||||
required: true
|
||||
defaultValue: true
|
||||
# field-param field key
|
||||
- field: useProxy
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 使用代理
|
||||
en-US: Use Proxy Connection
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: boolean
|
||||
# required-true or false
|
||||
required: true
|
||||
defaultValue: false
|
||||
# field-param field key
|
||||
- field: username
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
@@ -138,72 +127,6 @@ params:
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyHost
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机
|
||||
en-US: Proxy Host
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
- field: proxyPort
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理端口
|
||||
en-US: Proxy Port
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: number
|
||||
# when type is number, range is required
|
||||
range: '[0,65535]'
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# default value
|
||||
defaultValue: 22
|
||||
# field-param field key
|
||||
- field: proxyUsername
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理用户名
|
||||
en-US: Proxy Username
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: text
|
||||
# when type is text, use limit to limit string length
|
||||
limit: 50
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPassword
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理密码
|
||||
en-US: Proxy Password
|
||||
# type-param field type(most mapping the html input tag)
|
||||
type: password
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# field-param field key
|
||||
- field: proxyPrivateKey
|
||||
# name-param field display i18n name
|
||||
name:
|
||||
zh-CN: 代理主机私钥
|
||||
en-US: proxyPrivateKey
|
||||
# type-param field type(most mapping the html input type)
|
||||
type: textarea
|
||||
placeholder: -----BEGIN RSA PRIVATE KEY-----
|
||||
# required-true or false
|
||||
required: false
|
||||
# hide param-true or false
|
||||
hide: true
|
||||
# collect metrics config list
|
||||
metrics:
|
||||
# metrics - basic, inner monitoring metrics (responseTime - response time)
|
||||
@@ -251,18 +174,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
# ssh run collect script
|
||||
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}'
|
||||
# ssh response data parse type: oneRow, multiRow
|
||||
@@ -332,18 +243,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: "LANG=C lscpu | awk -F: '$1==\"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}';vmstat 1 2 | awk 'NR==4{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
@@ -412,18 +311,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: free -m | awk 'BEGIN{print "total used free buff_cache available"} NR==2{print $2,$3,$4,$6,$7}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -469,18 +356,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
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
|
||||
|
||||
@@ -521,18 +396,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -581,18 +444,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: df -mP | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
|
||||
@@ -635,18 +486,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k3nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -689,18 +528,6 @@ metrics:
|
||||
privateKeyPassphrase: ^_^privateKeyPassphrase^_^
|
||||
timeout: ^_^timeout^_^
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
script: ps aux | sort -k4nr | awk 'BEGIN{ print "pid cpu_usage mem_usage command" } {printf "%s %s %s ", $2, $3, $4; for (i=11; i<=NF; i++) { printf "%s", $i; if (i < NF) printf " "; } print ""}' | head -n 11
|
||||
parseType: multiRow
|
||||
|
||||
@@ -729,15 +556,3 @@ metrics:
|
||||
reuseConnection: ^_^reuseConnection^_^
|
||||
script: sensors | grep "^Core\s[0-9\d+\:]" | awk '{print $3}' | sed "s/°C/\ /g" | awk '{ total += $1; count++ } END { print total/count }'
|
||||
parseType: oneRow
|
||||
# whether to use proxy server for ssh connection
|
||||
useProxy: ^_^useProxy^_^
|
||||
# ssh proxy host: ipv4 domain
|
||||
proxyHost: ^_^proxyHost^_^
|
||||
# ssh proxy port
|
||||
proxyPort: ^_^proxyPort^_^
|
||||
# ssh proxy username
|
||||
proxyUsername: ^_^proxyUsername^_^
|
||||
# ssh proxy password
|
||||
proxyPassword: ^_^proxyPassword^_^
|
||||
# ssh proxy private key
|
||||
proxyPrivateKey: ^_^proxyPrivateKey^_^
|
||||
+1
-1
@@ -55,7 +55,7 @@ class AppServiceTest {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
appService.afterPropertiesSet();
|
||||
appService.run();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
-5
@@ -135,7 +135,6 @@ class MonitorServiceTest {
|
||||
.intervals(1)
|
||||
.name("memory")
|
||||
.app("demoApp")
|
||||
.host("localhost")
|
||||
.build();
|
||||
Job job = new Job();
|
||||
job.setMetrics(new ArrayList<>());
|
||||
@@ -158,7 +157,6 @@ class MonitorServiceTest {
|
||||
.intervals(1)
|
||||
.name("memory")
|
||||
.app("demoApp")
|
||||
.host("localhost")
|
||||
.build();
|
||||
Job job = new Job();
|
||||
job.setMetrics(new ArrayList<>());
|
||||
@@ -181,7 +179,6 @@ class MonitorServiceTest {
|
||||
.intervals(1)
|
||||
.name("memory")
|
||||
.app("demoApp")
|
||||
.host("localhost")
|
||||
.build();
|
||||
Job job = new Job();
|
||||
when(appService.getAppDefine(monitor.getApp())).thenReturn(job);
|
||||
@@ -197,7 +194,6 @@ class MonitorServiceTest {
|
||||
Monitor monitor = Monitor.builder()
|
||||
.intervals(1)
|
||||
.name("memory")
|
||||
.host("localhost")
|
||||
.app("demoApp")
|
||||
.build();
|
||||
Job job = new Job();
|
||||
@@ -737,7 +733,6 @@ class MonitorServiceTest {
|
||||
.intervals(1)
|
||||
.name("memory")
|
||||
.app("demoApp")
|
||||
.host("localhost")
|
||||
.build();
|
||||
Job job = new Job();
|
||||
when(appService.getAppDefine(monitor.getApp())).thenReturn(job);
|
||||
|
||||
-19
@@ -19,7 +19,6 @@ package org.apache.hertzbeat.manager.service;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyList;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
@@ -40,7 +39,6 @@ import org.apache.hertzbeat.common.constants.PluginType;
|
||||
import org.apache.hertzbeat.common.entity.dto.PluginUpload;
|
||||
import org.apache.hertzbeat.common.entity.manager.PluginItem;
|
||||
import org.apache.hertzbeat.common.entity.manager.PluginMetadata;
|
||||
import org.apache.hertzbeat.common.support.exception.CommonException;
|
||||
import org.apache.hertzbeat.manager.dao.PluginItemDao;
|
||||
import org.apache.hertzbeat.manager.dao.PluginMetadataDao;
|
||||
import org.apache.hertzbeat.manager.dao.PluginParamDao;
|
||||
@@ -105,23 +103,6 @@ class PluginServiceTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUploadPluginWithInvalidName() {
|
||||
MockMultipartFile mockFile = new MockMultipartFile(
|
||||
"file", "../test-plugin.jar", "application/java-archive",
|
||||
"plugin-content".getBytes(StandardCharsets.UTF_8));
|
||||
PluginUpload pluginUpload = new PluginUpload(mockFile, "Test Plugin", true);
|
||||
assertThrows(CommonException.class, () -> pluginService.savePlugin(pluginUpload));
|
||||
|
||||
MockMultipartFile mockWindowsFile = new MockMultipartFile(
|
||||
"file", "..\\..\\test-plugin.jar", "application/java-archive",
|
||||
"plugin-content".getBytes(StandardCharsets.UTF_8));
|
||||
PluginUpload pluginUploadWindows = new PluginUpload(mockWindowsFile, "Test Plugin", true);
|
||||
assertThrows(CommonException.class, () -> pluginService.savePlugin(pluginUploadWindows));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdateStatus() {
|
||||
PluginMetadata plugin = new PluginMetadata();
|
||||
|
||||
+3
-3
@@ -21,9 +21,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.hertzbeat.alert.config.SmsConfig;
|
||||
import org.apache.hertzbeat.common.constants.GeneralConfigTypeEnum;
|
||||
import org.apache.hertzbeat.base.dao.GeneralConfigDao;
|
||||
import org.apache.hertzbeat.manager.pojo.dto.SmsNoticeSender;
|
||||
import org.apache.hertzbeat.manager.service.impl.SmsGeneralConfigServiceImpl;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -66,9 +66,9 @@ class SmsGeneralConfigServiceTest {
|
||||
@Test
|
||||
void testGetTypeReference() {
|
||||
|
||||
TypeReference<SmsConfig> typeReference = service.getTypeReference();
|
||||
TypeReference<SmsNoticeSender> typeReference = service.getTypeReference();
|
||||
assertNotNull(typeReference);
|
||||
assertEquals(SmsConfig.class, typeReference.getType());
|
||||
assertEquals(SmsNoticeSender.class, typeReference.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
---
|
||||
title: Warmly Welcome HertzBeat's New Community Committer!
|
||||
author: yunfan24
|
||||
author_title: Lixin Diao
|
||||
author_url: https://github.com/yunfan24
|
||||
author_image_url: https://avatars.githubusercontent.com/u/91836599?v=4
|
||||
tags: [opensource, practice]
|
||||
keywords:
|
||||
[
|
||||
open source monitoring system,
|
||||
alerting system,
|
||||
Apache,
|
||||
Apache Committer,
|
||||
Hertzbeat,
|
||||
]
|
||||
---
|
||||
🎉 Hello everyone. I'm very glad to receive an invitation from the Apache HertzBeat community and officially become a Committer of the project!
|
||||
|
||||
## My Open Source Journey
|
||||
|
||||
As a senior undergraduate student, my interest in open source began in my sophomore year. However, early attempts were challenging—even getting projects to run smoothly was difficult, which once made me hesitant to dive deeper. That changed when I discovered HertzBeat in a tech community.
|
||||
|
||||
HertzBeat's detailed contribution guidelines significantly lowered the entry barrier. Thanks to those who paved the way, I got the project running in just a few steps. Its graphical interface helped me quickly grasp the business logic. Later, I watched Tom's introductory video on Bilibili, which deepened my understanding.
|
||||
|
||||
Starting with bug fixes, I gradually explored the codebase through breakpoint debugging and log analysis. What kept me motivated was the community's responsiveness—my first PR was merged on the same day, and my GitHub ID appeared in the contributors list the next morning. This positive feedback loop was incredibly encouraging.
|
||||
|
||||
## Entry Points for Open Source Participation
|
||||
|
||||
For developers looking to contribute, here are my suggestions:
|
||||
|
||||
1. **Start from a user's perspective**: Use the project first, then identify optimizations like UI improvements (pagination, fuzzy search). Even typo fixes are welcome!
|
||||
2. **Technical debt treasure hunt**: Search globally for `TODO`/`FIXME` comments to uncover "hidden quests" left by predecessors.
|
||||
3. **Watch Issues/Discussions**: Stay updated through GitHub subscriptions or community chats. Engage in discussions and tackle interesting problems.
|
||||
4. **Documentation contributions**: Fix typos, broken links, or missing translations—these are great starting points.
|
||||
5. **Enhance testing**: Add unit/E2E tests to improve coverage and project stability.
|
||||
6. **Be proactive**: Join developer groups, subscribe to mailing lists, or attend project meetings. Express your interests and align contributions with the project roadmap.
|
||||
|
||||
## Personal Growth
|
||||
|
||||
Contributing to HertzBeat taught me the essence of geek culture—every line of code and detail is meticulously crafted, not just "good enough." This mindset has elevated my development skills.
|
||||
|
||||
Open source has also broadened my horizons. Previously, "Apache" only existed in my project dependencies. Through the community, I learned about the Apache Software Foundation's operations—and now I'm part of an ASF project myself!
|
||||
|
||||
Most importantly, I've connected with experts from diverse regions and industries. Their experiences are invaluable treasures to me.
|
||||
|
||||
## Closing Thoughts
|
||||
|
||||
Thank you to the community and everyone who reviewed my code! Wishing Apache HertzBeat a successful graduation from the Apache Incubator and continued growth! 🚀
|
||||
@@ -215,7 +215,6 @@ The release package are here:
|
||||
|
||||
- `dist/apache-hertzbeat-{version}-incubating-bin.tar.gz`
|
||||
- `dist/apache-hertzbeat-collector-{version}-incubating-bin.tar.gz`
|
||||
- `dist/apache-hertzbeat-{version}-incubating-docker-compose.tar.gz`
|
||||
|
||||
#### 3.4 Package the source code
|
||||
|
||||
@@ -258,9 +257,6 @@ apache-hertzbeat-1.6.0-incubating-src.tar.gz.sha512
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz.asc
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz.sha512
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz.asc
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz.sha512
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz.asc
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz.sha512
|
||||
@@ -294,8 +290,6 @@ apache-hertzbeat-1.6.0-incubating-src.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-src.tar.gz: OK
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz: OK
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz: OK
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz: OK
|
||||
```
|
||||
|
||||
@@ -183,94 +183,6 @@ alerter:
|
||||
|
||||
Now you can configure this information in your hertzbeat application.
|
||||
|
||||
### AWS Cloud SMS Configuration
|
||||
|
||||
To activate and use the AWS Cloud SMS service, refer to the official AWS documentation: [SMS Getting Started Guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/what-is-sms-mms.html)
|
||||
|
||||
You can configure the AWS Cloud SMS service either through the graphical interface or in the `application.yml` file.
|
||||
To use `application.yml`, add/fill in the following AWS Cloud SMS configuration (replace parameters with your own SMS server configuration):
|
||||
|
||||
```yaml
|
||||
alerter:
|
||||
sms:
|
||||
enable: true # Whether to enable
|
||||
type: aws # SMS provider type, supports "aws"
|
||||
aws: # AWS Cloud SMS configuration
|
||||
access-key-id: # Your AccessKey ID
|
||||
access-key-secret: # Your AccessKey Secret
|
||||
region: # Region Of Your AWS
|
||||
```
|
||||
|
||||
1. Create an AWS Cloud account
|
||||
- If you don’t already have an AWS account, sign up at [AWS Cloud SMS Console](https://aws.amazon.com/console/)
|
||||
|
||||
2. Obtain Access Key credentials (access-key-id, access-key-secret)
|
||||
- Go to the AWS IAM (Identity and Access Management) Console.
|
||||
- Create an IAM user with programmatic access and attach the necessary permissions.
|
||||
- Retrieve your Access Key ID and Secret Access Key (You will need these for configuration).
|
||||
|
||||
3. Select a Specific AWS Region for SMS Messaging
|
||||
- Choose a region that supports AWS End User Messaging (SMS Service).
|
||||
- You can check the supported regions [here](https://docs.aws.amazon.com/sms-voice/latest/userguide/phone-numbers-sms-by-country.html).
|
||||
|
||||
4. Move from the AWS SMS Sandbox to Production
|
||||
- By default, AWS SMS operates in sandbox mode, which restricts SMS delivery to verified phone numbers.
|
||||
To send messages to any number, you must move your account to production mode. follow this [guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/sandbox.html#sandbox-sms-move-to-production)
|
||||
|
||||
5. Verify Destination Phone Numbers (for Sandbox Mode)
|
||||
- if you are still in sandbox mode, you can only send SMS messages to verified phone numbers. To add a verified number, follow this [guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/verify-destination-phone-number.html)
|
||||
- Note: You do not need to create an Origination Identity or Origination Simulator—just use the AWS CLI to add verified phone numbers.
|
||||
|
||||
> The message template is fixed as follows: "Instance: {}, Priority: {}, Content: {}"
|
||||
|
||||
Now you can configure this information in your hertzbeat application.
|
||||
|
||||
### Twilio SMS Configuration
|
||||
|
||||
To activate and use the Twilio SMS service, refer to the official Twilio documentation: [SMS Getting Started Guide](https://www.twilio.com/docs/sms/quickstart)
|
||||
|
||||
You can configure the Twilio SMS service either through the graphical interface or in the `application.yml` file.
|
||||
To use `application.yml`, add/fill in the following Twilio SMS configuration (replace parameters with your own SMS server configuration):
|
||||
|
||||
```yaml
|
||||
alerter:
|
||||
sms:
|
||||
enable: true # Whether to enable
|
||||
type: twilio # SMS provider type, supports "twilio"
|
||||
twilio: # Twilio SMS configuration
|
||||
account-sid: # Your Twilio Account SID
|
||||
auth-token: # Your Twilio Auth Token
|
||||
twilio-phone-number: # Your Twilio Phone Number
|
||||
```
|
||||
|
||||
1. Create a Twilio account
|
||||
|
||||
- If you don't have a Twilio account, sign up at [Twilio Console](https://www.twilio.com/console)
|
||||
- You'll get a free trial account that allows you to test the SMS service
|
||||
|
||||
2. Obtain Twilio credentials
|
||||
|
||||
- After signing in, locate your Account SID and Auth Token on the dashboard
|
||||
- These credentials will be used to authenticate API requests
|
||||
|
||||
3. Get a Twilio Phone Number
|
||||
|
||||
- In the Twilio Console, navigate to "Phone Numbers" > "Manage" > "Active Numbers"
|
||||
- Click "Buy a Number" or use the trial number provided by Twilio
|
||||
- Make sure the number has SMS capabilities enabled
|
||||
- This number will be used as the sender for your SMS alerts
|
||||
- A phone number is required for the Twilio SMS service to work
|
||||
|
||||
4. Testing Your Configuration on Twilio
|
||||
|
||||
- Twilio provides a sandbox environment for testing
|
||||
- If you are in the trial period, you will only be able to send SMS to verified phone numbers
|
||||
- To verify a phone number, add it to your verified phone numbers list in the Twilio Console
|
||||
|
||||
> The message follows the format: "Instance: {}, Priority: {}, Content: {}"
|
||||
|
||||
This information can be configured in the Hertzbeat application.
|
||||
|
||||
## Operation steps
|
||||
|
||||
1. **【Alarm notification】->【Add new recipient】 ->【Select SMS notification method】**
|
||||
|
||||
@@ -9,7 +9,7 @@ keywords: [bulletin, custom]
|
||||
|
||||
### Add Bulletin Item
|
||||
|
||||
1. Click `Add New Bulletin Item`, enter the `Bulletin Name`, scroll down to select the `Monitoring Type`, select the associated `Monitoring Task Name`, You can filter `Monitor Task Name` by `Label`, and then select the `Monitoring Metrics` you want to show in the shuttle box.
|
||||
1. Click `Add New Bulletin Item`, enter the `Bulletin Name`, scroll down to select the `Monitoring Type`, select the associated `Monitoring Task Name`, and then select the `Monitoring Metrics` you want to show in the shuttle box.
|
||||
|
||||
2. Click `OK` button to finish creating the customized bulletin.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Note⚠️ Need InfluxDB 1.x Version.
|
||||
|
||||
### 1. Use HuaweiCloud GaussDB For Influx
|
||||
|
||||
> Use [HuaweiCloud GaussDB For Influx](https://www.huaweicloud.com/intl/en-us/product/gaussdb.html)
|
||||
> Use [HuaweiCloud GaussDB For Influx](https://www.huaweicloud.com/product/gaussdbforinflux.html)
|
||||
>
|
||||
> Get the `GaussDB For Influx` service url, username and password config.
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
---
|
||||
title: 热烈欢迎 HertzBeat 小伙伴新晋社区 Committer!
|
||||
author: yunfan24
|
||||
author_title: Lixin Diao
|
||||
author_url: https://github.com/yunfan24
|
||||
author_image_url: https://avatars.githubusercontent.com/u/91836599?v=4
|
||||
tags: [opensource, practice]
|
||||
keywords:
|
||||
[
|
||||
open source monitoring system,
|
||||
alerting system,
|
||||
Apache,
|
||||
Apache Committer,
|
||||
Hertzbeat,
|
||||
]
|
||||
---
|
||||
🎉 大家好,很高兴收到 Apache HertzBeat 社区的邀请,正式成为项目的 Committer!
|
||||
|
||||
## 我的开源之旅
|
||||
|
||||
本人是一名大四在校学生,从大二就萌生了参与开源的想法,然而,早期的尝试并不顺利——很多项目仅仅是运行起来都困难重重,这让我一度放弃了深入开源的念头。直到偶然间在技术社区发现了 HertzBeat。
|
||||
|
||||
HertzBeat 的贡献指南详细清晰,极大降低了上手难度。前人栽树,后人乘凉。通过简单几步,我就成功运行了项目。结合其图形界面,能够快速理解业务逻辑。之后,我又在 B 站看到了 Tom 哥的介绍视频,对项目有了更深的认识。
|
||||
|
||||
从最初的 bug 修复入手,我逐渐深入代码,通过断点调试和日志分析,逐渐熟悉了项目结构。在这个过程中,吸引我持续进行贡献的一大原因是,社区的活跃度很高,Issue和PR可以被快速响应,我记得在HertzBeat 提交的第一个pr当天就被合并,第二天我的Github ID就出现在了贡献者名单上,这给了我足够的正向反馈。
|
||||
|
||||
## 参与开源的切入点
|
||||
|
||||
对于想要加入开源的开发者,我有几点个人建议:
|
||||
|
||||
1. **以用户的视角出发**:先使用项目,找到可以优化的地方,例如 UI 体验改进(分页优化、模糊搜索等)。即使是修正错别字,社区也非常欢迎。
|
||||
2. **技术债挖掘大法**:全局搜索 `TODO`/`FIXME` 注释,解锁前人留下的「隐藏任务」
|
||||
3. **Watch Issue/Discussion**:及时获取项目信息,也可以在用户交流群中参与讨论,根据反馈选择感兴趣的问题进行贡献。
|
||||
4. **贡献文档**:修正错别字、修复死链、补充缺失的翻译等,这些都是很好的切入点。
|
||||
5. **补充测试用例**:增加单元测试、E2E 测试,提升测试覆盖率,提高项目稳定性。
|
||||
6. **主动出击**:加入开发者交流群、订阅开发者邮件列表或参加项目例会,表达贡献意愿,了解项目的 Roadmap,并根据规划进行贡献。
|
||||
|
||||
## 个人收获
|
||||
|
||||
在贡献 HertzBeat 的过程中,我深刻体会到了社区的极客精神——每一行代码、每一个细节都经过仔细推敲,而不仅仅是“能用就行”,这让我在开发中收获颇丰。
|
||||
|
||||
另外,参与开源极大地拓宽了我的视野。以前 Apache 这个名字只出现于我的项目依赖里,通过社区,我了解了 Apache 基金会和其运作方式,而如今,我竟然也能成为 Apache 基金会下项目的一员,虽然我做的工作跟大佬们相差甚远。
|
||||
|
||||
更重要的是,我在社区结识了来自不同地区、不同行业的大佬。他们的经验和历程对我而言,都是一笔宝贵的财富。
|
||||
|
||||
## 写在最后
|
||||
|
||||
感谢社区的支持,感谢每一位 Review 代码的小伙伴!最后祝 Apache HertzBeat 顺利毕业,越来越好!🚀
|
||||
@@ -215,7 +215,6 @@ mvn clean package -Pcluster
|
||||
|
||||
- `dist/apache-hertzbeat-{version}-incubating-bin.tar.gz`
|
||||
- `dist/apache-hertzbeat-collector-{version}-incubating-bin.tar.gz`
|
||||
- `dist/apache-hertzbeat-{version}-incubating-docker-compose.tar.gz`
|
||||
|
||||
#### 3.4 打包项目源代码
|
||||
|
||||
@@ -260,9 +259,6 @@ apache-hertzbeat-1.6.0-incubating-src.tar.gz.sha512
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz.asc
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz.sha512
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz.asc
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz.sha512
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz.asc
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz.sha512
|
||||
@@ -296,8 +292,6 @@ apache-hertzbeat-1.6.0-incubating-src.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-src.tar.gz: OK
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-bin.tar.gz: OK
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz
|
||||
apache-hertzbeat-1.6.0-incubating-docker-compose.tar.gz: OK
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz
|
||||
apache-hertzbeat-collector-1.6.0-incubating-bin.tar.gz: OK
|
||||
```
|
||||
|
||||
@@ -153,48 +153,6 @@ alerter:
|
||||
- HMAC模式:此模式要求使用 AccessKey Secret 对请求参数进行验签,以加强保障请求的安全与真实性。
|
||||
:::
|
||||
|
||||
### AWS Cloud SMS配置
|
||||
|
||||
要激活和使用 AWS Cloud SMS 服务,请参考官方 AWS 文档: [SMS Getting Started Guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/what-is-sms-mms.html)
|
||||
|
||||
您可以通过图形界面或 application.yml 文件配置 AWS Cloud SMS 服务。
|
||||
要使用 application.yml,请添加/填写以下 AWS Cloud SMS 配置(请用您的 SMS 服务器配置信息替换参数):
|
||||
|
||||
```yaml
|
||||
alerter:
|
||||
sms:
|
||||
enable: true # Whether to enable
|
||||
type: aws # SMS provider type, supports "aws"
|
||||
aws: # AWS Cloud SMS configuration
|
||||
access-key-id: # Your AccessKey ID
|
||||
access-key-secret: # Your AccessKey Secret
|
||||
region: # Region Of Your AWS
|
||||
```
|
||||
|
||||
1. 创建 AWS 账户
|
||||
- 如果您尚未创建 AWS 账户,请访问 [AWS Cloud SMS Console](https://aws.amazon.com/console/)进行注册。
|
||||
|
||||
2. 获取访问密钥凭据(access-key-id, access-key-secret)
|
||||
- 进入 AWS IAM(身份与访问管理)控制台。
|
||||
- 创建一个具有编程访问权限的 IAM 用户,并附加必要的权限。
|
||||
- 获取您的 Access Key ID 和 Secret Access Key(配置时需要)。
|
||||
|
||||
3. 选择要用于 AWS 终端用户消息传递服务的特定区域
|
||||
- 选择支持 AWS 终端用户消息传递(SMS 服务)的区域。
|
||||
- 您可以在 这里 查看支持的区域[here](https://docs.aws.amazon.com/sms-voice/latest/userguide/phone-numbers-sms-by-country.html).
|
||||
|
||||
4. 将 AWS SMS 从沙盒模式移动到生产模式
|
||||
- 默认情况下,AWS SMS 以沙盒模式运行,在该模式下,短信仅能发送到已验证的电话号码。
|
||||
要将消息发送到任意号码,您必须将您的账户升级到生产模式。请参考此 指南。 [guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/sandbox.html#sandbox-sms-move-to-production)
|
||||
|
||||
5. 验证目标电话号码(适用于沙盒模式)
|
||||
- 如果您的账户仍处于沙盒模式,您只能向已验证的电话号码发送短信。要添加已验证的号码,请参考此 [guide](https://docs.aws.amazon.com/sms-voice/latest/userguide/verify-destination-phone-number.html)
|
||||
- 注意: 您不需要创建 Origination Identity 或 Origination Simulator,只需使用 AWS CLI 添加已验证的电话号码。
|
||||
|
||||
> 短信模板格式固定如下:“Instance: {}, Priority: {}, Content: {}”
|
||||
|
||||
现在,您可以在您的 Hertzbeat 应用程序中配置这些信息.
|
||||
|
||||
现在您可以把这些信息配置到您的hertzbeat应用中。
|
||||
|
||||
### smslocal短信配置
|
||||
|
||||
@@ -9,7 +9,7 @@ keywords: [看板, 自定义]
|
||||
|
||||
### 新增看板项
|
||||
|
||||
1. 点击新增看板项, 输入`看板名称`, 下拉选择`监控类型`, 可根据`标签`对`监控任务名称`进行筛选,再选择关联的`监控任务名称`, 最后在穿梭框中选择需要展示的`监控指标`。
|
||||
1. 点击新增看板项, 输入`看板名称`, 下拉选择`监控类型`, 再选择关联的`监控任务名称`, 最后在穿梭框中选择需要展示的`监控指标`。
|
||||
|
||||
2. 点击`确定`按钮, 即可完成自定义看板的创建。
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ InfluxDB是一个由InfluxData开发的开源时序型数据库,专注于海
|
||||
|
||||
### 1. 直接使用华为云服务 GaussDB For Influx
|
||||
|
||||
> 开通使用[华为云云数据库 GaussDB For Influx](https://www.huaweicloud.com/intl/zh-cn/product/gaussdb.html)
|
||||
> 开通使用[华为云云数据库 GaussDB For Influx](https://www.huaweicloud.com/product/gaussdbforinflux.html)
|
||||
>
|
||||
> 获取云数据库对外暴露连接地址,账户密码即可
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ InfluxDB是一个由InfluxData开发的开源时序型数据库,专注于海
|
||||
|
||||
### 1. 直接使用华为云服务 GaussDB For Influx
|
||||
|
||||
> 开通使用[华为云云数据库 GaussDB For Influx](https://www.huaweicloud.com/intl/zh-cn/product/gaussdb.html)
|
||||
> 开通使用[华为云云数据库 GaussDB For Influx](https://www.huaweicloud.com/product/gaussdbforinflux.html)
|
||||
>
|
||||
> 获取云数据库对外暴露连接地址,账户密码即可
|
||||
|
||||
|
||||
@@ -157,13 +157,6 @@
|
||||
"help/windows_script"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "category",
|
||||
"label": "server",
|
||||
"items": [
|
||||
"help/ipmi"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "category",
|
||||
"label": "mid",
|
||||
|
||||
@@ -448,12 +448,6 @@ export default function () {
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yasminvo"><img src="https://avatars.githubusercontent.com/u/107528848?v=4?s=100" width="100px;" alt="yasminvo"/><br /><sub><b>yasminvo</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yasminvo" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/notbugggg"><img src="https://avatars.githubusercontent.com/u/147966331?v=4?s=100" width="100px;" alt="不关银渐层的事哦"/><br /><sub><b>不关银渐层的事哦</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=notbugggg" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yyahang"><img src="https://avatars.githubusercontent.com/u/90464876?v=4?s=100" width="100px;" alt="yyahang"/><br /><sub><b>yyahang</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=yyahang" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/JuJinPark"><img src="https://avatars.githubusercontent.com/u/44892459?v=4?s=100" width="100px;" alt="jujin"/><br /><sub><b>jujin</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=JuJinPark" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/LL-LIN"><img src="https://avatars.githubusercontent.com/u/43002118?v=4?s=100" width="100px;" alt="LL-LIN"/><br /><sub><b>LL-LIN</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=LL-LIN" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://bigcyy.github.io/"><img src="https://avatars.githubusercontent.com/u/73413979?v=4?s=100" width="100px;" alt="Yang Chen"/><br /><sub><b>Yang Chen</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=bigcyy" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sarthakeash"><img src="https://avatars.githubusercontent.com/u/74091160?v=4?s=100" width="100px;" alt="Sarthak Arora"/><br /><sub><b>Sarthak Arora</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=sarthakeash" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 78 KiB |
@@ -14,7 +14,7 @@ Note⚠️ Need InfluxDB 1.x Version.
|
||||
|
||||
### 1. Use HuaweiCloud GaussDB For Influx
|
||||
|
||||
> Use [HuaweiCloud GaussDB For Influx](https://www.huaweicloud.com/intl/en-us/product/gaussdb.html)
|
||||
> Use [HuaweiCloud GaussDB For Influx](https://www.huaweicloud.com/product/gaussdbforinflux.html)
|
||||
>
|
||||
> Get the `GaussDB For Influx` service url, username and password config.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Apache HertzBeat (incubating)
|
||||
Copyright 2024-2025 The Apache Software Foundation
|
||||
Copyright 2024 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Apache HertzBeat (incubating)
|
||||
Copyright 2024-2025 The Apache Software Foundation
|
||||
Copyright 2024 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<hzb.version>1.7.0</hzb.version>
|
||||
<hzb.version>1.6.1</hzb.version>
|
||||
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
|
||||
@@ -226,14 +226,7 @@ alerter:
|
||||
template-id: YOUR_TEMPLATE_ID
|
||||
smslocal:
|
||||
api-key: YOUR_API_KEY_HERE
|
||||
aws:
|
||||
access-key-id: YOUR_ACCESS_KEY_ID
|
||||
access-key-secret: YOUR_ACCESS_KEY_SECRET
|
||||
region: AWS_REGION_FOR_END_USER_MESSAGING
|
||||
twilio:
|
||||
account-sid: YOUR_ACCOUNT_SID
|
||||
auth-token: YOUR_AUTH_TOKEN
|
||||
twilio-phone-number: YOUR_TWILIO_PHONE_NUMBER
|
||||
|
||||
scheduler:
|
||||
server:
|
||||
enabled: true
|
||||
|
||||
@@ -34,10 +34,6 @@ spring:
|
||||
exclude: org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration, org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration
|
||||
freemarker:
|
||||
enabled: false
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
management:
|
||||
health:
|
||||
@@ -197,14 +193,7 @@ alerter:
|
||||
template-id: YOUR_TEMPLATE_ID
|
||||
smslocal:
|
||||
api-key: YOUR_API_KEY_HERE
|
||||
aws:
|
||||
access-key-id: YOUR_ACCESS_KEY_ID
|
||||
access-key-secret: YOUR_ACCESS_KEY_SECRET
|
||||
region: AWS_REGION_FOR_END_USER_MESSAGING
|
||||
twilio:
|
||||
account-sid: YOUR_ACCOUNT_SID
|
||||
auth-token: YOUR_AUTH_TOKEN
|
||||
twilio-phone-number: YOUR_TWILIO_PHONE_NUMBER
|
||||
|
||||
scheduler:
|
||||
server:
|
||||
enabled: true
|
||||
|
||||
@@ -21,20 +21,20 @@ networks:
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mariadb:11.7
|
||||
image: mysql:8
|
||||
container_name: compose-mysql
|
||||
hostname: mysql
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
interval: 10s
|
||||
test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --silent']
|
||||
interval: 3s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
start_period: 3m
|
||||
ports:
|
||||
- '13306:3306'
|
||||
- "3306"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MARIADB_ROOT_PASSWORD: 123456
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
volumes:
|
||||
- ./dbdata/mysqldata:/var/lib/mysql/
|
||||
- ./conf/sql:/docker-entrypoint-initdb.d/
|
||||
@@ -55,15 +55,15 @@ services:
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "18181:8181"
|
||||
- "16667:6667"
|
||||
- "8181"
|
||||
- "6667"
|
||||
volumes:
|
||||
- ./dbdata/iotdbdata:/iotdb/data
|
||||
networks:
|
||||
- hertzbeat
|
||||
|
||||
hertzbeat:
|
||||
image: apache/hertzbeat:1.7.0
|
||||
image: apache/hertzbeat
|
||||
container_name: compose-hertzbeat
|
||||
hostname: hertzbeat
|
||||
restart: always
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user