mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-05 04:42:34 +02:00
Initial commit
This commit is contained in:
parent
0254e72177
commit
346f7806f4
3 changed files with 49 additions and 3 deletions
34
server/monitor-types/pterodactyl-node.js
Normal file
34
server/monitor-types/pterodactyl-node.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
const { MonitorType } = require("./monitor-type");
|
||||
const { UP } = require("../../src/util");
|
||||
const axios = require("axios");
|
||||
|
||||
class PterodactylNode extends MonitorType {
|
||||
name = "pterodactyl-node";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async check(monitor, heartbeat, server) {
|
||||
|
||||
await axios.get(`${monitor.nodeHost}/api/system`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${monitor.apiKey}`
|
||||
}
|
||||
})
|
||||
.then(async res => {
|
||||
if (res.status === 200) {
|
||||
const data = await res.json();
|
||||
heartbeat.msg = `Node is up, Version ${data.version}`;
|
||||
heartbeat.status = UP;
|
||||
} else {
|
||||
throw Error(`Node is down, Status ${res.status}`);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
PterodactylNode,
|
||||
};
|
|
@ -116,6 +116,7 @@ class UptimeKumaServer {
|
|||
UptimeKumaServer.monitorTypeList["snmp"] = new SNMPMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["mongodb"] = new MongodbMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["rabbitmq"] = new RabbitMqMonitorType();
|
||||
UptimeKumaServer.monitorTypeList["pterodactyl-node"] = new PterodactylNode();
|
||||
|
||||
// Allow all CORS origins (polling) in development
|
||||
let cors = undefined;
|
||||
|
@ -554,4 +555,5 @@ const { MqttMonitorType } = require("./monitor-types/mqtt");
|
|||
const { SNMPMonitorType } = require("./monitor-types/snmp");
|
||||
const { MongodbMonitorType } = require("./monitor-types/mongodb");
|
||||
const { RabbitMqMonitorType } = require("./monitor-types/rabbitmq");
|
||||
const { PterodactylNode } = require("./monitor-types/pterodactyl-node");
|
||||
const Monitor = require("./model/monitor");
|
||||
|
|
|
@ -91,6 +91,9 @@
|
|||
<option v-if="!$root.info.isContainer" value="tailscale-ping">
|
||||
Tailscale Ping
|
||||
</option>
|
||||
<option value="pterodactyl-node">
|
||||
Pterodactyl Node
|
||||
</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
<i18n-t v-if="monitor.type === 'rabbitmq'" keypath="rabbitmqHelpText" tag="div" class="form-text">
|
||||
|
@ -282,7 +285,7 @@
|
|||
|
||||
<!-- Hostname -->
|
||||
<!-- TCP Port / Ping / DNS / Steam / MQTT / Radius / Tailscale Ping / SNMP only -->
|
||||
<div v-if="monitor.type === 'port' || monitor.type === 'ping' || monitor.type === 'dns' || monitor.type === 'steam' || monitor.type === 'gamedig' || monitor.type === 'mqtt' || monitor.type === 'radius' || monitor.type === 'tailscale-ping' || monitor.type === 'snmp'" 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' || monitor.type === 'tailscale-ping' || monitor.type === 'snmp' || monitor.type === 'pterodactyl-node'" class="my-3">
|
||||
<label for="hostname" class="form-label">{{ $t("Hostname") }}</label>
|
||||
<input
|
||||
id="hostname"
|
||||
|
@ -297,7 +300,7 @@
|
|||
|
||||
<!-- Port -->
|
||||
<!-- For TCP Port / Steam / MQTT / Radius Type / SNMP -->
|
||||
<div v-if="monitor.type === 'port' || monitor.type === 'steam' || monitor.type === 'gamedig' || monitor.type === 'mqtt' || monitor.type === 'radius' || monitor.type === 'snmp'" class="my-3">
|
||||
<div v-if="monitor.type === 'port' || monitor.type === 'steam' || monitor.type === 'gamedig' || monitor.type === 'mqtt' || monitor.type === 'radius' || monitor.type === 'snmp' || monitor.type === 'pterodactyl-node'" class="my-3">
|
||||
<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">
|
||||
</div>
|
||||
|
@ -601,6 +604,12 @@
|
|||
<input id="timeout" v-model="monitor.timeout" type="number" class="form-control" required min="0" step="0.1">
|
||||
</div>
|
||||
|
||||
<!-- ApiKey: Pterodactyl node only -->
|
||||
<div v-if="monitor.type === 'pterodactyl-node'" class="my-3">
|
||||
<label for="apiKey" class="form-label">{{ $t("API Key") }}</label>
|
||||
<HiddenInput id="apiKey" v-model="monitor.apiKey" type="password" required></HiddenInput>
|
||||
</div>
|
||||
|
||||
<div class="my-3">
|
||||
<label for="resend-interval" class="form-label">
|
||||
{{ $t("Resend Notification if Down X times consecutively") }}
|
||||
|
@ -1111,7 +1120,8 @@ const monitorDefaults = {
|
|||
rabbitmqNodes: [],
|
||||
rabbitmqUsername: "",
|
||||
rabbitmqPassword: "",
|
||||
conditions: []
|
||||
conditions: [],
|
||||
apiKey: "",
|
||||
};
|
||||
|
||||
export default {
|
||||
|
|
Loading…
Add table
Reference in a new issue