mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-30 18:24:03 +00:00
Compare commits
1 commit
d30ca46c26
...
eb7ff76807
Author | SHA1 | Date | |
---|---|---|---|
|
eb7ff76807 |
14 changed files with 7 additions and 300 deletions
|
@ -1,17 +0,0 @@
|
||||||
exports.up = function (knex) {
|
|
||||||
return knex.schema.alterTable("monitor", function (table) {
|
|
||||||
table.text("rabbitmq_nodes");
|
|
||||||
table.string("rabbitmq_username");
|
|
||||||
table.string("rabbitmq_password");
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.down = function (knex) {
|
|
||||||
return knex.schema.alterTable("monitor", function (table) {
|
|
||||||
table.dropColumn("rabbitmq_nodes");
|
|
||||||
table.dropColumn("rabbitmq_username");
|
|
||||||
table.dropColumn("rabbitmq_password");
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
17
package-lock.json
generated
17
package-lock.json
generated
|
@ -93,7 +93,6 @@
|
||||||
"@playwright/test": "~1.39.0",
|
"@playwright/test": "~1.39.0",
|
||||||
"@popperjs/core": "~2.10.2",
|
"@popperjs/core": "~2.10.2",
|
||||||
"@testcontainers/hivemq": "^10.13.1",
|
"@testcontainers/hivemq": "^10.13.1",
|
||||||
"@testcontainers/rabbitmq": "^10.13.2",
|
|
||||||
"@types/bootstrap": "~5.1.9",
|
"@types/bootstrap": "~5.1.9",
|
||||||
"@types/node": "^20.8.6",
|
"@types/node": "^20.8.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||||
|
@ -4173,15 +4172,6 @@
|
||||||
"testcontainers": "^10.13.1"
|
"testcontainers": "^10.13.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@testcontainers/rabbitmq": {
|
|
||||||
"version": "10.13.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@testcontainers/rabbitmq/-/rabbitmq-10.13.2.tgz",
|
|
||||||
"integrity": "sha512-npBKBnq3c6hETmxGZ/gVMke9cc1J/pcftNW9S3WidL48hxFBIPjYNM9FdTfWuoNER/8kuf4xJ8yCuJEYGH3ZAg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"testcontainers": "^10.13.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@tootallnate/once": {
|
"node_modules/@tootallnate/once": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
|
||||||
|
@ -15935,10 +15925,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/testcontainers": {
|
"node_modules/testcontainers": {
|
||||||
"version": "10.13.2",
|
"version": "10.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/testcontainers/-/testcontainers-10.13.2.tgz",
|
"resolved": "https://registry.npmjs.org/testcontainers/-/testcontainers-10.13.1.tgz",
|
||||||
"integrity": "sha512-LfEll+AG/1Ks3n4+IA5lpyBHLiYh/hSfI4+ERa6urwfQscbDU+M2iW1qPQrHQi+xJXQRYy4whyK1IEHdmxWa3Q==",
|
"integrity": "sha512-JBbOhxmygj/ouH/47GnoVNt+c55Telh/45IjVxEbDoswsLchVmJiuKiw/eF6lE5i7LN+/99xsrSCttI3YRtirg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@balena/dockerignore": "^1.0.2",
|
"@balena/dockerignore": "^1.0.2",
|
||||||
"@types/dockerode": "^3.3.29",
|
"@types/dockerode": "^3.3.29",
|
||||||
|
|
|
@ -155,7 +155,6 @@
|
||||||
"@playwright/test": "~1.39.0",
|
"@playwright/test": "~1.39.0",
|
||||||
"@popperjs/core": "~2.10.2",
|
"@popperjs/core": "~2.10.2",
|
||||||
"@testcontainers/hivemq": "^10.13.1",
|
"@testcontainers/hivemq": "^10.13.1",
|
||||||
"@testcontainers/rabbitmq": "^10.13.2",
|
|
||||||
"@types/bootstrap": "~5.1.9",
|
"@types/bootstrap": "~5.1.9",
|
||||||
"@types/node": "^20.8.6",
|
"@types/node": "^20.8.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||||
|
|
|
@ -153,7 +153,6 @@ class Monitor extends BeanModel {
|
||||||
snmpOid: this.snmpOid,
|
snmpOid: this.snmpOid,
|
||||||
jsonPathOperator: this.jsonPathOperator,
|
jsonPathOperator: this.jsonPathOperator,
|
||||||
snmpVersion: this.snmpVersion,
|
snmpVersion: this.snmpVersion,
|
||||||
rabbitmqNodes: JSON.parse(this.rabbitmqNodes),
|
|
||||||
conditions: JSON.parse(this.conditions),
|
conditions: JSON.parse(this.conditions),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -184,8 +183,6 @@ class Monitor extends BeanModel {
|
||||||
tlsCert: this.tlsCert,
|
tlsCert: this.tlsCert,
|
||||||
tlsKey: this.tlsKey,
|
tlsKey: this.tlsKey,
|
||||||
kafkaProducerSaslOptions: JSON.parse(this.kafkaProducerSaslOptions),
|
kafkaProducerSaslOptions: JSON.parse(this.kafkaProducerSaslOptions),
|
||||||
rabbitmqUsername: this.rabbitmqUsername,
|
|
||||||
rabbitmqPassword: this.rabbitmqPassword,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
const { MonitorType } = require("./monitor-type");
|
|
||||||
const { log, UP, DOWN } = require("../../src/util");
|
|
||||||
const { axiosAbortSignal } = require("../util-server");
|
|
||||||
const axios = require("axios");
|
|
||||||
|
|
||||||
class RabbitMqMonitorType extends MonitorType {
|
|
||||||
name = "rabbitmq";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
async check(monitor, heartbeat, server) {
|
|
||||||
let baseUrls = [];
|
|
||||||
try {
|
|
||||||
baseUrls = JSON.parse(monitor.rabbitmqNodes);
|
|
||||||
} catch (error) {
|
|
||||||
throw new Error("Invalid RabbitMQ Nodes");
|
|
||||||
}
|
|
||||||
|
|
||||||
heartbeat.status = DOWN;
|
|
||||||
for (let baseUrl of baseUrls) {
|
|
||||||
try {
|
|
||||||
// Without a trailing slash, path in baseUrl will be removed. https://example.com/api -> https://example.com
|
|
||||||
if ( !baseUrl.endsWith("/") ) {
|
|
||||||
baseUrl += "/";
|
|
||||||
}
|
|
||||||
const options = {
|
|
||||||
// Do not start with slash, it will strip the trailing slash from baseUrl
|
|
||||||
url: new URL("api/health/checks/alarms/", baseUrl).href,
|
|
||||||
method: "get",
|
|
||||||
timeout: monitor.timeout * 1000,
|
|
||||||
headers: {
|
|
||||||
"Accept": "application/json",
|
|
||||||
"Authorization": "Basic " + Buffer.from(`${monitor.rabbitmqUsername || ""}:${monitor.rabbitmqPassword || ""}`).toString("base64"),
|
|
||||||
},
|
|
||||||
signal: axiosAbortSignal((monitor.timeout + 10) * 1000),
|
|
||||||
// Capture reason for 503 status
|
|
||||||
validateStatus: (status) => status === 200 || status === 503,
|
|
||||||
};
|
|
||||||
log.debug("monitor", `[${monitor.name}] Axios Request: ${JSON.stringify(options)}`);
|
|
||||||
const res = await axios.request(options);
|
|
||||||
log.debug("monitor", `[${monitor.name}] Axios Response: status=${res.status} body=${JSON.stringify(res.data)}`);
|
|
||||||
if (res.status === 200) {
|
|
||||||
heartbeat.status = UP;
|
|
||||||
heartbeat.msg = "OK";
|
|
||||||
break;
|
|
||||||
} else if (res.status === 503) {
|
|
||||||
heartbeat.msg = res.data.reason;
|
|
||||||
} else {
|
|
||||||
heartbeat.msg = `${res.status} - ${res.statusText}`;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
if (axios.isCancel(error)) {
|
|
||||||
heartbeat.msg = "Request timed out";
|
|
||||||
log.debug("monitor", `[${monitor.name}] Request timed out`);
|
|
||||||
} else {
|
|
||||||
log.debug("monitor", `[${monitor.name}] Axios Error: ${JSON.stringify(error.message)}`);
|
|
||||||
heartbeat.msg = error.message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
RabbitMqMonitorType,
|
|
||||||
};
|
|
|
@ -718,8 +718,6 @@ let needSetup = false;
|
||||||
|
|
||||||
monitor.conditions = JSON.stringify(monitor.conditions);
|
monitor.conditions = JSON.stringify(monitor.conditions);
|
||||||
|
|
||||||
monitor.rabbitmqNodes = JSON.stringify(monitor.rabbitmqNodes);
|
|
||||||
|
|
||||||
bean.import(monitor);
|
bean.import(monitor);
|
||||||
bean.user_id = socket.userID;
|
bean.user_id = socket.userID;
|
||||||
|
|
||||||
|
@ -870,9 +868,6 @@ let needSetup = false;
|
||||||
bean.snmpOid = monitor.snmpOid;
|
bean.snmpOid = monitor.snmpOid;
|
||||||
bean.jsonPathOperator = monitor.jsonPathOperator;
|
bean.jsonPathOperator = monitor.jsonPathOperator;
|
||||||
bean.timeout = monitor.timeout;
|
bean.timeout = monitor.timeout;
|
||||||
bean.rabbitmqNodes = JSON.stringify(monitor.rabbitmqNodes);
|
|
||||||
bean.rabbitmqUsername = monitor.rabbitmqUsername;
|
|
||||||
bean.rabbitmqPassword = monitor.rabbitmqPassword;
|
|
||||||
bean.conditions = JSON.stringify(monitor.conditions);
|
bean.conditions = JSON.stringify(monitor.conditions);
|
||||||
|
|
||||||
bean.validate();
|
bean.validate();
|
||||||
|
|
|
@ -115,7 +115,6 @@ class UptimeKumaServer {
|
||||||
UptimeKumaServer.monitorTypeList["mqtt"] = new MqttMonitorType();
|
UptimeKumaServer.monitorTypeList["mqtt"] = new MqttMonitorType();
|
||||||
UptimeKumaServer.monitorTypeList["snmp"] = new SNMPMonitorType();
|
UptimeKumaServer.monitorTypeList["snmp"] = new SNMPMonitorType();
|
||||||
UptimeKumaServer.monitorTypeList["mongodb"] = new MongodbMonitorType();
|
UptimeKumaServer.monitorTypeList["mongodb"] = new MongodbMonitorType();
|
||||||
UptimeKumaServer.monitorTypeList["rabbitmq"] = new RabbitMqMonitorType();
|
|
||||||
|
|
||||||
// Allow all CORS origins (polling) in development
|
// Allow all CORS origins (polling) in development
|
||||||
let cors = undefined;
|
let cors = undefined;
|
||||||
|
@ -553,5 +552,4 @@ const { DnsMonitorType } = require("./monitor-types/dns");
|
||||||
const { MqttMonitorType } = require("./monitor-types/mqtt");
|
const { MqttMonitorType } = require("./monitor-types/mqtt");
|
||||||
const { SNMPMonitorType } = require("./monitor-types/snmp");
|
const { SNMPMonitorType } = require("./monitor-types/snmp");
|
||||||
const { MongodbMonitorType } = require("./monitor-types/mongodb");
|
const { MongodbMonitorType } = require("./monitor-types/mongodb");
|
||||||
const { RabbitMqMonitorType } = require("./monitor-types/rabbitmq");
|
|
||||||
const Monitor = require("./model/monitor");
|
const Monitor = require("./model/monitor");
|
||||||
|
|
|
@ -42,9 +42,6 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
|
||||||
this.cleanupModal();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Show the confirm dialog
|
* Show the confirm dialog
|
||||||
|
@ -61,19 +58,6 @@ export default {
|
||||||
this.$emit("added", this.groupName);
|
this.$emit("added", this.groupName);
|
||||||
this.modal.hide();
|
this.modal.hide();
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* Clean up modal and restore scroll behavior
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
cleanupModal() {
|
|
||||||
if (this.modal) {
|
|
||||||
try {
|
|
||||||
this.modal.hide();
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Modal hide failed:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -232,9 +232,6 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
|
||||||
this.cleanupModal();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -339,20 +336,6 @@ export default {
|
||||||
});
|
});
|
||||||
} while (this.$root.notificationList.find(it => it.name === name));
|
} while (this.$root.notificationList.find(it => it.name === name));
|
||||||
return name;
|
return name;
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clean up modal and restore scroll behavior
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
cleanupModal() {
|
|
||||||
if (this.modal) {
|
|
||||||
try {
|
|
||||||
this.modal.hide();
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Modal hide failed:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -125,12 +125,11 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
|
||||||
this.cleanupModal();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Show dialog to confirm deletion
|
* Show dialog to confirm deletion
|
||||||
|
@ -210,20 +209,6 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Clean up modal and restore scroll behavior
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
cleanupModal() {
|
|
||||||
if (this.modal) {
|
|
||||||
try {
|
|
||||||
this.modal.hide();
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Modal hide failed:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -248,9 +248,6 @@ export default {
|
||||||
this.modal = new Modal(this.$refs.modal);
|
this.modal = new Modal(this.$refs.modal);
|
||||||
this.getExistingTags();
|
this.getExistingTags();
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
|
||||||
this.cleanupModal();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Show the add tag dialog
|
* Show the add tag dialog
|
||||||
|
@ -462,19 +459,6 @@ export default {
|
||||||
this.newTags = [];
|
this.newTags = [];
|
||||||
this.deleteTags = [];
|
this.deleteTags = [];
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Clean up modal and restore scroll behavior
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
cleanupModal() {
|
|
||||||
if (this.modal) {
|
|
||||||
try {
|
|
||||||
this.modal.hide();
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Modal hide failed:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1052,13 +1052,6 @@
|
||||||
"Can be found on:": "Can be found on: {0}",
|
"Can be found on:": "Can be found on: {0}",
|
||||||
"The phone number of the recipient in E.164 format.": "The phone number of the recipient in E.164 format.",
|
"The phone number of the recipient in E.164 format.": "The phone number of the recipient in E.164 format.",
|
||||||
"Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies.":"Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies.",
|
"Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies.":"Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies.",
|
||||||
"RabbitMQ Nodes": "RabbitMQ Management Nodes",
|
|
||||||
"rabbitmqNodesDescription": "Enter the URL for the RabbitMQ management nodes including protocol and port. Example: {0}",
|
|
||||||
"rabbitmqNodesRequired": "Please set the nodes for this monitor.",
|
|
||||||
"rabbitmqNodesInvalid": "Please use a fully qualified (starting with 'http') URL for RabbitMQ nodes.",
|
|
||||||
"RabbitMQ Username": "RabbitMQ Username",
|
|
||||||
"RabbitMQ Password": "RabbitMQ Password",
|
|
||||||
"rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.",
|
|
||||||
"nextCheckIn": "Next in ",
|
"nextCheckIn": "Next in ",
|
||||||
"SendGrid API Key": "SendGrid API Key",
|
"SendGrid API Key": "SendGrid API Key",
|
||||||
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
|
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
|
||||||
|
|
|
@ -64,9 +64,6 @@
|
||||||
<option value="mqtt">
|
<option value="mqtt">
|
||||||
MQTT
|
MQTT
|
||||||
</option>
|
</option>
|
||||||
<option value="rabbitmq">
|
|
||||||
RabbitMQ
|
|
||||||
</option>
|
|
||||||
<option value="kafka-producer">
|
<option value="kafka-producer">
|
||||||
Kafka Producer
|
Kafka Producer
|
||||||
</option>
|
</option>
|
||||||
|
@ -93,13 +90,6 @@
|
||||||
</option>
|
</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
<i18n-t v-if="monitor.type === 'rabbitmq'" keypath="rabbitmqHelpText" tag="div" class="form-text">
|
|
||||||
<template #rabitmq_documentation>
|
|
||||||
<a href="https://www.rabbitmq.com/management" target="_blank" rel="noopener noreferrer">
|
|
||||||
RabbitMQ documentation
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
</i18n-t>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="monitor.type === 'tailscale-ping'" class="alert alert-warning" role="alert">
|
<div v-if="monitor.type === 'tailscale-ping'" class="alert alert-warning" role="alert">
|
||||||
|
@ -243,43 +233,6 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="monitor.type === 'rabbitmq'">
|
|
||||||
<!-- RabbitMQ Nodes List -->
|
|
||||||
<div class="my-3">
|
|
||||||
<label for="rabbitmqNodes" class="form-label">{{ $t("RabbitMQ Nodes") }}</label>
|
|
||||||
<VueMultiselect
|
|
||||||
id="rabbitmqNodes"
|
|
||||||
v-model="monitor.rabbitmqNodes"
|
|
||||||
:required="true"
|
|
||||||
:multiple="true"
|
|
||||||
:options="[]"
|
|
||||||
:placeholder="$t('Enter the list of nodes')"
|
|
||||||
:tag-placeholder="$t('Press Enter to add node')"
|
|
||||||
:max-height="500"
|
|
||||||
:taggable="true"
|
|
||||||
:show-no-options="false"
|
|
||||||
:close-on-select="false"
|
|
||||||
:clear-on-select="false"
|
|
||||||
:preserve-search="false"
|
|
||||||
:preselect-first="false"
|
|
||||||
@tag="addRabbitmqNode"
|
|
||||||
></VueMultiselect>
|
|
||||||
<div class="form-text">
|
|
||||||
{{ $t("rabbitmqNodesDescription", ["https://node1.rabbitmq.com:15672"]) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="my-3">
|
|
||||||
<label for="rabbitmqUsername" class="form-label">RabbitMQ {{ $t("RabbitMQ Username") }}</label>
|
|
||||||
<input id="rabbitmqUsername" v-model="monitor.rabbitmqUsername" type="text" required class="form-control">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="my-3">
|
|
||||||
<label for="rabbitmqPassword" class="form-label">{{ $t("RabbitMQ Password") }}</label>
|
|
||||||
<HiddenInput id="rabbitmqPassword" v-model="monitor.rabbitmqPassword" autocomplete="false" required="true"></HiddenInput>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- Hostname -->
|
<!-- Hostname -->
|
||||||
<!-- TCP Port / Ping / DNS / Steam / MQTT / Radius / Tailscale Ping / SNMP only -->
|
<!-- 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'" class="my-3">
|
||||||
|
@ -596,7 +549,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Timeout: HTTP / Keyword / SNMP only -->
|
<!-- Timeout: HTTP / Keyword / SNMP only -->
|
||||||
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' || monitor.type === 'snmp' || monitor.type === 'rabbitmq'" class="my-3">
|
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' || monitor.type === 'snmp'" class="my-3">
|
||||||
<label for="timeout" class="form-label">{{ $t("Request Timeout") }} ({{ $t("timeoutAfter", [ monitor.timeout || clampTimeout(monitor.interval) ]) }})</label>
|
<label for="timeout" class="form-label">{{ $t("Request Timeout") }} ({{ $t("timeoutAfter", [ monitor.timeout || clampTimeout(monitor.interval) ]) }})</label>
|
||||||
<input id="timeout" v-model="monitor.timeout" type="number" class="form-control" required min="0" step="0.1">
|
<input id="timeout" v-model="monitor.timeout" type="number" class="form-control" required min="0" step="0.1">
|
||||||
</div>
|
</div>
|
||||||
|
@ -1169,9 +1122,6 @@ const monitorDefaults = {
|
||||||
kafkaProducerAllowAutoTopicCreation: false,
|
kafkaProducerAllowAutoTopicCreation: false,
|
||||||
gamedigGivenPortOnly: true,
|
gamedigGivenPortOnly: true,
|
||||||
remote_browser: null,
|
remote_browser: null,
|
||||||
rabbitmqNodes: [],
|
|
||||||
rabbitmqUsername: "",
|
|
||||||
rabbitmqPassword: "",
|
|
||||||
conditions: []
|
conditions: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1759,10 +1709,6 @@ message HealthCheckResponse {
|
||||||
this.monitor.kafkaProducerBrokers.push(newBroker);
|
this.monitor.kafkaProducerBrokers.push(newBroker);
|
||||||
},
|
},
|
||||||
|
|
||||||
addRabbitmqNode(newNode) {
|
|
||||||
this.monitor.rabbitmqNodes.push(newNode);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate form input
|
* Validate form input
|
||||||
* @returns {boolean} Is the form input valid?
|
* @returns {boolean} Is the form input valid?
|
||||||
|
@ -1790,17 +1736,6 @@ message HealthCheckResponse {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.monitor.type === "rabbitmq") {
|
|
||||||
if (this.monitor.rabbitmqNodes.length === 0) {
|
|
||||||
toast.error(this.$t("rabbitmqNodesRequired"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.monitor.rabbitmqNodes.every(node => node.startsWith("http://") || node.startsWith("https://"))) {
|
|
||||||
toast.error(this.$t("rabbitmqNodesInvalid"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
const { describe, test } = require("node:test");
|
|
||||||
const assert = require("node:assert");
|
|
||||||
const { RabbitMQContainer } = require("@testcontainers/rabbitmq");
|
|
||||||
const { RabbitMqMonitorType } = require("../../server/monitor-types/rabbitmq");
|
|
||||||
const { UP, DOWN, PENDING } = require("../../src/util");
|
|
||||||
|
|
||||||
describe("RabbitMQ Single Node", {
|
|
||||||
skip: !!process.env.CI && (process.platform !== "linux" || process.arch !== "x64"),
|
|
||||||
}, () => {
|
|
||||||
test("RabbitMQ is running", async () => {
|
|
||||||
// The default timeout of 30 seconds might not be enough for the container to start
|
|
||||||
const rabbitMQContainer = await new RabbitMQContainer().withStartupTimeout(60000).start();
|
|
||||||
const rabbitMQMonitor = new RabbitMqMonitorType();
|
|
||||||
const connectionString = `http://${rabbitMQContainer.getHost()}:${rabbitMQContainer.getMappedPort(15672)}`;
|
|
||||||
|
|
||||||
const monitor = {
|
|
||||||
rabbitmqNodes: JSON.stringify([ connectionString ]),
|
|
||||||
rabbitmqUsername: "guest",
|
|
||||||
rabbitmqPassword: "guest",
|
|
||||||
};
|
|
||||||
|
|
||||||
const heartbeat = {
|
|
||||||
msg: "",
|
|
||||||
status: PENDING,
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
await rabbitMQMonitor.check(monitor, heartbeat, {});
|
|
||||||
assert.strictEqual(heartbeat.status, UP);
|
|
||||||
assert.strictEqual(heartbeat.msg, "OK");
|
|
||||||
} finally {
|
|
||||||
rabbitMQContainer.stop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test("RabbitMQ is not running", async () => {
|
|
||||||
const rabbitMQMonitor = new RabbitMqMonitorType();
|
|
||||||
const monitor = {
|
|
||||||
rabbitmqNodes: JSON.stringify([ "http://localhost:15672" ]),
|
|
||||||
rabbitmqUsername: "rabbitmqUser",
|
|
||||||
rabbitmqPassword: "rabbitmqPass",
|
|
||||||
};
|
|
||||||
|
|
||||||
const heartbeat = {
|
|
||||||
msg: "",
|
|
||||||
status: PENDING,
|
|
||||||
};
|
|
||||||
|
|
||||||
await rabbitMQMonitor.check(monitor, heartbeat, {});
|
|
||||||
assert.strictEqual(heartbeat.status, DOWN);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
Loading…
Reference in a new issue