added rtsp details

This commit is contained in:
Hemanth 2025-06-27 22:30:33 +05:30
parent 6bc8936bc7
commit 152c93e7d3
3 changed files with 24 additions and 3 deletions

View file

@ -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
}; };
} }

View file

@ -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...";

View file

@ -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;