Compare commits
No commits in common. "5f4b3dc4677d2dc9dc87ae10f87f26bd1a55770f" and "da0011869dc037efb65f49257323f94a928ad1a0" have entirely different histories.
5f4b3dc467
...
da0011869d
|
@ -15,9 +15,6 @@ All notable changes to this project will be documented in this file.
|
|||
### Added
|
||||
- Initial changelog following the keepachangelog.com format
|
||||
|
||||
### Changed
|
||||
- Updated the way jilo-cli handles multiple options, added filtering conferences by time period
|
||||
|
||||
---
|
||||
|
||||
## 0.1 - 2024-06-12
|
||||
|
|
531
jilo-cli
531
jilo-cli
|
@ -7,8 +7,8 @@
|
|||
# Command line interface (jilo-cli)
|
||||
###
|
||||
|
||||
VERSION="0.1.1-dev"
|
||||
RELEASE_DATE="unreleased"
|
||||
VERSION="0.1"
|
||||
RELEASE_DATE="2024-06-12"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" #"
|
||||
|
||||
|
@ -68,12 +68,11 @@ JOIN (
|
|||
GROUP BY
|
||||
conference_name
|
||||
) AS name_counts ON c.conference_name = name_counts.conference_name
|
||||
JOIN
|
||||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE (ce.time >= '%s' AND ce.time <= '%s')
|
||||
ORDER BY
|
||||
c.id;"
|
||||
|
||||
db_conferences_id_template="SELECT * FROM conferences WHERE conference_id='%s';"
|
||||
db_conferences_name_template="SELECT * FROM conferences WHERE conference_name='%s';"
|
||||
db_conference_events_template="SELECT * FROM conference_events WHERE conference_id='%s';"
|
||||
db_conference_by_id_template="
|
||||
SELECT
|
||||
pe.time,
|
||||
|
@ -94,7 +93,6 @@ LEFT JOIN
|
|||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
c.conference_id = '%s'
|
||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
||||
|
||||
UNION
|
||||
|
||||
|
@ -113,11 +111,9 @@ LEFT JOIN
|
|||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE
|
||||
c.conference_id = '%s'
|
||||
AND (event_time >= '%s' AND event_time <= '%s')
|
||||
|
||||
ORDER BY
|
||||
pe.time;"
|
||||
|
||||
db_conference_by_name_template="
|
||||
SELECT
|
||||
pe.time,
|
||||
|
@ -138,7 +134,6 @@ LEFT JOIN
|
|||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
c.conference_name = '%s'
|
||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
||||
|
||||
UNION
|
||||
|
||||
|
@ -157,23 +152,20 @@ LEFT JOIN
|
|||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE
|
||||
c.conference_name = '%s'
|
||||
AND (event_time >= '%s' AND event_time <= '%s')
|
||||
|
||||
ORDER BY
|
||||
pe.time;"
|
||||
|
||||
## participant related
|
||||
|
||||
db_participants_all_template="
|
||||
SELECT DISTINCT
|
||||
p.jitsi_component, p.endpoint_id, p.conference_id
|
||||
FROM
|
||||
participants p
|
||||
JOIN
|
||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
pe.time >= '%s' AND pe.time <= '%s'
|
||||
ORDER BY p.id;"
|
||||
db_participants_all_template="SELECT jitsi_component, endpoint_id, conference_id FROM participants ORDER BY id;"
|
||||
db_participants_id_template="SELECT * FROM participants WHERE endpoint_id='%s';"
|
||||
db_participant_events_template="SELECT * FROM participant_events WHERE participant_id='%s';"
|
||||
|
||||
db_participants_endpoint_template="SELECT * FROM participants WHERE endpoint_id='%s';"
|
||||
db_participants_conference_template="SELECT * FROM participants WHERE conference_id='%s';"
|
||||
db_participants_statsid_template="SELECT * FROM participant_events WHERE event_type = 'stats_id' AND event_param LIKE '%%%s%%';"
|
||||
db_participants_ip_template="SELECT * FROM participant_events WHERE event_type = 'pair selected' AND event_param='%s';"
|
||||
|
||||
db_conference_by_participant_id_template="
|
||||
SELECT
|
||||
|
@ -195,7 +187,6 @@ LEFT JOIN
|
|||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
p.endpoint_id = '%s'
|
||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
||||
|
||||
UNION
|
||||
|
||||
|
@ -214,7 +205,6 @@ LEFT JOIN
|
|||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE
|
||||
participant_id = '%s'
|
||||
AND (event_time >= '%s' AND event_time <= '%s')
|
||||
|
||||
ORDER BY
|
||||
pe.time;"
|
||||
|
@ -238,8 +228,7 @@ LEFT JOIN
|
|||
LEFT JOIN
|
||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
c.conference_id = '%s'
|
||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
||||
pe.event_param = '%s'
|
||||
|
||||
UNION
|
||||
|
||||
|
@ -257,51 +246,7 @@ FROM
|
|||
LEFT JOIN
|
||||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE
|
||||
ce.conference_id = '%s'
|
||||
AND (event_time >= '%s' AND event_time <= '%s')
|
||||
|
||||
ORDER BY
|
||||
pe.time;"
|
||||
|
||||
db_participant_by_conference_name_template="
|
||||
SELECT
|
||||
pe.time,
|
||||
c.conference_id,
|
||||
c.conference_name,
|
||||
c.conference_host,
|
||||
pe.loglevel,
|
||||
pe.event_type,
|
||||
p.endpoint_id AS participant_id,
|
||||
pe.event_param
|
||||
FROM
|
||||
conferences c
|
||||
LEFT JOIN
|
||||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
LEFT JOIN
|
||||
participants p ON c.conference_id = p.conference_id
|
||||
LEFT JOIN
|
||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
c.conference_name LIKE '%%%s%%'
|
||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
ce.time AS event_time,
|
||||
c.conference_id,
|
||||
c.conference_name,
|
||||
c.conference_host,
|
||||
ce.loglevel,
|
||||
ce.conference_event AS event_type,
|
||||
NULL AS participant_id,
|
||||
ce.conference_param AS event_param
|
||||
FROM
|
||||
conferences c
|
||||
LEFT JOIN
|
||||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE c.conference_name LIKE '%%%s%%'
|
||||
AND (event_time >= '%s' AND event_time <= '%s')
|
||||
event_param = '%s'
|
||||
|
||||
ORDER BY
|
||||
pe.time;"
|
||||
|
@ -326,7 +271,6 @@ LEFT JOIN
|
|||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
pe.event_type = 'stats_id' AND pe.event_param LIKE '%%%s%%'
|
||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
||||
|
||||
UNION
|
||||
|
||||
|
@ -345,7 +289,6 @@ LEFT JOIN
|
|||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE
|
||||
event_type = 'stats_id' AND event_param LIKE '%%%s%%'
|
||||
AND (event_time >= '%s' AND event_time <= '%s')
|
||||
|
||||
ORDER BY
|
||||
pe.time;"
|
||||
|
@ -370,7 +313,6 @@ LEFT JOIN
|
|||
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||
WHERE
|
||||
pe.event_type = 'pair selected' AND pe.event_param = '%s'
|
||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
||||
|
||||
UNION
|
||||
|
||||
|
@ -389,7 +331,6 @@ LEFT JOIN
|
|||
conference_events ce ON c.conference_id = ce.conference_id
|
||||
WHERE
|
||||
event_type = 'pair selected' AND event_param = '%s'
|
||||
AND (event_time >= '%s' AND event_time <= '%s')
|
||||
|
||||
ORDER BY
|
||||
pe.time;"
|
||||
|
@ -439,14 +380,13 @@ ORDER BY
|
|||
pe.time;"
|
||||
|
||||
|
||||
|
||||
help="Usage:
|
||||
$0 [OPTION]
|
||||
Options:
|
||||
--conference|-c [conference ID or name] - show specific conference(s), all of empty
|
||||
--participant|-p [participant endpoint ID, conference ID, conference name, participant IP, or participant stats ID] - show specific participant(s), all if empty
|
||||
--time|-t - show stats for a time interval; can be use separately ot together with -c or -p
|
||||
--verbose|-v - show more details, when available
|
||||
--silent|-s - show less details, more suitable for scripting
|
||||
--participant|-p [participant endpoint ID, conference ID, participant IP, or participant stats ID] - show specific participant(s), all if empty
|
||||
--time|-t - show stats for a time interval
|
||||
--help|-h - show this help message
|
||||
--version|-V - show version"
|
||||
|
||||
|
@ -455,16 +395,6 @@ version="JILO Jitsi Logs Observer command line client
|
|||
version $VERSION
|
||||
released on $RELEASE_DATE"
|
||||
|
||||
time_formats="Expected formats:
|
||||
- exact times
|
||||
YYYY-MM-DD, YYYY-MM, YYYY
|
||||
- exact periods
|
||||
YYYY-MM-DD:YYYY-MM-DD, YYYY-MM:YYYY-MM, YYYY:YYYY
|
||||
- from begining to given time
|
||||
:YYYY-MM-DD, :YYYY-MM, :YYYY
|
||||
- from given time until end
|
||||
YYYY-MM-DD:, YYYY-MM:, YYYY:"
|
||||
|
||||
|
||||
###
|
||||
|
||||
|
@ -567,7 +497,15 @@ parse_time_range() {
|
|||
until_time="9999-12-31"
|
||||
|
||||
else
|
||||
echo -e "Invalid time range. $time_formats" >&2
|
||||
echo -e "Invalid time range. Expected formats:
|
||||
- exact times
|
||||
YYYY-MM-DD, YYYY-MM, YYYY
|
||||
- exact periods
|
||||
YYYY-MM-DD:YYYY-MM-DD, YYYY-MM:YYYY-MM, YYYY:YYYY
|
||||
- from begining to given time
|
||||
:YYYY-MM-DD, :YYYY-MM, :YYYY
|
||||
- from given time until end
|
||||
YYYY-MM-DD:, YYYY-MM:, YYYY:" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -576,26 +514,17 @@ parse_time_range() {
|
|||
|
||||
### commandline options
|
||||
|
||||
cmd=""
|
||||
conference_arg=""
|
||||
conference_option=false
|
||||
participant_arg=""
|
||||
participant_option=false
|
||||
from_time="0000-00-00"
|
||||
until_time="9999-12-31"
|
||||
time_option=false
|
||||
from_time=""
|
||||
until_time=""
|
||||
time_range_specified=false
|
||||
|
||||
# display help if no arguments
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo -e "$help"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# then check all the options
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-c | --conference )
|
||||
conference_option=true
|
||||
cmd="--conference"
|
||||
if [[ -n "$2" && "$2" != -* ]]; then
|
||||
conference_arg="$2"
|
||||
shift 2
|
||||
|
@ -604,7 +533,7 @@ while [[ $# -gt 0 ]]; do
|
|||
fi
|
||||
;;
|
||||
-p | --participant)
|
||||
participant_option=true
|
||||
cmd="--participant"
|
||||
if [[ -n "$2" && "$2" != -* ]]; then
|
||||
participant_arg="$2"
|
||||
shift 2
|
||||
|
@ -613,23 +542,15 @@ while [[ $# -gt 0 ]]; do
|
|||
fi
|
||||
;;
|
||||
-t | --time)
|
||||
time_option=true
|
||||
cmd="--time"
|
||||
if [[ -n "$2" && "$2" != -* ]]; then
|
||||
parse_time_range "$2"
|
||||
shift 2
|
||||
else
|
||||
echo "Option -t needs a time range argument. $time_formats" >&2
|
||||
echo "Option -t needs time range argument in format 'from-time - until-time', YYYY-MM-DD - YYYY-MM-DD" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-v | --verbose)
|
||||
verbose=true
|
||||
shift
|
||||
;;
|
||||
-s | --silent)
|
||||
silent=true
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
echo -e "$help"
|
||||
exit 0
|
||||
|
@ -646,80 +567,57 @@ while [[ $# -gt 0 ]]; do
|
|||
esac
|
||||
done
|
||||
|
||||
if [[ "$conference_option" == true ]]; then
|
||||
case "$cmd" in
|
||||
|
||||
# the argument to "--conference" can be either ID or name
|
||||
if [[ -n "$conference_arg" ]]; then
|
||||
--conference)
|
||||
# the argument to "--conference" can be either ID or name
|
||||
if [[ -n "$conference_arg" ]]; then
|
||||
|
||||
# check for conferences match within a time period (or all if not period given)
|
||||
db_conferences_id=$(printf "$db_conference_by_id_template" "$conference_arg" "$from_time" "$until_time" "$conference_arg" "$from_time" "$until_time")
|
||||
mapfile -t conferences_id < <(db_query "$db_conferences_id")
|
||||
db_conferences_name=$(printf "$db_conference_by_name_template" "$conference_arg" "$from_time" "$until_time" "$conference_arg" "$from_time" "$until_time")
|
||||
mapfile -t conferences_name < <(db_query "$db_conferences_name")
|
||||
db_conferences_id=$(printf "$db_conferences_id_template" "$conference_arg")
|
||||
conferences_id=$(db_query "$db_conferences_id")
|
||||
|
||||
# we check if the argument to "--conference" is a conference ID
|
||||
# conference ID is unique, so we show that conference
|
||||
if [[ "${#conferences_id[@]}" -gt 0 ]]; then
|
||||
db_conferences_name=$(printf "$db_conferences_name_template" "$conference_arg")
|
||||
conferences_name=$(db_query "$db_conferences_name")
|
||||
|
||||
output=""
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nConferences with ID matching \"$IMPORTANT_TEXT$conference_arg$NORMAL_TEXT\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
# we check if the argument to "--conference" is a conference ID
|
||||
# conference ID is unique, so we show that conference
|
||||
if [[ -n "$conferences_id" ]]; then
|
||||
db_conference=$(printf "$db_conference_by_id_template" "$conference_arg" "$conference_arg")
|
||||
mapfile -t conference_array < <(db_query "$db_conference")
|
||||
# prepare the header
|
||||
output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
fi
|
||||
# prepare the formatted rows
|
||||
for row in "${conferences_id[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$IMPORTANT_TEXT$conference_id$NORMAL_TEXT\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
# prepare the formatted rows
|
||||
for row in "${conference_array[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$IMPORTANT_TEXT$conference_id$NORMAL_TEXT\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
|
||||
# then we check if the argument to "--conference" is a conference name
|
||||
# if so, we show all matching conferences (conference names are not unique)
|
||||
elif [[ "${#conferences_name[@]}" -gt 0 ]]; then
|
||||
# then we check if the argument to "--conference" is a conference name
|
||||
# if so, we show all matching conferences (conference names are not unique)
|
||||
elif [[ -n "$conferences_name" ]]; then
|
||||
db_conference=$(printf "$db_conference_by_name_template" "$conference_arg" "$conference_arg")
|
||||
mapfile -t conference_array < <(db_query "$db_conference")
|
||||
|
||||
output=""
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nConferences with names matching \"$IMPORTANT_TEXT$conference_arg$NORMAL_TEXT\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
# prepare the header
|
||||
output="time\tconf ID\tconf name\tconf host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
fi
|
||||
# prepare the formatted rows
|
||||
for row in "${conferences_name[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$IMPORTANT_TEXT$conference_name$NORMAL_TEXT\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
# prepare the formatted rows
|
||||
for row in "${conference_array[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$IMPORTANT_TEXT$conference_name$NORMAL_TEXT\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
|
||||
# nothing found for neither conference ID or name
|
||||
else
|
||||
if [[ "$silent" != true ]]; then
|
||||
# nothing found for neither conference ID or name
|
||||
else
|
||||
echo "No match found for \"$conference_arg\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
echo "and time period $from_time - $until_time"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
else
|
||||
# if no argument is given, we show all the conferences
|
||||
db_conferences_all=$(printf "$db_conferences_all_formatted_template" "$from_time" "$until_time")
|
||||
mapfile -t conference_array < <(db_query "$db_conferences_all")
|
||||
|
||||
# we only format the outrput if there are conferences to show
|
||||
if [[ "${#conference_array[@]}" -gt 0 ]]; then
|
||||
exit 0
|
||||
else
|
||||
# if no argument is given, we show all the conferences
|
||||
mapfile -t conference_array < <(db_query "$db_conferences_all_formatted_template")
|
||||
# prepare the header
|
||||
output="component\tconference ID\tconference name\tname count\tconference host\n"
|
||||
# prepare the formatted rows
|
||||
|
@ -729,176 +627,88 @@ if [[ "$conference_option" == true ]]; then
|
|||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
else
|
||||
if [[ "$silent" != true ]]; then
|
||||
echo -n "No conferences found"
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
echo -n " for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
echo "."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
|
||||
elif [[ "$participant_option" == true ]]; then
|
||||
--participant)
|
||||
# the argument to "--participant" can be endpointID, conferenceID, startsID, IP address
|
||||
# we check for all ot them and show the matches
|
||||
if [[ -n "$participant_arg" ]]; then
|
||||
db_participants_endpoint=$(printf "$db_participants_endpoint_template" "$participant_arg")
|
||||
participants_endpoint=$(db_query "$db_participants_endpoint")
|
||||
|
||||
# the argument to "--participant" can be endpointID, conferenceID, conference name, startsID, IP address
|
||||
# check for participants match within a time period (or all if period not given)
|
||||
# we check for all ot them and show the matches
|
||||
## FIXME - we don't catch the case with no results found at all, no message is displayed if no results ## FIXME
|
||||
if [[ -n "$participant_arg" ]]; then
|
||||
db_participants_conference=$(printf "$db_participants_conference_template" "$participant_arg")
|
||||
participants_conference=$(db_query "$db_participants_conference")
|
||||
|
||||
db_participants_endpoint=$(printf "$db_conference_by_participant_id_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
|
||||
mapfile -t participants_endpoint < <(db_query "$db_participants_endpoint")
|
||||
db_participants_statsid=$(printf "$db_participants_statsid_template" "$participant_arg")
|
||||
participants_statsid=$(db_query "$db_participants_statsid")
|
||||
|
||||
db_participants_conference=$(printf "$db_participant_by_conference_id_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
|
||||
mapfile -t participants_conference < <(db_query "$db_participants_conference")
|
||||
db_participants_ip=$(printf "$db_participants_ip_template" "$participant_arg")
|
||||
participants_ip=$(db_query "$db_participants_ip")
|
||||
|
||||
db_participants_conference_name=$(printf "$db_participant_by_conference_name_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
|
||||
mapfile -t participants_conference_name < <(db_query "$db_participants_conference_name")
|
||||
|
||||
db_participants_statsid=$(printf "$db_participant_by_stats_id_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
|
||||
mapfile -t participants_statsid < <(db_query "$db_participants_statsid")
|
||||
|
||||
db_participants_ip=$(printf "$db_participant_by_ip_template" "$participant_arg" "$from_time" "$until_time" "$participant_arg" "$from_time" "$until_time")
|
||||
mapfile -t participants_ip < <(db_query "$db_participants_ip")
|
||||
|
||||
# match for participant endpoint_id
|
||||
if [[ "${#participants_endpoint[@]}" -gt 0 ]]; then
|
||||
|
||||
output=""
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nParticipants with ID matching \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
if [[ -n $participants_endpoint ]]; then
|
||||
db_participant=$(printf "$db_conference_by_participant_id_template" "$participant_arg" "$participant_arg")
|
||||
mapfile -t conference_array < <(db_query "$db_participant")
|
||||
# prepare the header
|
||||
output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
# prepare the formatted rows
|
||||
for row in "${conference_array[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$IMPORTANT_TEXT$participant_id$NORMAL_TEXT\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
# prepare the formatted rows
|
||||
for row in "${participants_endpoint[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$IMPORTANT_TEXT$participant_id$NORMAL_TEXT\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
# match for conference_id the participant was in
|
||||
if [[ "${#participants_conference[@]}" -gt 0 ]]; then
|
||||
if [[ -n $participants_conference ]]; then
|
||||
db_participant=$(printf "$db_participant_by_conference_id_template" "$participant_arg" "$participant_arg")
|
||||
mapfile -t conference_array < <(db_query "$db_participant")
|
||||
# prepare the header
|
||||
output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
# prepare the formatted rows
|
||||
for row in "${conference_array[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$IMPORTANT_TEXT$conference_id$NORMAL_TEXT\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
output=""
|
||||
if [[ -n $participants_statsid ]]; then
|
||||
db_participant=$(printf "$db_participant_by_stats_id_template" "$participant_arg" "$participant_arg")
|
||||
mapfile -t conference_array < <(db_query "$db_participant")
|
||||
# prepare the header
|
||||
output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
# prepare the formatted rows
|
||||
for row in "${conference_array[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$IMPORTANT_TEXT$event_param$NORMAL_TEXT\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
if [[ -n $participants_ip ]]; then
|
||||
db_participant=$(printf "$db_participant_by_ip_template" "$participant_arg" "$participant_arg")
|
||||
mapfile -t conference_array < <(db_query "$db_participant")
|
||||
# prepare the header
|
||||
output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
# prepare the formatted rows
|
||||
for row in "${conference_array[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$IMPORTANT_TEXT$event_param$NORMAL_TEXT\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
exit 0
|
||||
else
|
||||
db_participants_all=$(printf "$db_participants_all_template" )
|
||||
mapfile -t participant_array < <(db_query "$db_participants_all")
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nParticipants in conferences with ID matching \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
fi
|
||||
# prepare the formatted rows
|
||||
for row in "${participants_conference[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$IMPORTANT_TEXT$conference_id$NORMAL_TEXT\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
# match for conference_name the participant was in
|
||||
if [[ "${#participants_conference_name[@]}" -gt 0 ]]; then
|
||||
|
||||
output=""
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nParticipants in conferences with name that include the string \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
fi
|
||||
# prepare the formatted rows
|
||||
for row in "${participants_conference_name[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$IMPORTANT_TEXT$conference_name$NORMAL_TEXT\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
# match for participant stats_id
|
||||
if [[ "${#participants_statsid[@]}" -gt 0 ]]; then
|
||||
|
||||
output=""
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nParticipants with stats ID that include the string \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
fi
|
||||
# prepare the formatted rows
|
||||
for row in "${participants_statsid[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$IMPORTANT_TEXT$event_param$NORMAL_TEXT\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
# match for participant IP
|
||||
if [[ "${#participants_ip[@]}" -gt 0 ]]; then
|
||||
|
||||
output=""
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nParticipants with IP address matching \"$IMPORTANT_TEXT$participant_arg$NORMAL_TEXT\""
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
output+="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
fi
|
||||
# prepare the formatted rows
|
||||
for row in "${participants_ip[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$participant_id\t$event_type\t$IMPORTANT_TEXT$event_param$NORMAL_TEXT\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
fi
|
||||
|
||||
exit 0
|
||||
else
|
||||
|
||||
# if no argument is given, we show all the participants
|
||||
db_participants_all=$(printf "$db_participants_all_template" "$from_time" "$until_time")
|
||||
mapfile -t participant_array < <(db_query "$db_participants_all")
|
||||
|
||||
# we only format the outrput if there are conferences to show
|
||||
if [[ "${#participant_array[@]}" -gt 0 ]]; then
|
||||
output=""
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nAll participants"
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
header+=" for the time period \"$IMPORTANT_TEXT$from_time - $until_time$NORMAL_TEXT\""
|
||||
fi
|
||||
header+="\n"
|
||||
echo -e "$header"
|
||||
output+="component\tparticipant ID\tconference ID\n"
|
||||
fi
|
||||
output="component\tparticipant ID\tconference ID\n"
|
||||
# prepare the formatted rows
|
||||
for row in "${participant_array[@]}"; do
|
||||
IFS='|' read -r jitsi_component endpoint_id conference_id <<< "$row"
|
||||
|
@ -906,49 +716,30 @@ elif [[ "$participant_option" == true ]]; then
|
|||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
else
|
||||
if [[ "$silent" != true ]]; then
|
||||
echo -n "No participants found"
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
echo -n " for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
echo "."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
|
||||
elif [[ "$time_option" == true ]]; then
|
||||
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
db_events_time=$(printf "$db_events_by_period_template" "$from_time" "$until_time" "$from_time" "$until_time")
|
||||
mapfile -t events_array < <(db_query "$db_events_time")
|
||||
|
||||
if [[ "${#events_array[@]}" -gt 0 ]]; then
|
||||
output=""
|
||||
--time)
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
echo "Events in the period $from_time - $until_time"
|
||||
db_events_time=$(printf "$db_events_by_period_template" "$from_time" "$until_time" "$from_time" "$until_time")
|
||||
mapfile -t events_array < <(db_query "$db_events_time")
|
||||
# prepare the header
|
||||
if [[ "$silent" != true ]]; then
|
||||
header="\nEvents in the period \"$IMPORTANT_TEXT$from_time - $until_time$NORMAL_TEXT\"\n"
|
||||
output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
echo -e "$header"
|
||||
fi
|
||||
output="time\tconference ID\tconference name\tconference host\tloglevel\tparticipant ID\tevent\tparameter\n"
|
||||
# prepare the formatted rows
|
||||
for row in "${events_array[@]}"; do
|
||||
IFS='|' read -r time conference_id conference_name conference_host loglevel event_type participant_id event_param <<< "$row"
|
||||
output+="$IMPORTANT_TEXT$time$NORMAL_TEXT\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$event_type\t$participant_id\t$event_param\n"
|
||||
output+="$time\t$conference_id\t$conference_name\t$conference_host\t$loglevel\t$event_type\t$participant_id\t$event_param\n"
|
||||
done
|
||||
# output
|
||||
echo -e "$output" | column -t -s $'\t'
|
||||
else
|
||||
if [[ "$silent" != true ]]; then
|
||||
echo -n "No events found"
|
||||
if [[ "$time_range_specified" == true ]]; then
|
||||
echo -n " for the time period \"$from_time - $until_time\""
|
||||
fi
|
||||
echo "."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
|
||||
fi
|
||||
*)
|
||||
echo -e "$help"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue