mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-22 22:13:20 +02:00
Add GameDig monitor
This commit is contained in:
parent
23a525e36a
commit
774d754b21
5
db/patch-add-gamedig-monitor.sql
Normal file
5
db/patch-add-gamedig-monitor.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD game VARCHAR(255);
|
||||||
|
COMMIT
|
756
package-lock.json
generated
756
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -85,6 +85,7 @@
|
|||||||
"express-basic-auth": "~1.2.1",
|
"express-basic-auth": "~1.2.1",
|
||||||
"express-static-gzip": "~2.1.7",
|
"express-static-gzip": "~2.1.7",
|
||||||
"form-data": "~4.0.0",
|
"form-data": "~4.0.0",
|
||||||
|
"gamedig": "^4.0.5",
|
||||||
"http-graceful-shutdown": "~3.1.7",
|
"http-graceful-shutdown": "~3.1.7",
|
||||||
"http-proxy-agent": "~5.0.0",
|
"http-proxy-agent": "~5.0.0",
|
||||||
"https-proxy-agent": "~5.0.1",
|
"https-proxy-agent": "~5.0.1",
|
||||||
|
@ -66,6 +66,7 @@ class Database {
|
|||||||
"patch-add-radius-monitor.sql": true,
|
"patch-add-radius-monitor.sql": true,
|
||||||
"patch-monitor-add-resend-interval.sql": true,
|
"patch-monitor-add-resend-interval.sql": true,
|
||||||
"patch-maintenance-table2.sql": true,
|
"patch-maintenance-table2.sql": true,
|
||||||
|
"patch-add-gamedig-monitor.sql": true,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +16,7 @@ const { CacheableDnsHttpAgent } = require("../cacheable-dns-http-agent");
|
|||||||
const { DockerHost } = require("../docker");
|
const { DockerHost } = require("../docker");
|
||||||
const Maintenance = require("./maintenance");
|
const Maintenance = require("./maintenance");
|
||||||
const { UptimeCacheList } = require("../uptime-cache-list");
|
const { UptimeCacheList } = require("../uptime-cache-list");
|
||||||
|
const Gamedig = require("gamedig");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* status:
|
* status:
|
||||||
@ -107,6 +108,7 @@ class Monitor extends BeanModel {
|
|||||||
grpcEnableTls: this.getGrpcEnableTls(),
|
grpcEnableTls: this.getGrpcEnableTls(),
|
||||||
radiusCalledStationId: this.radiusCalledStationId,
|
radiusCalledStationId: this.radiusCalledStationId,
|
||||||
radiusCallingStationId: this.radiusCallingStationId,
|
radiusCallingStationId: this.radiusCallingStationId,
|
||||||
|
game: this.game,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (includeSensitiveData) {
|
if (includeSensitiveData) {
|
||||||
@ -487,6 +489,20 @@ class Monitor extends BeanModel {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error("Server not found on Steam");
|
throw new Error("Server not found on Steam");
|
||||||
}
|
}
|
||||||
|
} else if (this.type === "gamedig") {
|
||||||
|
try {
|
||||||
|
const state = await Gamedig.query({
|
||||||
|
type: this.game,
|
||||||
|
host: this.hostname,
|
||||||
|
port: this.port
|
||||||
|
});
|
||||||
|
|
||||||
|
bean.msg = state.name;
|
||||||
|
bean.status = UP;
|
||||||
|
bean.ping = state.ping;
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error("Server is offline");
|
||||||
|
}
|
||||||
} else if (this.type === "docker") {
|
} else if (this.type === "docker") {
|
||||||
log.debug(`[${this.name}] Prepare Options for Axios`);
|
log.debug(`[${this.name}] Prepare Options for Axios`);
|
||||||
|
|
||||||
|
@ -689,6 +689,7 @@ let needSetup = false;
|
|||||||
bean.retryInterval = monitor.retryInterval;
|
bean.retryInterval = monitor.retryInterval;
|
||||||
bean.resendInterval = monitor.resendInterval;
|
bean.resendInterval = monitor.resendInterval;
|
||||||
bean.hostname = monitor.hostname;
|
bean.hostname = monitor.hostname;
|
||||||
|
bean.game = monitor.game;
|
||||||
bean.maxretries = monitor.maxretries;
|
bean.maxretries = monitor.maxretries;
|
||||||
bean.port = parseInt(monitor.port);
|
bean.port = parseInt(monitor.port);
|
||||||
bean.keyword = monitor.keyword;
|
bean.keyword = monitor.keyword;
|
||||||
|
@ -45,6 +45,9 @@
|
|||||||
<option value="steam">
|
<option value="steam">
|
||||||
{{ $t("Steam Game Server") }}
|
{{ $t("Steam Game Server") }}
|
||||||
</option>
|
</option>
|
||||||
|
<option value="gamedig">
|
||||||
|
GameDig
|
||||||
|
</option>
|
||||||
<option value="mqtt">
|
<option value="mqtt">
|
||||||
MQTT
|
MQTT
|
||||||
</option>
|
</option>
|
||||||
@ -101,16 +104,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Game -->
|
||||||
|
<!-- GameDig only -->
|
||||||
|
<div v-if="monitor.type === 'gamedig'" class="my-3">
|
||||||
|
<label for="game" class="form-label"> {{ $t("Game") }} </label>
|
||||||
|
<input id="game" v-model="monitor.game" type="text" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Hostname -->
|
<!-- Hostname -->
|
||||||
<!-- TCP Port / Ping / DNS / Steam / MQTT / Radius only -->
|
<!-- TCP Port / Ping / DNS / Steam / MQTT / Radius only -->
|
||||||
<div v-if="monitor.type === 'port' || monitor.type === 'ping' || monitor.type === 'dns' || monitor.type === 'steam' || monitor.type === 'mqtt' || monitor.type === 'radius'" class="my-3">
|
<div v-if="monitor.type === 'port' || monitor.type === 'ping' || monitor.type === 'dns' || monitor.type === 'steam' || monitor.type === 'gamedig' ||monitor.type === 'mqtt' || monitor.type === 'radius'" class="my-3">
|
||||||
<label for="hostname" class="form-label">{{ $t("Hostname") }}</label>
|
<label for="hostname" class="form-label">{{ $t("Hostname") }}</label>
|
||||||
<input id="hostname" v-model="monitor.hostname" type="text" class="form-control" :pattern="`${ipRegexPattern}|${hostnameRegexPattern}`" required>
|
<input id="hostname" v-model="monitor.hostname" type="text" class="form-control" :pattern="`${ipRegexPattern}|${hostnameRegexPattern}`" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Port -->
|
<!-- Port -->
|
||||||
<!-- For TCP Port / Steam / MQTT / Radius Type -->
|
<!-- For TCP Port / Steam / MQTT / Radius Type -->
|
||||||
<div v-if="monitor.type === 'port' || monitor.type === 'steam' || monitor.type === 'mqtt' || monitor.type === 'radius'" class="my-3">
|
<div v-if="monitor.type === 'port' || monitor.type === 'steam' || monitor.type === 'gamedig' || monitor.type === 'mqtt' || monitor.type === 'radius'" class="my-3">
|
||||||
<label for="port" class="form-label">{{ $t("Port") }}</label>
|
<label for="port" class="form-label">{{ $t("Port") }}</label>
|
||||||
<input id="port" v-model="monitor.port" type="number" class="form-control" required min="0" max="65535" step="1">
|
<input id="port" v-model="monitor.port" type="number" class="form-control" required min="0" max="65535" step="1">
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user