diff --git a/server/model/monitor.js b/server/model/monitor.js index 01e9e4ae4..7e5495330 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -348,13 +348,13 @@ class Monitor extends BeanModel { } try { - let hostname = this.hostname; + let HostnameOrIp = this.hostname; if (this.type === "ping" || this.type === "port" ) { try { - hostname = await lookup(this.hostname, this.ipFamily); + HostnameOrIp = await lookup(this.hostname, this.ipFamily); } catch (err) { log.debug("monitor", err); - hostname = null; + HostnameOrIp = null; } } @@ -587,12 +587,12 @@ class Monitor extends BeanModel { } } else if (this.type === "port") { - bean.ping = await tcping(hostname, this.port); + bean.ping = await tcping(HostnameOrIp, this.port); bean.msg = ""; bean.status = UP; } else if (this.type === "ping") { - bean.ping = await ping(hostname, this.packetSize); + bean.ping = await ping(HostnameOrIp, this.packetSize); bean.msg = ""; bean.status = UP; } else if (this.type === "push") { // Type: Push diff --git a/server/server.js b/server/server.js index 9be8e2ad8..a30d9e86e 100644 --- a/server/server.js +++ b/server/server.js @@ -1559,7 +1559,6 @@ let needSetup = false; dns_resolve_server: monitorListData[i].dns_resolve_server, notificationIDList: monitorListData[i].notificationIDList, proxy_id: monitorListData[i].proxy_id || null, - ipFamily: monitorListData[i].ipFamily, }; if (monitorListData[i].pushToken) {