Skip to content

Commit

Permalink
0005863: Added option to send additional batch error notifications wh…
Browse files Browse the repository at this point in the history
…en the number of batches in error increases
  • Loading branch information
evan-miller-jumpmind committed Jun 1, 2023
1 parent 0a8f84e commit 3701344
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions symmetric-assemble/src/asciidoc/configuration/monitors.ad
Expand Up @@ -56,6 +56,8 @@ endif::pro[]

|===

Expression:: An expression used by the monitor to set options specific to the monitor type. For batchError monitors, setting the expression to
"notifyOnIncrease=true" will trigger an additional notification if the number of batches in error has increased since the last time the monitor job ran.
Threshold:: When this threshold value is reached or exceeded, an event is recorded.
Run Period:: The time in seconds of how often to run this monitor. The monitor job runs on a period also, so the monitor can only run as often
as the monitor job.
Expand Down
Expand Up @@ -230,6 +230,10 @@ protected void updateMonitor(Monitor monitor, IMonitorType monitorType, Node ide
} else {
event.setHostName(hostName);
event.setType(monitor.getType());
if (monitor.getType().equals("batchError") && monitor.getExpression() != null
&& monitor.getExpression().equals("notifyOnIncrease=true") && eventValue.getValue() > event.getValue()) {
event.setNotified(false);
}
event.setValue(eventValue.getValue());
if (eventValue.getCount() == 0) {
event.setCount(event.getCount() + 1);
Expand Down Expand Up @@ -368,8 +372,8 @@ protected void insertMonitorEvent(MonitorEvent event) {

protected boolean updateMonitorEvent(MonitorEvent event) {
int count = sqlTemplate.update(getSql("updateMonitorEventSql"), event.getHostName(), event.getType(), event.getValue(),
event.getCount(), event.getThreshold(), event.getSeverityLevel(), event.getLastUpdateTime(),
event.getDetails(), event.getMonitorId(), event.getNodeId(), event.getEventTime());
event.getCount(), event.getThreshold(), event.getSeverityLevel(), event.isNotified() ? 1 : 0,
event.getLastUpdateTime(), event.getDetails(), event.getMonitorId(), event.getNodeId(), event.getEventTime());
return count != 0;
}

Expand Down
Expand Up @@ -74,7 +74,7 @@ public MonitorServiceSqlMap(IDatabasePlatform platform, Map<String, String> repl
"values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
putSql("updateMonitorEventSql",
"update $(monitor_event) set host_name = ?, " + type + " = ?, event_value = ?, event_count = ?, threshold = ?, severity_level = ?, " +
"is_resolved = 0, last_update_time = ?, details = ? where monitor_id = ? and node_id = ? and event_time = ?");
"is_resolved = 0, is_notified = ?, last_update_time = ?, details = ? where monitor_id = ? and node_id = ? and event_time = ?");
putSql("updateMonitorEventResolvedSql",
"update $(monitor_event) set is_resolved = 1, is_notified = 0, last_update_time = ? where monitor_id = ? and node_id = ? and event_time = ?");
putSql("updateMonitorEventNotifiedSql",
Expand Down

0 comments on commit 3701344

Please sign in to comment.