only update monitor status for the current monitored trigger (#135)
diff --git a/provider/lib/utils.js b/provider/lib/utils.js
index 3200189..75125d8 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -164,7 +164,7 @@
this.handleFiredTrigger = function(dataTrigger, isMonitorTrigger) {
var method = 'handleFiredTrigger';
- if (isMonitorTrigger) {
+ if (isMonitorTrigger && utils.monitorStatus.triggerName === dataTrigger.name) {
utils.monitorStatus.triggerFired = "success";
}
@@ -344,7 +344,7 @@
if (utils.triggers[triggerIdentifier]) {
if (doc.status && doc.status.active === false) {
utils.stopTrigger(triggerIdentifier);
- if (doc.monitor && doc.monitor === utils.host) {
+ if (doc.monitor && doc.monitor === utils.host && utils.monitorStatus.triggerName === doc.name) {
utils.monitorStatus.triggerStopped = "success";
}
}
@@ -357,7 +357,7 @@
utils.triggers[triggerIdentifier] = cachedTrigger;
logger.info(method, triggerIdentifier, 'created successfully');
- if (doc.monitor && doc.monitor === utils.host) {
+ if (doc.monitor && doc.monitor === utils.host && utils.monitorStatus.triggerName === cachedTrigger.name) {
utils.monitorStatus.triggerStarted = "success";
}