Rough in an importance setting in monitor that we can use to decrease the log level of certain events like PrimeCapture for cameras that we don't care about
This commit is contained in:
parent
aadfa1e6e1
commit
ed29021179
|
@ -538,6 +538,7 @@ CREATE TABLE `Monitors` (
|
||||||
`Longitude` DECIMAL(10,8),
|
`Longitude` DECIMAL(10,8),
|
||||||
`RTSPServer` BOOLEAN NOT NULL DEFAULT FALSE,
|
`RTSPServer` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
`RTSPStreamName` varchar(255) NOT NULL default '',
|
`RTSPStreamName` varchar(255) NOT NULL default '',
|
||||||
|
`Importance` enum('Not','Less','Normal'),
|
||||||
PRIMARY KEY (`Id`)
|
PRIMARY KEY (`Id`)
|
||||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'TotalEvents'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `TotalEvents`",
|
||||||
|
"SELECT 'Column TotalEvents already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'TotalEventDiskSpace'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `TotalEventDiskSpace`",
|
||||||
|
"SELECT 'Column TotalEventDiskSpace already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'HourEvents'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `HourEvents`",
|
||||||
|
"SELECT 'Column HourEvents already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'HourEventDiskSpace'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `HourEventDiskSpace`",
|
||||||
|
"SELECT 'Column HourEventDiskSpace already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'DayEvents'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `DayEvents`",
|
||||||
|
"SELECT 'Column DayEvents already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'DayEvents'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `DayEventDiskSpace`",
|
||||||
|
"SELECT 'Column DayEventDiskSpace already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'WeekEvents'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `WeekEvents`",
|
||||||
|
"SELECT 'Column WeekEvents already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'WeekEventDiskSpace'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `WeekEventDiskSpace`",
|
||||||
|
"SELECT 'Column WeekEventDiskSpace already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'MonthEvents'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `MonthEvents`",
|
||||||
|
"SELECT 'Column MonthEvents already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'MonthEventDiskSpace'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `MonthEventDiskSpace`",
|
||||||
|
"SELECT 'Column MonthEventDiskSpace already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'ArchivedEvents'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `ArchivedEvents`",
|
||||||
|
"SELECT 'Column ArchivedEvents already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitor_Status'
|
||||||
|
AND column_name = 'ArchivedEventDiskSpace'
|
||||||
|
) > 0,
|
||||||
|
"ALTER TABLE `Monitor_Status` DROP `ArchivedEventDiskSpace`",
|
||||||
|
"SELECT 'Column ArchivedEventDiskSpace already removed from Monitor_Status'"
|
||||||
|
));
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||||
|
AND table_name = 'Monitors'
|
||||||
|
AND column_name = 'Importance'
|
||||||
|
) > 0,
|
||||||
|
"SELECT 'Column Importance already exists in Monitors'",
|
||||||
|
"ALTER TABLE `Monitors` ADD `Importance` enum('Not','Less','Normal') AFTER `RTSPStreamName`"
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
|
@ -356,6 +356,7 @@ Monitor::Monitor()
|
||||||
embed_exif(0),
|
embed_exif(0),
|
||||||
rtsp_server(0),
|
rtsp_server(0),
|
||||||
rtsp_streamname(""),
|
rtsp_streamname(""),
|
||||||
|
importance(0),
|
||||||
capture_max_fps(0),
|
capture_max_fps(0),
|
||||||
purpose(QUERY),
|
purpose(QUERY),
|
||||||
last_camera_bytes(0),
|
last_camera_bytes(0),
|
||||||
|
@ -442,7 +443,7 @@ Monitor::Monitor()
|
||||||
"SectionLength, MinSectionLength, FrameSkip, MotionFrameSkip, "
|
"SectionLength, MinSectionLength, FrameSkip, MotionFrameSkip, "
|
||||||
"FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, Exif,"
|
"FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, Exif,"
|
||||||
"`RTSPServer`,`RTSPStreamName`,
|
"`RTSPServer`,`RTSPStreamName`,
|
||||||
"SignalCheckPoints, SignalCheckColour FROM Monitors";
|
"SignalCheckPoints, SignalCheckColour, Importance-2 FROM Monitors";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
|
void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
|
||||||
|
@ -588,6 +589,7 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
|
||||||
rtsp_streamname = dbrow[col]; col++;
|
rtsp_streamname = dbrow[col]; col++;
|
||||||
signal_check_points = atoi(dbrow[col]); col++;
|
signal_check_points = atoi(dbrow[col]); col++;
|
||||||
signal_check_colour = strtol(dbrow[col][0] == '#' ? dbrow[col]+1 : dbrow[col], 0, 16); col++;
|
signal_check_colour = strtol(dbrow[col][0] == '#' ? dbrow[col]+1 : dbrow[col], 0, 16); col++;
|
||||||
|
importance = atoi(dbrow[col]); col++;
|
||||||
|
|
||||||
// How many frames we need to have before we start analysing
|
// How many frames we need to have before we start analysing
|
||||||
ready_count = std::max(warmup_count, pre_event_count);
|
ready_count = std::max(warmup_count, pre_event_count);
|
||||||
|
@ -3201,9 +3203,6 @@ int Monitor::PrimeCapture() {
|
||||||
} else {
|
} else {
|
||||||
analysis_thread->Start();
|
analysis_thread->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
Debug(2, "Failed to prime %d", ret);
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} // end int Monitor::PrimeCapture()
|
} // end int Monitor::PrimeCapture()
|
||||||
|
|
|
@ -319,6 +319,7 @@ protected:
|
||||||
bool embed_exif; // Whether to embed Exif data into each image frame or not
|
bool embed_exif; // Whether to embed Exif data into each image frame or not
|
||||||
bool rtsp_server; // Whether to include this monitor as an rtsp server stream
|
bool rtsp_server; // Whether to include this monitor as an rtsp server stream
|
||||||
std::string rtsp_streamname; // path in the rtsp url for this monitor
|
std::string rtsp_streamname; // path in the rtsp url for this monitor
|
||||||
|
int importance; // Importance of this monitor, affects Connection logging errors.
|
||||||
|
|
||||||
int capture_max_fps;
|
int capture_max_fps;
|
||||||
|
|
||||||
|
@ -592,6 +593,7 @@ public:
|
||||||
double get_analysis_fps( ) const {
|
double get_analysis_fps( ) const {
|
||||||
return shared_data ? shared_data->analysis_fps : 0.0;
|
return shared_data ? shared_data->analysis_fps : 0.0;
|
||||||
}
|
}
|
||||||
|
int Importance() { return importance; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
||||||
|
|
|
@ -1252,6 +1252,19 @@ echo htmlSelect('newMonitor[ReturnLocation]', $return_options, $monitor->ReturnL
|
||||||
<td class="text-right pr-3"><?php echo translate('RTSPStreamName'); echo makeHelpLink('OPTIONS_RTSPSTREAMNAME') ?></td>
|
<td class="text-right pr-3"><?php echo translate('RTSPStreamName'); echo makeHelpLink('OPTIONS_RTSPSTREAMNAME') ?></td>
|
||||||
<td><input type="text" name="newMonitor[RTSPStreamName]" value="<?php echo validHtmlStr($monitor->RTSPStreamName()) ?>"/></td>
|
<td><input type="text" name="newMonitor[RTSPStreamName]" value="<?php echo validHtmlStr($monitor->RTSPStreamName()) ?>"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="text-right pr-3"><?php echo translate('Importance'); echo makeHelpLink('OPTIONS_IMPORTANCE') ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
echo htmlselect('newMonitor[Importance]',
|
||||||
|
array(
|
||||||
|
'Not'=>translate('Not important'),
|
||||||
|
'Less'=>translate('Less important'),
|
||||||
|
'Normal'=>translate('Normal')
|
||||||
|
), $monitor->Importance());
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue