diff --git a/db/patch7.sql b/db/patch7.sql
index 2e8eba1..4085daf 100644
--- a/db/patch7.sql
+++ b/db/patch7.sql
@@ -7,4 +7,7 @@ ALTER TABLE monitor
ALTER TABLE monitor
ADD dns_resolve_server VARCHAR(255);
+ALTER TABLE monitor
+ ADD dns_last_result VARCHAR(255);
+
COMMIT;
diff --git a/server/model/monitor.js b/server/model/monitor.js
index f5efadc..a01dd61 100644
--- a/server/model/monitor.js
+++ b/server/model/monitor.js
@@ -50,6 +50,7 @@ class Monitor extends BeanModel {
accepted_statuscodes: this.getAcceptedStatuscodes(),
dns_resolve_type: this.dns_resolve_type,
dns_resolve_server: this.dns_resolve_server,
+ dns_last_result: this.dns_last_result,
notificationIDList,
};
}
@@ -207,6 +208,17 @@ class Monitor extends BeanModel {
dnsMessage = dnsMessage.slice(0, -2)
}
+ let dnsLastResult = await R.findOne("monitor", "id = ?", [
+ this.id,
+ ]);
+
+ if (dnsLastResult.dnsLastResult !== dnsMessage) {
+ R.exec("UPDATE `monitor` SET dns_last_result = ? WHERE id = ? ", [
+ dnsMessage,
+ this.id
+ ]);
+ }
+
bean.msg = dnsMessage;
bean.status = UP;
}
diff --git a/src/pages/Details.vue b/src/pages/Details.vue
index f06f9e1..8da1112 100644
--- a/src/pages/Details.vue
+++ b/src/pages/Details.vue
@@ -10,7 +10,7 @@
{{ $t("Keyword") }}: {{ monitor.keyword }}
- [{{ monitor.dns_resolve_type }}] {{ monitor.hostname }}
+ [{{ monitor.dns_resolve_type }}] {{ monitor.hostname }} [ {{ monitor.dns_last_result }} ]