Adds jitsi components events

main
Yasen Pramatarov 2024-06-19 10:02:24 +03:00
parent e889455d49
commit a36de4b684
2 changed files with 39 additions and 1 deletions

View File

@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file.
- gitlab: https://gitlab.com/lindeas/jilo/-/compare/v0.1.1...HEAD - gitlab: https://gitlab.com/lindeas/jilo/-/compare/v0.1.1...HEAD
### Added ### Added
- Added 'jitsi_components' table to handle events related to the platform health
- Added jicofo starting, xmpp registering and started events
### Changed ### Changed

38
jilo
View File

@ -65,11 +65,14 @@ db_get_participant="SELECT * FROM participants WHERE endpoint_id = '%s';"
db_insert_participants_template="INSERT INTO participants (jitsi_component, endpoint_id, conference_id) VALUES ('%s', '%s', '%s');" db_insert_participants_template="INSERT INTO participants (jitsi_component, endpoint_id, conference_id) VALUES ('%s', '%s', '%s');"
db_insert_participant_event_template="INSERT INTO participant_events (jitsi_component, loglevel, time, participant_id, event_type, event_param) VALUES ('%s', '%s', '%s', '%s', '%s', '%s');" db_insert_participant_event_template="INSERT INTO participant_events (jitsi_component, loglevel, time, participant_id, event_type, event_param) VALUES ('%s', '%s', '%s', '%s', '%s', '%s');"
db_insert_jitsi_component_event_template="INSERT INTO jitsi_components (jitsi_component, loglevel, time, component_id, event_type, event_param) VALUES ('%s', '%s', '%s', '%s', '%s', '%s');"
db_drop=" db_drop="
DROP TABLE IF EXISTS conferences; DROP TABLE IF EXISTS conferences;
DROP TABLE IF EXISTS conference_events; DROP TABLE IF EXISTS conference_events;
DROP TABLE IF EXISTS participants; DROP TABLE IF EXISTS participants;
DROP TABLE IF EXISTS participant_events; DROP TABLE IF EXISTS participant_events;
DROP TABLE IF EXISTS jitsi_components;
DROP TABLE IF EXISTS state;" DROP TABLE IF EXISTS state;"
db_create="CREATE TABLE conferences ( db_create="CREATE TABLE conferences (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
@ -105,6 +108,15 @@ CREATE TABLE participant_events (
event_param TEXT, event_param TEXT,
FOREIGN KEY (participant_id) REFERENCES participants(id) FOREIGN KEY (participant_id) REFERENCES participants(id)
); );
CREATE TABLE jitsi_components (
id INTEGER PRIMARY KEY AUTOINCREMENT,
jitsi_component TEXT NOT NULL,
loglevel TEXT,
time TEXT NOT NULL,
component_id TEXT,
event_type TEXT,
event_param TEXT
);
CREATE TABLE state ( CREATE TABLE state (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
jitsi_component TEXT, jitsi_component TEXT,
@ -123,6 +135,7 @@ DELETE FROM conferences;
DELETE FROM conference_events; DELETE FROM conference_events;
DELETE FROM participants; DELETE FROM participants;
DELETE FROM participant_events; DELETE FROM participant_events;
DELETE FROM jitsi_components;
DELETE FROM state;" DELETE FROM state;"
help="Usage: help="Usage:
@ -345,8 +358,31 @@ jitsi_log_parse() {
;; ;;
JICOFO) JICOFO)
# jicofo starting
if [[ "$line" =~ Jicofo\ ([0-9-]+\ [0-9:.]+)\ ([A-Z]+):.*Main\.main.*:\ Starting\ Jicofo\. ]]; then
event_time="${BASH_REMATCH[1]}"
loglevel="${BASH_REMATCH[2]}"
## FIXME a way to add some jicofo id and/or parameter
db_insert=$(printf "$db_insert_jitsi_component_event_template" "$jitsi_component" "$loglevel" "$event_time" "" "jicofo starting" "")
db_query "$db_insert"
# jicofo registered to xmpp
elif [[ "$line" =~ Jicofo\ ([0-9-]+\ [0-9:.]+)\ ([A-Z]+):.*\[xmpp_connection=client\]\ XmppProvider\$connectionListener\$1\.authenticated.*:\ Registered\. ]]; then
event_time="${BASH_REMATCH[1]}"
loglevel="${BASH_REMATCH[2]}"
db_insert=$(printf "$db_insert_jitsi_component_event_template" "$jitsi_component" "$loglevel" "$event_time" "" "jicofo xmpp registered" "")
db_query "$db_insert"
# jicofo started
elif [[ "$line" =~ Jicofo\ ([0-9-]+\ [0-9:.]+)\ ([A-Z]+):.*\JicofoServices\.\<init\>.*\ Registering\ GlobalMetrics\ periodic\ updates\. ]]; then
event_time="${BASH_REMATCH[1]}"
loglevel="${BASH_REMATCH[2]}"
db_insert=$(printf "$db_insert_jitsi_component_event_template" "$jitsi_component" "$loglevel" "$event_time" "" "jicofo started" "")
db_query "$db_insert"
# locate conference starting event # locate conference starting event
if [[ "$line" =~ Jicofo\ ([0-9-]+\ [0-9:.]+)\ ([A-Z]+):.*\[room=([^ ]+)@(.*)\]\ JitsiMeetConferenceImpl\.joinTheRoom ]]; then elif [[ "$line" =~ Jicofo\ ([0-9-]+\ [0-9:.]+)\ ([A-Z]+):.*\[room=([^ ]+)@(.*)\]\ JitsiMeetConferenceImpl\.joinTheRoom ]]; then
event_time="${BASH_REMATCH[1]}" event_time="${BASH_REMATCH[1]}"
loglevel="${BASH_REMATCH[2]}" loglevel="${BASH_REMATCH[2]}"
conference_id="0" # FIXME here we still don't have the jicofo room ID conference_id="0" # FIXME here we still don't have the jicofo room ID