diff --git a/README.md b/README.md index 87409e693b9..d35bbce4b74 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ * Combines **monitoring, alarm, and notification** features into one platform, and supports monitoring for web service, program, database, cache, os, webserver, middleware, bigdata, cloud-native, network, custom and more. * Easy to use and agentless, web-based and with one-click monitoring and alerting, zero learning curve. * Makes protocols such as `Http, Jmx, Ssh, Snmp, Jdbc, Prometheus` configurable, allowing you to collect any metrics by simply configuring the template `YML` file online. Imagine being able to quickly adapt to a new monitoring type like K8s or Docker simply by configuring online with HertzBeat. -* Compatible with the `Prometheus` ecosystem and more, can monitoring what `Prometheus` can monitoring with few clicks on gui. +* Compatible with the `Prometheus` ecosystem and more, can monitoring what `Prometheus` can monitoring with few clicks on webui. * High performance, supports horizontal expansion of multi-collector clusters, multi-isolated network monitoring and cloud-edge collaboration. * Provides flexible alarm threshold rules and timely notifications delivered via `Discord` `Slack` `Telegram` `Email` `Dingtalk` `WeChat` `FeiShu` `Webhook` `SMS` `ServerChan`. diff --git a/collector/src/main/java/org/dromara/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java b/collector/src/main/java/org/dromara/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java index 3e02ecef755..6960a3431f0 100644 --- a/collector/src/main/java/org/dromara/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java +++ b/collector/src/main/java/org/dromara/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java @@ -125,7 +125,8 @@ public void collect(CollectRep.MetricsData.Builder builder, long monitorId, Stri String operation = snmpProtocol.getOperation(); operation = StringUtils.hasText(operation) ? operation : OPERATION_GET; if (OPERATION_GET.equalsIgnoreCase(operation)) { - PDU pdu = targetBuilder.pdu().type(PDU.GET).oids(snmpProtocol.getOids().values().toArray(new String[0])).contextName(snmpProtocol.getContextName()).build(); + String contextName = getContextName(snmpProtocol.getContextName()); + PDU pdu = targetBuilder.pdu().type(PDU.GET).oids(snmpProtocol.getOids().values().toArray(new String[0])).contextName(contextName).build(); SnmpCompletableFuture snmpRequestFuture = SnmpCompletableFuture.send(snmpService, target, pdu); List vbs = snmpRequestFuture.get().getAll(); long responseTime = System.currentTimeMillis() - startTime; @@ -321,4 +322,8 @@ private TargetBuilder.AuthProtocol getAuthPasswordEncryption(String authPassword else if (SHA1.equals(authPasswordEncryption)) return TargetBuilder.AuthProtocol.sha1; else return TargetBuilder.AuthProtocol.md5; } + + private String getContextName(String contextName) { + return contextName == null ? "" : contextName; + } } diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/job/protocol/SnmpProtocol.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/job/protocol/SnmpProtocol.java index 497d6d010e0..3c32bae3eac 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/job/protocol/SnmpProtocol.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/job/protocol/SnmpProtocol.java @@ -81,7 +81,7 @@ public class SnmpProtocol { /** * contextName */ - private String contextName = ""; + private String contextName; /** * authPasswordEncryption diff --git a/home/blog/2023-12-11-hertzbeat-v1.4.3.md b/home/blog/2023-12-11-hertzbeat-v1.4.3.md index c7d864f3775..55089271e93 100644 --- a/home/blog/2023-12-11-hertzbeat-v1.4.3.md +++ b/home/blog/2023-12-11-hertzbeat-v1.4.3.md @@ -17,7 +17,7 @@ keywords: [open source monitoring system, alerting system] * Combines **monitoring, alarm, and notification** features into one platform, and supports monitoring for web service, program, database, cache, os, webserver, middleware, bigdata, cloud-native, network, custom and more. * Easy to use and agentless, web-based and with one-click monitoring and alerting, zero learning curve. * Makes protocols such as `Http, Jmx, Ssh, Snmp, Jdbc, Prometheus` configurable, allowing you to collect any metrics by simply configuring the template `YML` file online. Imagine being able to quickly adapt to a new monitoring type like K8s or Docker simply by configuring online with HertzBeat. -* Compatible with the `Prometheus` ecosystem and more, can monitoring what `Prometheus` can monitoring with few clicks on gui. +* Compatible with the `Prometheus` ecosystem and more, can monitoring what `Prometheus` can monitoring with few clicks on webui. * High performance, supports horizontal expansion of multi-collector clusters, multi-isolated network monitoring and cloud-edge collaboration. * Provides flexible alarm threshold rules and timely notifications delivered via `Discord` `Slack` `Telegram` `Email` `Dingtalk` `WeChat` `FeiShu` `Webhook` `SMS` `ServerChan`. @@ -42,7 +42,7 @@ keywords: [open source monitoring system, alerting system] - add e2e testing module, support by api-testing - more feature, document and bugfix -Compatible with the Prometheus ecosystem, now we can monitor what Prometheus can monitoring with few clicks on gui. +Compatible with the Prometheus ecosystem, now we can monitor what Prometheus can monitoring with few clicks on webui. ### Install Quickly Via Docker diff --git a/home/docs/introduce.md b/home/docs/introduce.md index 9802228a7e1..f4116048aaf 100644 --- a/home/docs/introduce.md +++ b/home/docs/introduce.md @@ -32,7 +32,7 @@ slug: / * Combines **monitoring, alarm, and notification** features into one platform, and supports monitoring for web service, program, database, cache, os, webserver, middleware, bigdata, cloud-native, network, custom and more. * Easy to use and agentless, web-based and with one-click monitoring and alerting, zero learning curve. * Makes protocols such as `Http, Jmx, Ssh, Snmp, Jdbc, Prometheus` configurable, allowing you to collect any metrics by simply configuring the template `YML` file online. Imagine being able to quickly adapt to a new monitoring type like K8s or Docker simply by configuring online with HertzBeat. -* Compatible with the `Prometheus` ecosystem and more, can monitoring what `Prometheus` can monitoring with few clicks on gui. +* Compatible with the `Prometheus` ecosystem and more, can monitoring what `Prometheus` can monitoring with few clicks on webui. * High performance, supports horizontal expansion of multi-collector clusters, multi-isolated network monitoring and cloud-edge collaboration. * Provides flexible alarm threshold rules and timely notifications delivered via `Discord` `Slack` `Telegram` `Email` `Dingtalk` `WeChat` `FeiShu` `Webhook` `SMS` `ServerChan`.