Permalink
Browse files

0002547: Notification of system event problems

  • Loading branch information...
erilong committed Apr 4, 2016
1 parent eca5950 commit d325b0cb6ab447d11c12afcdd246af7bad181129
Showing with 1,409 additions and 4 deletions.
  1. +1 −0 symmetric-assemble/build.gradle
  2. +1 −0 symmetric-assemble/src/asciidoc/configuration.ad
  3. +18 −0 symmetric-assemble/src/asciidoc/configuration/mail-server.ad
  4. +1 −1 symmetric-client/src/main/java/org/jumpmind/symmetric/job/JobManager.java
  5. +44 −0 symmetric-client/src/main/java/org/jumpmind/symmetric/job/NotificationJob.java
  6. +20 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/AbstractSymmetricEngine.java
  7. +6 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/ISymmetricEngine.java
  8. +10 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/common/ParameterConstants.java
  9. +3 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/common/TableConstants.java
  10. +160 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/model/Notification.java
  11. +107 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/model/NotificationEvent.java
  12. +71 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/AbstractNotificationCheck.java
  13. +36 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/INotificationCheck.java
  14. +84 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/NotificationCheckBatchError.java
  15. +57 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/NotificationCheckBatchUnsent.java
  16. +108 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/NotificationCheckCpu.java
  17. +58 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/NotificationCheckDataGap.java
  18. +58 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/NotificationCheckDisk.java
  19. +99 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/NotificationCheckMemory.java
  20. +57 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/notification/NotificationCheckUnrouted.java
  21. +1 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/ClusterConstants.java
  22. +2 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/IDataService.java
  23. +11 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/IMailService.java
  24. +40 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/INotificationService.java
  25. +4 −1 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataService.java
  26. +2 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataServiceSqlMap.java
  27. +144 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/MailService.java
  28. +140 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/NotificationService.java
  29. +50 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/NotificationServiceSqlMap.java
  30. +16 −0 symmetric-core/src/main/resources/symmetric-schema.xml
@@ -127,6 +127,7 @@ project(':symmetric-core') {
compile project(":symmetric-io")
compile project(":symmetric-util")
compile "commons-fileupload:commons-fileupload:$commonsFileuploadVersion"
compile "javax.mail:mail:1.4.5"
testCompile project(path: ':symmetric-util', configuration: 'testArtifacts')
testCompile project(path: ':symmetric-jdbc', configuration: 'testArtifacts')
}
@@ -43,5 +43,6 @@ include::configuration/parameters.ad[]
ifdef::pro[]
include::configuration/users.ad[]
include::configuration/ldap.ad[]
include::configuration/mail-server.ad[]
include::configuration/license-key.ad[]
endif::pro[]
@@ -0,0 +1,18 @@
=== Mail Server
A mail server can be configured for sending email notifications.
Target Nodes:: The node group ID that will use this configuration.
Hostname:: The hostname or IP address of the mail server to contact for sending mail.
Transport:: The transport mechanism is either SMTP (Simple Mail Transfer Protocol) or SMTPS (encrypted with SSL).
Port:: The default port for SMTP is 25, while the default port for SMTPS is 465.
Use StartTLS:: After connecting over SMTP, the TLS protocol is used to encrypt content.
Use Authentication:: The mail server requires a login and password before email can be sent.
User:: The user login to use for authentication.
Password:: The login password to use for authentication.
ifdef::pro[]
The "Test" button will use the current settings on the screen to connect to the mail server with the configured
transport and report any errors.
endif::pro[]
@@ -64,7 +64,7 @@ public JobManager(ISymmetricEngine engine) {
this.jobs.add(new FileSyncPullJob(engine,taskScheduler));
this.jobs.add(new FileSyncPushJob(engine,taskScheduler));
this.jobs.add(new InitialLoadExtractorJob(engine,taskScheduler));
this.jobs.add(new NotificationJob(engine, taskScheduler));
}
public IJob getJob(String name) {
@@ -0,0 +1,44 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* 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.jumpmind.symmetric.job;
import org.jumpmind.symmetric.ISymmetricEngine;
import org.jumpmind.symmetric.service.ClusterConstants;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
public class NotificationJob extends AbstractJob {
public NotificationJob(ISymmetricEngine engine, ThreadPoolTaskScheduler taskScheduler) {
super("job.notification", true, engine.getParameterService().is("start.notification.job"), engine, taskScheduler);
}
@Override
public void doJob(boolean force) throws Exception {
if (engine != null) {
engine.getNotificationService().update();
}
}
public String getClusterLockName() {
return ClusterConstants.NOTIFICATION;
}
}
@@ -79,8 +79,10 @@
import org.jumpmind.symmetric.service.IGroupletService;
import org.jumpmind.symmetric.service.IIncomingBatchService;
import org.jumpmind.symmetric.service.ILoadFilterService;
import org.jumpmind.symmetric.service.IMailService;
import org.jumpmind.symmetric.service.INodeCommunicationService;
import org.jumpmind.symmetric.service.INodeService;
import org.jumpmind.symmetric.service.INotificationService;
import org.jumpmind.symmetric.service.IOfflinePullService;
import org.jumpmind.symmetric.service.IOfflinePushService;
import org.jumpmind.symmetric.service.IOutgoingBatchService;
@@ -106,8 +108,10 @@
import org.jumpmind.symmetric.service.impl.GroupletService;
import org.jumpmind.symmetric.service.impl.IncomingBatchService;
import org.jumpmind.symmetric.service.impl.LoadFilterService;
import org.jumpmind.symmetric.service.impl.MailService;
import org.jumpmind.symmetric.service.impl.NodeCommunicationService;
import org.jumpmind.symmetric.service.impl.NodeService;
import org.jumpmind.symmetric.service.impl.NotificationService;
import org.jumpmind.symmetric.service.impl.OfflinePullService;
import org.jumpmind.symmetric.service.impl.OfflinePushService;
import org.jumpmind.symmetric.service.impl.OutgoingBatchService;
@@ -219,7 +223,11 @@
protected INodeCommunicationService nodeCommunicationService;
protected IFileSyncService fileSyncService;
protected IFileSyncService fileSyncService;
protected INotificationService notificationService;
protected IMailService mailService;
protected Date lastRestartTime = null;
@@ -344,6 +352,8 @@ protected void init() {
nodeService, dataLoaderService, clusterService, nodeCommunicationService,
configurationService, extensionService, offlineTransportManager);
this.fileSyncService = new FileSyncService(this);
this.notificationService = new NotificationService(parameterService, symmetricDialect, extensionService);
this.mailService = new MailService(parameterService, symmetricDialect);
this.jobManager = createJobManager();
extensionService.addExtensionPoint(new DefaultOfflineServerListener(
@@ -1044,6 +1054,14 @@ public IExtensionService getExtensionService() {
return extensionService;
}
public INotificationService getNotificationService() {
return notificationService;
}
public IMailService getMailService() {
return mailService;
}
public IStagingManager getStagingManager() {
return stagingManager;
}
@@ -1059,7 +1077,7 @@ public INodeCommunicationService getNodeCommunicationService() {
public IGroupletService getGroupletService() {
return groupletService;
}
private void removeMeFromMap(Map<String, ISymmetricEngine> map) {
Set<String> keys = new HashSet<String>(map.keySet());
for (String key : keys) {
@@ -45,8 +45,10 @@
import org.jumpmind.symmetric.service.IGroupletService;
import org.jumpmind.symmetric.service.IIncomingBatchService;
import org.jumpmind.symmetric.service.ILoadFilterService;
import org.jumpmind.symmetric.service.IMailService;
import org.jumpmind.symmetric.service.INodeCommunicationService;
import org.jumpmind.symmetric.service.INodeService;
import org.jumpmind.symmetric.service.INotificationService;
import org.jumpmind.symmetric.service.IOfflinePullService;
import org.jumpmind.symmetric.service.IOfflinePushService;
import org.jumpmind.symmetric.service.IOutgoingBatchService;
@@ -289,6 +291,10 @@
public IExtensionService getExtensionService();
public INotificationService getNotificationService();
public IMailService getMailService();
public IStagingManager getStagingManager();
public ISqlTemplate getSqlTemplate();
@@ -56,6 +56,7 @@ private ParameterConstants() {
public final static String START_STATISTIC_FLUSH_JOB = "start.stat.flush.job";
public final static String START_STAGE_MGMT_JOB = "start.stage.management.job";
public final static String START_WATCHDOG_JOB = "start.watchdog.job";
public final static String START_NOTIFICATION_JOB = "start.notification.job";
public final static String PULL_THREAD_COUNT_PER_SERVER = "pull.thread.per.server.count";
public final static String PULL_MINIMUM_PERIOD_MS = "pull.period.minimum.ms";
@@ -311,6 +312,15 @@ private ParameterConstants() {
public final static String DATA_CREATE_TIME_TIMEZONE = "data.create_time.timezone";
public static final String SMTP_HOST = "smtp.host";
public static final String SMTP_TRANSPORT = "smtp.transport";
public static final String SMTP_PORT = "smtp.port";
public static final String SMTP_FROM = "smtp.from";
public static final String SMTP_USER = "smtp.user";
public static final String SMTP_PASSWORD = "smtp.password";
public static final String SMTP_USE_STARTTLS = "smtp.starttls";
public static final String SMTP_USE_AUTH = "smtp.auth";
public static Map<String, ParameterMetaData> getParameterMetaData() {
return parameterMetaData;
}
@@ -73,6 +73,7 @@
public static final String SYM_FILE_INCOMING = "file_incoming";
public static final String SYM_CONSOLE_USER = "console_user";
public static final String SYM_EXTENSION = "extension";
public static final String SYM_NOTIFICATION = "notification";
private static List<String> tablesWithPrefix;
@@ -127,6 +128,7 @@
configTables.add(getTableName(tablePrefix, TableConstants.SYM_FILE_SNAPSHOT));
configTables.add(getTableName(tablePrefix, TableConstants.SYM_NODE_IDENTITY));
configTables.add(getTableName(tablePrefix, TableConstants.SYM_EXTENSION));
configTables.add(getTableName(tablePrefix, TableConstants.SYM_NOTIFICATION));
return configTables;
}
@@ -175,6 +177,7 @@
tables.add(getTableName(tablePrefix, TableConstants.SYM_FILE_SNAPSHOT));
tables.add(getTableName(tablePrefix, TableConstants.SYM_FILE_INCOMING));
tables.add(getTableName(tablePrefix, SYM_EXTENSION));
tables.add(getTableName(tablePrefix, SYM_NOTIFICATION));
return tables;
}
@@ -0,0 +1,160 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* 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.jumpmind.symmetric.model;
import java.util.Date;
public class Notification {
protected String notificationId;
protected String externalId;
protected String nodeGroupId;
protected String type;
protected boolean enabled;
protected long threshold;
protected int period;
protected int sampleMinutes;
protected int severityLevel;
protected long windowMinutes;
protected Date createTime;
protected String lastUpdateBy;
protected Date lastUpdateTime;
public String getNotificationId() {
return notificationId;
}
public Notification() {
}
public void setNotificationId(String notificationId) {
this.notificationId = notificationId;
}
public String getExternalId() {
return externalId;
}
public void setExternalId(String externalId) {
this.externalId = externalId;
}
public String getNodeGroupId() {
return nodeGroupId;
}
public void setNodeGroupId(String nodeGroupId) {
this.nodeGroupId = nodeGroupId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public long getThreshold() {
return threshold;
}
public void setThreshold(long threshhold) {
this.threshold = threshhold;
}
public int getPeriod() {
return period;
}
public void setPeriod(int period) {
this.period = period;
}
public int getSampleMinutes() {
return sampleMinutes;
}
public void setSampleMinutes(int sampleMinutes) {
this.sampleMinutes = sampleMinutes;
}
public int getSeverityLevel() {
return severityLevel;
}
public void setSeverityLevel(int severityLevel) {
this.severityLevel = severityLevel;
}
public long getWindowMinutes() {
return windowMinutes;
}
public void setWindowMinutes(long windowMinutes) {
this.windowMinutes = windowMinutes;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getLastUpdateBy() {
return lastUpdateBy;
}
public void setLastUpdateBy(String lastUpdateBy) {
this.lastUpdateBy = lastUpdateBy;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
}
Oops, something went wrong.

0 comments on commit d325b0c

Please sign in to comment.