mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-16 03:04:40 -05:00
Add ability to connect to daemon via http / tcp for windows compatibility
This commit is contained in:
parent
4818bb67d6
commit
29df70949d
@ -7,4 +7,7 @@ ALTER TABLE monitor
|
|||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD docker_container VARCHAR(255);
|
ADD docker_container VARCHAR(255);
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD docker_type VARCHAR(255);
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -79,6 +79,7 @@ class Monitor extends BeanModel {
|
|||||||
pushToken: this.pushToken,
|
pushToken: this.pushToken,
|
||||||
docker_container: this.docker_container,
|
docker_container: this.docker_container,
|
||||||
docker_daemon: this.docker_daemon,
|
docker_daemon: this.docker_daemon,
|
||||||
|
docker_type: this.docker_type,
|
||||||
notificationIDList,
|
notificationIDList,
|
||||||
tags: tags,
|
tags: tags,
|
||||||
};
|
};
|
||||||
@ -358,13 +359,18 @@ class Monitor extends BeanModel {
|
|||||||
"Accept": "*/*",
|
"Accept": "*/*",
|
||||||
"User-Agent": "Uptime-Kuma/" + version,
|
"User-Agent": "Uptime-Kuma/" + version,
|
||||||
},
|
},
|
||||||
socketPath: this.docker_daemon,
|
|
||||||
httpsAgent: new https.Agent({
|
httpsAgent: new https.Agent({
|
||||||
maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940)
|
maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940)
|
||||||
rejectUnauthorized: ! this.getIgnoreTls(),
|
rejectUnauthorized: ! this.getIgnoreTls(),
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.docker_type === "socket") {
|
||||||
|
options.socketPath = this.docker_daemon;
|
||||||
|
} else if (this.docker_type === "tcp") {
|
||||||
|
options.baseURL = this.docker_daemon;
|
||||||
|
}
|
||||||
|
|
||||||
debug(`[${this.name}] Axios Request`);
|
debug(`[${this.name}] Axios Request`);
|
||||||
let res = await axios.request(options);
|
let res = await axios.request(options);
|
||||||
if (res.data.State.Running) {
|
if (res.data.State.Running) {
|
||||||
|
@ -590,6 +590,7 @@ exports.entryPage = "dashboard";
|
|||||||
bean.pushToken = monitor.pushToken;
|
bean.pushToken = monitor.pushToken;
|
||||||
bean.docker_container = monitor.docker_container;
|
bean.docker_container = monitor.docker_container;
|
||||||
bean.docker_daemon = monitor.docker_daemon;
|
bean.docker_daemon = monitor.docker_daemon;
|
||||||
|
bean.docker_type = monitor.docker_type;
|
||||||
|
|
||||||
await R.store(bean);
|
await R.store(bean);
|
||||||
|
|
||||||
|
@ -364,4 +364,7 @@ export default {
|
|||||||
"Container Name / ID": "Container Name / ID",
|
"Container Name / ID": "Container Name / ID",
|
||||||
"Docker Daemon": "Docker Daemon",
|
"Docker Daemon": "Docker Daemon",
|
||||||
"Docker Container": "Docker Container",
|
"Docker Container": "Docker Container",
|
||||||
|
"Docker Type": "Connection Type",
|
||||||
|
docker_socket: "Socket",
|
||||||
|
docker_tcp: "TCP / HTTP",
|
||||||
};
|
};
|
||||||
|
@ -125,6 +125,20 @@
|
|||||||
<input id="docker_container" v-model="monitor.docker_container" type="text" class="form-control" required>
|
<input id="docker_container" v-model="monitor.docker_container" type="text" class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Docker Connection Type -->
|
||||||
|
<!-- For Docker Type -->
|
||||||
|
<div v-if="monitor.type === 'docker'" class="my-3">
|
||||||
|
<label for="docker_type" class="form-label">{{ $t("Docker Type") }}</label>
|
||||||
|
<select id="docker_type" v-model="monitor.docker_type" class="form-select">
|
||||||
|
<option value="socket">
|
||||||
|
{{ $t("docker_socket") }}
|
||||||
|
</option>
|
||||||
|
<option value="tcp">
|
||||||
|
{{ $t("docker_tcp") }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Docker Daemon -->
|
<!-- Docker Daemon -->
|
||||||
<!-- For Docker Type -->
|
<!-- For Docker Type -->
|
||||||
<div v-if="monitor.type === 'docker'" class="my-3">
|
<div v-if="monitor.type === 'docker'" class="my-3">
|
||||||
@ -458,6 +472,7 @@ export default {
|
|||||||
dns_resolve_server: "1.1.1.1",
|
dns_resolve_server: "1.1.1.1",
|
||||||
docker_container: "",
|
docker_container: "",
|
||||||
docker_daemon: "/var/run/docker.sock",
|
docker_daemon: "/var/run/docker.sock",
|
||||||
|
docker_type: "socket",
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let i = 0; i < this.$root.notificationList.length; i++) {
|
for (let i = 0; i < this.$root.notificationList.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user