mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-18 23:34:04 +02:00
added rtsp details
This commit is contained in:
parent
6bc8936bc7
commit
152c93e7d3
3 changed files with 24 additions and 3 deletions
|
@ -197,6 +197,12 @@ class Monitor extends BeanModel {
|
||||||
kafkaProducerSaslOptions: JSON.parse(this.kafkaProducerSaslOptions),
|
kafkaProducerSaslOptions: JSON.parse(this.kafkaProducerSaslOptions),
|
||||||
rabbitmqUsername: this.rabbitmqUsername,
|
rabbitmqUsername: this.rabbitmqUsername,
|
||||||
rabbitmqPassword: this.rabbitmqPassword,
|
rabbitmqPassword: this.rabbitmqPassword,
|
||||||
|
rtspUsername: this.rtspUsername,
|
||||||
|
rtspPassword: this.rtspPassword,
|
||||||
|
rtspPath:this.rtspPath
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,24 @@ class RtspMonitorType {
|
||||||
name = "rtsp";
|
name = "rtsp";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} monitor - monitor config containing rtspUrl and timeout
|
* @param {Object} monitor - monitor config containing hostname, port, username, password, path, and timeout
|
||||||
* @param {Object} heartbeat - object to update with status and message
|
* @param {Object} heartbeat - object to update with status and message
|
||||||
*/
|
*/
|
||||||
async check(monitor, heartbeat) {
|
async check(monitor, heartbeat) {
|
||||||
const url = monitor.rtspUrl;
|
const { rtsp_username, rtsp_password, hostname, port, rtsp_path, timeout } = monitor;
|
||||||
const timeoutMs = (monitor.timeout || 10) * 1000;
|
const timeoutMs = (timeout || 10) * 1000;
|
||||||
|
|
||||||
|
// Construct the RTSP URL from individual components
|
||||||
|
let url = `rtsp://${hostname}:${port}${rtsp_path}`;
|
||||||
|
|
||||||
|
// If username and password are provided, inject them into the URL
|
||||||
|
if (rtsp_username && rtsp_password !== undefined) {
|
||||||
|
const auth = `${rtsp_username}:${rtsp_password}@`;
|
||||||
|
const urlPattern = /^rtsp:\/\//;
|
||||||
|
|
||||||
|
// Inject authentication details into URL (before host)
|
||||||
|
url = url.replace(urlPattern, `rtsp://${auth}`);
|
||||||
|
}
|
||||||
|
|
||||||
heartbeat.status = DOWN;
|
heartbeat.status = DOWN;
|
||||||
heartbeat.msg = "Starting RTSP stream check...";
|
heartbeat.msg = "Starting RTSP stream check...";
|
||||||
|
|
|
@ -877,6 +877,9 @@ let needSetup = false;
|
||||||
bean.rabbitmqPassword = monitor.rabbitmqPassword;
|
bean.rabbitmqPassword = monitor.rabbitmqPassword;
|
||||||
bean.conditions = JSON.stringify(monitor.conditions);
|
bean.conditions = JSON.stringify(monitor.conditions);
|
||||||
bean.manual_status = monitor.manual_status;
|
bean.manual_status = monitor.manual_status;
|
||||||
|
bean.rtspUsername=monitor.rtspUsername
|
||||||
|
bean.rtspPassword=monitor.rtspPassword
|
||||||
|
bean.rtspPath=monitor.path
|
||||||
|
|
||||||
// ping advanced options
|
// ping advanced options
|
||||||
bean.ping_numeric = monitor.ping_numeric;
|
bean.ping_numeric = monitor.ping_numeric;
|
||||||
|
|
Loading…
Add table
Reference in a new issue