|
|
@ -79,6 +79,7 @@ class Monitor extends BeanModel {
|
|
|
|
type: this.type,
|
|
|
|
type: this.type,
|
|
|
|
interval: this.interval,
|
|
|
|
interval: this.interval,
|
|
|
|
retryInterval: this.retryInterval,
|
|
|
|
retryInterval: this.retryInterval,
|
|
|
|
|
|
|
|
resendInterval: this.resendInterval,
|
|
|
|
keyword: this.keyword,
|
|
|
|
keyword: this.keyword,
|
|
|
|
expiryNotification: this.isEnabledExpiryNotification(),
|
|
|
|
expiryNotification: this.isEnabledExpiryNotification(),
|
|
|
|
ignoreTls: this.getIgnoreTls(),
|
|
|
|
ignoreTls: this.getIgnoreTls(),
|
|
|
@ -214,6 +215,7 @@ class Monitor extends BeanModel {
|
|
|
|
bean.monitor_id = this.id;
|
|
|
|
bean.monitor_id = this.id;
|
|
|
|
bean.time = R.isoDateTimeMillis(dayjs.utc());
|
|
|
|
bean.time = R.isoDateTimeMillis(dayjs.utc());
|
|
|
|
bean.status = DOWN;
|
|
|
|
bean.status = DOWN;
|
|
|
|
|
|
|
|
bean.downCount = previousBeat?.downCount || 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (this.isUpsideDown()) {
|
|
|
|
if (this.isUpsideDown()) {
|
|
|
|
bean.status = flipStatus(bean.status);
|
|
|
|
bean.status = flipStatus(bean.status);
|
|
|
@ -594,12 +596,27 @@ class Monitor extends BeanModel {
|
|
|
|
log.debug("monitor", `[${this.name}] sendNotification`);
|
|
|
|
log.debug("monitor", `[${this.name}] sendNotification`);
|
|
|
|
await Monitor.sendNotification(isFirstBeat, this, bean);
|
|
|
|
await Monitor.sendNotification(isFirstBeat, this, bean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reset down count
|
|
|
|
|
|
|
|
bean.downCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// Clear Status Page Cache
|
|
|
|
// Clear Status Page Cache
|
|
|
|
log.debug("monitor", `[${this.name}] apicache clear`);
|
|
|
|
log.debug("monitor", `[${this.name}] apicache clear`);
|
|
|
|
apicache.clear();
|
|
|
|
apicache.clear();
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
bean.important = false;
|
|
|
|
bean.important = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bean.status === DOWN && this.resendInterval > 0) {
|
|
|
|
|
|
|
|
++bean.downCount;
|
|
|
|
|
|
|
|
if (bean.downCount >= this.resendInterval) {
|
|
|
|
|
|
|
|
// Send notification again, because we are still DOWN
|
|
|
|
|
|
|
|
log.debug("monitor", `[${this.name}] sendNotification again: Down Count: ${bean.downCount} | Resend Interval: ${this.resendInterval}`);
|
|
|
|
|
|
|
|
await Monitor.sendNotification(isFirstBeat, this, bean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reset down count
|
|
|
|
|
|
|
|
bean.downCount = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bean.status === UP) {
|
|
|
|
if (bean.status === UP) {
|
|
|
@ -610,7 +627,7 @@ class Monitor extends BeanModel {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log.warn("monitor", `Monitor #${this.id} '${this.name}': Pending: ${bean.msg} | Max retries: ${this.maxretries} | Retry: ${retries} | Retry Interval: ${beatInterval} seconds | Type: ${this.type}`);
|
|
|
|
log.warn("monitor", `Monitor #${this.id} '${this.name}': Pending: ${bean.msg} | Max retries: ${this.maxretries} | Retry: ${retries} | Retry Interval: ${beatInterval} seconds | Type: ${this.type}`);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.warn("monitor", `Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Interval: ${beatInterval} seconds | Type: ${this.type}`);
|
|
|
|
log.warn("monitor", `Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Interval: ${beatInterval} seconds | Type: ${this.type} | Down Count: ${bean.downCount} | Resend Interval: ${this.resendInterval}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log.debug("monitor", `[${this.name}] Send to socket`);
|
|
|
|
log.debug("monitor", `[${this.name}] Send to socket`);
|
|
|
|