This is an automated email from the ASF dual-hosted git repository.

gongchao pushed a commit to branch bugfix#ssl
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git

commit 19930c8fad218d75392dbd6fdd60fac51035e971
Author: tomsun28 <[email protected]>
AuthorDate: Wed May 8 15:53:06 2024 +0800

    [bugfix] fix ssl-cert days_remaining and npe
    
    Signed-off-by: tomsun28 <[email protected]>
---
 .../hertzbeat/collector/collect/http/SslCertificateCollectImpl.java   | 4 ++--
 .../java/org/apache/hertzbeat/common/util/JexlExpressionRunner.java   | 2 +-
 manager/src/main/resources/define/app-ssl_cert.yml                    | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java
index 561c76353..96a4df12b 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/http/SslCertificateCollectImpl.java
@@ -159,8 +159,8 @@ public class SslCertificateCollectImpl extends 
AbstractCollect {
         }
         HttpProtocol httpProtocol = metrics.getHttp();
         String url = httpProtocol.getUrl();
-        if (StringUtils.hasText(url) || !url.startsWith(RIGHT_DASH)) {
-            httpProtocol.setUrl(url == null ? RIGHT_DASH : RIGHT_DASH + 
url.trim());
+        if (!StringUtils.hasText(url) || !url.startsWith(RIGHT_DASH)) {
+            httpProtocol.setUrl(StringUtils.hasText(url) ? RIGHT_DASH + 
url.trim() : RIGHT_DASH);
         }
     }
 }
diff --git 
a/common/src/main/java/org/apache/hertzbeat/common/util/JexlExpressionRunner.java
 
b/common/src/main/java/org/apache/hertzbeat/common/util/JexlExpressionRunner.java
index 6d13886ea..efa297375 100644
--- 
a/common/src/main/java/org/apache/hertzbeat/common/util/JexlExpressionRunner.java
+++ 
b/common/src/main/java/org/apache/hertzbeat/common/util/JexlExpressionRunner.java
@@ -40,7 +40,7 @@ public class JexlExpressionRunner {
         // set the root namespace function
         functions.put(null, new JexlCommonFunction());
         jexlEngine = new 
JexlBuilder().charset(StandardCharsets.UTF_8).cache(256)
-                .strict(true).silent(false).namespaces(functions).create();
+                
.strict(true).silent(false).stackOverflow(40).namespaces(functions).create();
     }
     
     public static Object evaluate(String expression, Map<String, Object> 
context) {
diff --git a/manager/src/main/resources/define/app-ssl_cert.yml 
b/manager/src/main/resources/define/app-ssl_cert.yml
index 55b47ac37..b1852e66d 100644
--- a/manager/src/main/resources/define/app-ssl_cert.yml
+++ b/manager/src/main/resources/define/app-ssl_cert.yml
@@ -133,7 +133,8 @@ metrics:
       - end_timestamp
       - days_remaining
     calculates:
-      - days_remaining=math.floor((end_timestamp-now())/86400000) #下取整
+      - days_remaining=(end_timestamp-now())/86400000 #下取整
+#      - days_remaining=math.floor((end_timestamp-now())/86400000) #下取整
     # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, 
sdk
     protocol: ssl_cert
     http:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to