diff --git a/Dockerfile_test_image.in b/Dockerfile_test_image.in
index c22eeff3..abb51806 100644
--- a/Dockerfile_test_image.in
+++ b/Dockerfile_test_image.in
@@ -31,7 +31,7 @@ update-alternatives --install /usr/bin/python python /usr/bin/python2 2
mkdir -p /opt/zenoss
EOT
-ADD dist/target/zep-dist-2.8.1.tar.gz /opt/zenoss
+ADD dist/target/zep-dist-2.8.2.tar.gz /opt/zenoss
ENV TERM=xterm ZENHOME=/opt/zenoss PATH="/opt/zenoss/bin:${PATH}"
diff --git a/core/pom.xml b/core/pom.xml
index ca617880..a6aa3cd5 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -13,7 +13,7 @@
org.zenoss.zep
zep-parent
- 2.8.1
+ 2.8.2
../pom.xml
@@ -304,6 +304,11 @@
jetty-deploy
${jetty.version}
+
+ org.eclipse.jetty
+ jetty-jmx
+ ${jetty.version}
+
org.eclipse.jetty
jetty-webapp
@@ -322,11 +327,6 @@
-
- org.springframework.data
- spring-data-redis
- ${spring-data-redis.version}
-
redis.clients
jedis
@@ -406,7 +406,13 @@
${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-deploy.xml
${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-http.xml
${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-webapp.xml
+ ${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx.xml
+ ${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx-remote.xml
+
+ ${project.basedir}/../dist/src/assembly/modules/jmx.mod
+ ${project.basedir}/../dist/src/assembly/modules/jmx-remote.mod
+
jar
@@ -446,6 +452,11 @@
jetty-util-ajax
${jetty.version}
+
+ org.eclipse.jetty
+ jetty-jmx
+ ${jetty.version}
+
org.eclipse.jetty.toolchain
jetty-jakarta-servlet-api
diff --git a/core/src/main/java/org/zenoss/zep/MetricsRegistryConfig.java b/core/src/main/java/org/zenoss/zep/MetricsRegistryConfig.java
index 6f59cb10..d0453249 100644
--- a/core/src/main/java/org/zenoss/zep/MetricsRegistryConfig.java
+++ b/core/src/main/java/org/zenoss/zep/MetricsRegistryConfig.java
@@ -1,6 +1,7 @@
package org.zenoss.zep;
import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.MetricSet;
import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
@@ -15,30 +16,36 @@
public class MetricsRegistryConfig {
private static final Logger logger = LoggerFactory.getLogger(MetricsRegistryConfig.class);
+
+ private void skipOrRegister(MetricRegistry registry, String metricSetName, MetricSet metricSet) {
+ if (registry.getNames().stream().noneMatch(n->n.startsWith(metricSetName))) {
+ registry.register(metricSetName, metricSet);
+ logger.info("Register {} metrics set in zep registry", metricSetName);
+ } else {
+ logger.warn("Metrics set {} already exist in zep registry", metricSetName);
+ }
+ }
@Bean
public GarbageCollectorMetricSet garbageCollectorMetricSet(@Autowired MetricRegistry registry) {
GarbageCollectorMetricSet metricSet = new GarbageCollectorMetricSet();
- String metricName = "jvm.gc";
- registry.register(metricName, metricSet);
- logger.info("Register {} metric in zep registry", metricName);
+ String metricSetName = "jvm.gc";
+ skipOrRegister(registry, metricSetName, metricSet);
return metricSet;
}
@Bean
public MemoryUsageGaugeSet memoryUsageGaugeSet(@Autowired MetricRegistry registry) {
MemoryUsageGaugeSet metricSet = new MemoryUsageGaugeSet();
- String metricName = "jvm.memory";
- registry.register(metricName, metricSet);
- logger.info("Register {} metric in zep registry", metricName);
+ String metricSetName = "jvm.memory";
+ skipOrRegister(registry, metricSetName, metricSet);
return metricSet;
}
@Bean
public ThreadStatesGaugeSet threadStatesGaugeSet(@Autowired MetricRegistry registry) {
ThreadStatesGaugeSet metricSet = new ThreadStatesGaugeSet();
- String metricName = "jvm.thread-states";
- registry.register(metricName, metricSet);
- logger.info("Register {} metric in zep registry", metricName);
+ String metricSetName = "jvm.thread-states";
+ skipOrRegister(registry, metricSetName, metricSet);
return metricSet;
}
@@ -46,8 +53,12 @@ public ThreadStatesGaugeSet threadStatesGaugeSet(@Autowired MetricRegistry regis
public FileDescriptorRatioGauge fileDescriptorRatioGauge(@Autowired MetricRegistry registry) {
FileDescriptorRatioGauge metric = new FileDescriptorRatioGauge();
String metricName = "jvm.fd.usage";
- registry.register(metricName, metric);
- logger.info("Register {} metric in zep registry", metricName);
+ if (!registry.getNames().contains(metricName)) {
+ registry.register(metricName, metric);
+ logger.info("Register {} metric in zep registry", metricName);
+ } else {
+ logger.warn("Metric {} already exist in zep registry", metricName);
+ }
return metric;
}
}
diff --git a/core/src/main/java/org/zenoss/zep/dao/impl/FlapTrackerDaoImpl.java b/core/src/main/java/org/zenoss/zep/dao/impl/FlapTrackerDaoImpl.java
index ef4c2a55..4e146b04 100644
--- a/core/src/main/java/org/zenoss/zep/dao/impl/FlapTrackerDaoImpl.java
+++ b/core/src/main/java/org/zenoss/zep/dao/impl/FlapTrackerDaoImpl.java
@@ -12,11 +12,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.RedisConnectionFailureException;
-import org.springframework.data.redis.core.StringRedisTemplate;
import org.zenoss.zep.ZepException;
import org.zenoss.zep.dao.FlapTrackerDao;
import org.zenoss.zep.impl.FlapTracker;
+import org.zenoss.zep.utils.JedisPoolUtil;
+import redis.clients.jedis.params.SetParams;
import java.util.concurrent.TimeUnit;
@@ -27,7 +27,7 @@ public class FlapTrackerDaoImpl implements FlapTrackerDao{
private final String REDIS_FLAP_KEY = "zenoss_event_flapping";
@Autowired
- private StringRedisTemplate template = null;
+ private JedisPoolUtil pool = null;
private String createKey(String clearFingerPrintHash) {
@@ -35,12 +35,7 @@ private String createKey(String clearFingerPrintHash) {
}
@Override
public FlapTracker getFlapTrackerByClearFingerprintHash(String clearFingerPrintHash) throws ZepException {
- String result;
- try {
- result = template.opsForValue().get(createKey(clearFingerPrintHash));
- } catch (RedisConnectionFailureException e) {
- throw new ZepException(e);
- }
+ String result = pool.useJedis(jedis -> jedis.get(createKey(clearFingerPrintHash)));
if (result != null) {
// return existing flap tracker
logger.debug("String gotten back from redis " + result);
@@ -54,10 +49,11 @@ public FlapTracker getFlapTrackerByClearFingerprintHash(String clearFingerPrintH
@Override
public void persistTracker(String clearFingerprintHash, FlapTracker tracker, long timeToKeep) throws ZepException {
logger.debug("Setting string key {} value {}", createKey(clearFingerprintHash), tracker.convertToString());
- try {
- template.opsForValue().set(createKey(clearFingerprintHash), tracker.convertToString(), timeToKeep, TimeUnit.SECONDS);
- }catch (RedisConnectionFailureException e) {
- throw new ZepException(e);
- }
+ SetParams params = new SetParams();
+ params.ex(timeToKeep);
+ pool.useJedis(jedis -> {
+ jedis.set(createKey(clearFingerprintHash), tracker.convertToString(), params);
+ return null;
+ });
}
}
diff --git a/core/src/main/java/org/zenoss/zep/impl/TriggerPlugin.java b/core/src/main/java/org/zenoss/zep/impl/TriggerPlugin.java
index b6dee55e..30a1dffc 100644
--- a/core/src/main/java/org/zenoss/zep/impl/TriggerPlugin.java
+++ b/core/src/main/java/org/zenoss/zep/impl/TriggerPlugin.java
@@ -240,7 +240,9 @@ private void scheduleSpool() {
Instant nextExecution = null;
try {
long nextFlushTime = signalSpoolDao.getNextFlushTime();
- if (nextFlushTime > 0) {
+ if (nextFlushTime == Long.MAX_VALUE) {
+ nextExecution = Instant.now().plusSeconds(31536000); // 10 years
+ } else if (nextFlushTime > 0) {
nextExecution = Instant.ofEpochMilli(nextFlushTime);
logger.debug("Next flush time: {}", nextExecution);
}
diff --git a/core/src/main/java/org/zenoss/zep/rest/IncManResource.java b/core/src/main/java/org/zenoss/zep/rest/IncManResource.java
new file mode 100644
index 00000000..3f1918ec
--- /dev/null
+++ b/core/src/main/java/org/zenoss/zep/rest/IncManResource.java
@@ -0,0 +1,87 @@
+package org.zenoss.zep.rest;
+
+import jakarta.ws.rs.*;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.jboss.resteasy.annotations.GZIP;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.zenoss.protobufs.ProtobufConstants;
+import org.zenoss.protobufs.zep.Zep.EventDetail;
+import org.zenoss.protobufs.zep.Zep.EventDetailSet;
+import org.zenoss.protobufs.zep.Zep.EventTriggerSubscription;
+import org.zenoss.zep.ZepException;
+import org.zenoss.zep.dao.EventSignalSpool;
+import org.zenoss.zep.dao.EventSignalSpoolDao;
+import org.zenoss.zep.dao.EventTriggerSubscriptionDao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@Path("1.0/incman")
+public class IncManResource {
+ private static final Logger logger = LoggerFactory.getLogger(IncManResource.class);
+
+ public class TriggerSubscriptionNotFound extends ZepException {}
+
+ private EventTriggerSubscriptionDao eventTriggerSubscriptionDao;
+ private EventSignalSpoolDao eventSignalSpoolDao;
+
+ public void setEventTriggerSubscriptionDao(EventTriggerSubscriptionDao eventTriggerSubscriptionDao) {
+ this.eventTriggerSubscriptionDao = eventTriggerSubscriptionDao;
+ }
+
+ public void setEventSignalSpoolDao(EventSignalSpoolDao eventSignalSpoolDao) {
+ this.eventSignalSpoolDao = eventSignalSpoolDao;
+ }
+
+ private String getTriggerSubscriptionUuid(String triggerUuid, String notificationUuid) throws ZepException {
+ List triggerSubscriptions =
+ this.eventTriggerSubscriptionDao.findAll();
+
+ logger.debug("Searching for " + triggerUuid + "/" + notificationUuid);
+ for (EventTriggerSubscription triggerSubscription :
+ triggerSubscriptions) {
+ logger.debug("\tComparing to " + triggerSubscription.getTriggerUuid() + "/" + triggerSubscription.getSubscriberUuid());
+
+ if ((triggerSubscription.getTriggerUuid().equals(triggerUuid)) &&
+ (triggerSubscription.getSubscriberUuid().equals(notificationUuid))) {
+ logger.debug("Found!");
+ return triggerSubscription.getUuid();
+ }
+ }
+ logger.debug("Not found!");
+ throw new TriggerSubscriptionNotFound();
+ }
+
+ @POST
+ @Path("trigger_spool")
+ @Produces({ MediaType.APPLICATION_JSON, ProtobufConstants.CONTENT_TYPE_PROTOBUF })
+ @GZIP
+ public Response insertTriggerSpool(EventDetailSet update) throws ZepException {
+ EventSignalSpool spool;
+ Map updatesByKey = new HashMap();
+
+ for (EventDetail detail : update.getDetailsList()) {
+ updatesByKey.put(detail.getName(), detail.getValue(0));
+ }
+
+ String triggerSubscriptionUuid = this.getTriggerSubscriptionUuid(
+ updatesByKey.get("trigger_uuid"), updatesByKey.get("notification_uuid"));
+
+ spool = new EventSignalSpool();
+ spool.setSubscriptionUuid(triggerSubscriptionUuid);
+ spool.setEventSummaryUuid(updatesByKey.get("event_summary_uuid"));
+ spool.setSentSignal(true);
+ spool.setCreated(System.currentTimeMillis());
+ spool.setFlushTime(Long.MAX_VALUE);
+
+ this.eventSignalSpoolDao.create(spool);
+
+ return Response.noContent().build();
+ }
+
+}
diff --git a/core/src/main/resources/zep-config-daos.xml b/core/src/main/resources/zep-config-daos.xml
index 3abbea70..fb634044 100644
--- a/core/src/main/resources/zep-config-daos.xml
+++ b/core/src/main/resources/zep-config-daos.xml
@@ -407,13 +407,6 @@
-
-
-
-
-
-
-
@@ -426,10 +419,6 @@
-
-
-
-
diff --git a/core/src/main/resources/zep-config-rest.xml b/core/src/main/resources/zep-config-rest.xml
index bf1321ea..e18e8fe0 100644
--- a/core/src/main/resources/zep-config-rest.xml
+++ b/core/src/main/resources/zep-config-rest.xml
@@ -40,6 +40,9 @@
-
+
+
+
+
diff --git a/dist/pom.xml b/dist/pom.xml
index 841d3f03..f48ac6f1 100644
--- a/dist/pom.xml
+++ b/dist/pom.xml
@@ -13,7 +13,7 @@
org.zenoss.zep
zep-parent
- 2.8.1
+ 2.8.2
../pom.xml
@@ -64,6 +64,13 @@
jar
provided
+
+ org.eclipse.jetty
+ jetty-jmx
+ ${jetty.version}
+ jar
+ provided
+
ch.qos.logback
logback-core
diff --git a/dist/src/assembly/bin/zeneventserver-functions.sh b/dist/src/assembly/bin/zeneventserver-functions.sh
index 3d1d9c1b..4301e11e 100755
--- a/dist/src/assembly/bin/zeneventserver-functions.sh
+++ b/dist/src/assembly/bin/zeneventserver-functions.sh
@@ -14,6 +14,11 @@ JETTYSTART_JAR=`ls -1 ${JETTY_HOME}/lib/jetty-start*.jar`
JETTY_ARGS="--module=centralized-webapp-logging,http,ext"
PS="ps"
+[ -n "$JETTY_MODULES" ] && {
+ JETTY_ARGS="$JETTY_ARGS,$JETTY_MODULES";
+ echo "Additional modules added for jetty startup: $JETTY_ARGS";
+ }
+
# Add --add-opens args to open modules to pre-module code.
OPEN_PACKAGES="java.base/java.lang java.base/java.nio java.base/java.io"
for pkg in ${OPEN_PACKAGES}; do
@@ -307,6 +312,8 @@ Usage: $0 {start|stop|restart|status|run|run_quiet|threads} [options]
threads - display thread status to stdout
+ for running jetty with additional modules export JETTY_MODULES variable, eg JETTY_MODULES="jmx,jmx-remote"
+
HELP
exit 1
esac
diff --git a/dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx-remote.xml b/dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx-remote.xml
new file mode 100644
index 00000000..99ae64eb
--- /dev/null
+++ b/dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx-remote.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+ rmi
+
+
+ /jndi/rmi://:/jmxrmi
+
+
+ org.eclipse.jetty.jmx:name=jmxconnectorserver
+
+
+
+
diff --git a/dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx.xml b/dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx.xml
new file mode 100644
index 00000000..25a2120c
--- /dev/null
+++ b/dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dist/src/assembly/modules/jmx-remote.mod b/dist/src/assembly/modules/jmx-remote.mod
new file mode 100644
index 00000000..e0850ad1
--- /dev/null
+++ b/dist/src/assembly/modules/jmx-remote.mod
@@ -0,0 +1,26 @@
+[description]
+Enables clear-text remote RMI access to platform MBeans.
+
+[depend]
+jmx
+
+[xml]
+etc/zeneventserver/jetty/jetty-jmx-remote.xml
+
+[ini-template]
+# tag::documentation[]
+## The host/address to bind the RMI server to.
+# jetty.jmxremote.rmiserverhost=localhost
+
+## The port the RMI server listens to (0 means a random port is chosen).
+# jetty.jmxremote.rmiserverport=1099
+
+## The host/address to bind the RMI registry to.
+# jetty.jmxremote.rmiregistryhost=localhost
+
+## The port the RMI registry listens to.
+# jetty.jmxremote.rmiregistryport=1099
+
+## The host name exported in the RMI stub.
+-Djava.rmi.server.hostname=localhost
+# end::documentation[]
diff --git a/dist/src/assembly/modules/jmx.mod b/dist/src/assembly/modules/jmx.mod
new file mode 100644
index 00000000..4c3da3dd
--- /dev/null
+++ b/dist/src/assembly/modules/jmx.mod
@@ -0,0 +1,11 @@
+[description]
+Enables local JMX support for Jetty components.
+
+[depend]
+server
+
+[lib]
+lib/jetty-jmx-${jetty.version}.jar
+
+[xml]
+etc/zeneventserver/jetty/jetty-jmx.xml
diff --git a/dist/src/assembly/modules/server.mod b/dist/src/assembly/modules/server.mod
index 6b35f1b3..e76993a8 100644
--- a/dist/src/assembly/modules/server.mod
+++ b/dist/src/assembly/modules/server.mod
@@ -12,7 +12,7 @@ logging
bytebufferpool
[ini]
-zenoss-zep-core.version?=2.8.1
+zenoss-zep-core.version?=2.8.2-SNAPSHOT
[lib]
lib/jetty-http-${jetty.version}.jar
diff --git a/dist/src/main/assembly/zeneventserver-webapp.xml b/dist/src/main/assembly/zeneventserver-webapp.xml
index 38ce7232..5592a9ea 100644
--- a/dist/src/main/assembly/zeneventserver-webapp.xml
+++ b/dist/src/main/assembly/zeneventserver-webapp.xml
@@ -27,6 +27,7 @@
org.eclipse.jetty:jetty-servlet
org.eclipse.jetty:jetty-security
org.eclipse.jetty:jetty-util-ajax
+ org.eclipse.jetty:jetty-jmx
org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api
org.zenoss.zep:zep-core
org.slf4j:slf4j-api
diff --git a/pom.xml b/pom.xml
index 5c46519e..3a68a9b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.zenoss.zep
zep-parent
pom
- 2.8.1
+ 2.8.2
Zenoss Event Processor Parent
http://www.zenoss.com
@@ -47,7 +47,6 @@
4.2.23
3.7.1
- 3.2.1
5.1.15
1.1.7
9.0-801.jdbc4
diff --git a/webapp/pom.xml b/webapp/pom.xml
index 0a19da06..eb9643e9 100644
--- a/webapp/pom.xml
+++ b/webapp/pom.xml
@@ -13,7 +13,7 @@
org.zenoss.zep
zep-parent
- 2.8.1
+ 2.8.2
../pom.xml
@@ -152,7 +152,13 @@
${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-deploy.xml
${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-http.xml
${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-webapp.xml
+ ${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx.xml
+ ${project.basedir}/../dist/src/assembly/etc/zeneventserver/jetty/jetty-jmx-remote.xml
+
+ ${project.basedir}/../dist/src/assembly/modules/jmx.mod
+ ${project.basedir}/../dist/src/assembly/modules/jmx-remote.mod
+
/zeneventserver
true
@@ -191,6 +197,11 @@
jetty-util-ajax
${jetty.version}
+
+ org.eclipse.jetty
+ jetty-jmx
+ ${jetty.version}
+
org.eclipse.jetty.toolchain
jetty-jakarta-servlet-api