Adds "jitsi-component" service level events search in jilo-cli
parent
596028e5c2
commit
3f8a78db71
113
jilo-cli
113
jilo-cli
|
@ -90,7 +90,7 @@ JOIN (
|
||||||
) AS name_counts ON c.conference_name = name_counts.conference_name
|
) AS name_counts ON c.conference_name = name_counts.conference_name
|
||||||
JOIN
|
JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE (ce.time >= '%s' AND ce.time <= '%s')
|
WHERE (ce.time >= '%s 00:00:00' AND ce.time <= '%s 23:59:59')
|
||||||
ORDER BY
|
ORDER BY
|
||||||
c.id;"
|
c.id;"
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
c.conference_id = '%s'
|
c.conference_id = '%s'
|
||||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59')
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE
|
WHERE
|
||||||
c.conference_id = '%s'
|
c.conference_id = '%s'
|
||||||
AND (event_time >= '%s' AND event_time <= '%s')
|
AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
@ -158,7 +158,7 @@ LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
c.conference_name = '%s'
|
c.conference_name = '%s'
|
||||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59')
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE
|
WHERE
|
||||||
c.conference_name = '%s'
|
c.conference_name = '%s'
|
||||||
AND (event_time >= '%s' AND event_time <= '%s')
|
AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
@ -192,7 +192,7 @@ FROM
|
||||||
JOIN
|
JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
pe.time >= '%s' AND pe.time <= '%s'
|
pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59'
|
||||||
ORDER BY p.id;"
|
ORDER BY p.id;"
|
||||||
|
|
||||||
db_conference_by_participant_id_template="
|
db_conference_by_participant_id_template="
|
||||||
|
@ -215,7 +215,7 @@ LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
p.endpoint_id = '%s'
|
p.endpoint_id = '%s'
|
||||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59')
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE
|
WHERE
|
||||||
participant_id = '%s'
|
participant_id = '%s'
|
||||||
AND (event_time >= '%s' AND event_time <= '%s')
|
AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
@ -259,7 +259,7 @@ LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
c.conference_id = '%s'
|
c.conference_id = '%s'
|
||||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59')
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE
|
WHERE
|
||||||
ce.conference_id = '%s'
|
ce.conference_id = '%s'
|
||||||
AND (event_time >= '%s' AND event_time <= '%s')
|
AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
@ -303,7 +303,7 @@ LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
c.conference_name LIKE '%%%s%%'
|
c.conference_name LIKE '%%%s%%'
|
||||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59')
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ FROM
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE c.conference_name LIKE '%%%s%%'
|
WHERE c.conference_name LIKE '%%%s%%'
|
||||||
AND (event_time >= '%s' AND event_time <= '%s')
|
AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
@ -346,7 +346,7 @@ LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
pe.event_type = 'stats_id' AND pe.event_param LIKE '%%%s%%'
|
pe.event_type = 'stats_id' AND pe.event_param LIKE '%%%s%%'
|
||||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59')
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE
|
WHERE
|
||||||
event_type = 'stats_id' AND event_param LIKE '%%%s%%'
|
event_type = 'stats_id' AND event_param LIKE '%%%s%%'
|
||||||
AND (event_time >= '%s' AND event_time <= '%s')
|
AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
@ -390,7 +390,7 @@ LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
pe.event_type = 'pair selected' AND pe.event_param = '%s'
|
pe.event_type = 'pair selected' AND pe.event_param = '%s'
|
||||||
AND (pe.time >= '%s' AND pe.time <= '%s')
|
AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59')
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -409,11 +409,27 @@ LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE
|
WHERE
|
||||||
event_type = 'pair selected' AND event_param = '%s'
|
event_type = 'pair selected' AND event_param = '%s'
|
||||||
AND (event_time >= '%s' AND event_time <= '%s')
|
AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
|
||||||
|
## jitsi component related
|
||||||
|
|
||||||
|
# we use "jitsi_component = %s" (without quotes)
|
||||||
|
# to re-use the query for all components ("jitsi_component = jitsi_component")
|
||||||
|
# for specific component the single quotes are added upon loading the template
|
||||||
|
db_jitsi_components_template="
|
||||||
|
SELECT jitsi_component, loglevel, time, component_id, event_type, event_param
|
||||||
|
FROM
|
||||||
|
jitsi_components
|
||||||
|
WHERE
|
||||||
|
jitsi_component = %s
|
||||||
|
AND
|
||||||
|
(time >= '%s 00:00:00' AND time <= '%s 23:59:59')
|
||||||
|
ORDER BY
|
||||||
|
time;"
|
||||||
|
|
||||||
## time period related
|
## time period related
|
||||||
|
|
||||||
db_events_by_period_template="
|
db_events_by_period_template="
|
||||||
|
@ -435,7 +451,7 @@ LEFT JOIN
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
participant_events pe ON p.endpoint_id = pe.participant_id
|
participant_events pe ON p.endpoint_id = pe.participant_id
|
||||||
WHERE
|
WHERE
|
||||||
pe.time >= '%s' AND pe.time <= '%s'
|
pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59'
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
@ -453,7 +469,7 @@ FROM
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
conference_events ce ON c.conference_id = ce.conference_id
|
conference_events ce ON c.conference_id = ce.conference_id
|
||||||
WHERE
|
WHERE
|
||||||
event_time >= '%s' AND event_time <= '%s'
|
event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59'
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
pe.time;"
|
pe.time;"
|
||||||
|
@ -464,7 +480,8 @@ help="Usage:
|
||||||
Options:
|
Options:
|
||||||
--conference|-c [conference ID or name] - show specific conference(s), all of empty
|
--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
|
--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
|
--jitsi-component|-j [jvb|jicofo] - show service level events
|
||||||
|
--time|-t - show stats for a time interval; can be use separately ot together with -c, -p, or -j
|
||||||
--verbose|-v - show more details, when available
|
--verbose|-v - show more details, when available
|
||||||
--silent|-s - show less details, more suitable for scripting
|
--silent|-s - show less details, more suitable for scripting
|
||||||
--help|-h - show this help message
|
--help|-h - show this help message
|
||||||
|
@ -616,6 +633,8 @@ conference_arg=""
|
||||||
conference_option=false
|
conference_option=false
|
||||||
participant_arg=""
|
participant_arg=""
|
||||||
participant_option=false
|
participant_option=false
|
||||||
|
component_arg=""
|
||||||
|
component_option=false
|
||||||
from_time="0000-00-00"
|
from_time="0000-00-00"
|
||||||
until_time="9999-12-31"
|
until_time="9999-12-31"
|
||||||
time_option=false
|
time_option=false
|
||||||
|
@ -648,6 +667,15 @@ while [[ $# -gt 0 ]]; do
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
-j | --jitsi-component)
|
||||||
|
component_option=true
|
||||||
|
if [[ -n "$2" && "$2" != -* ]]; then
|
||||||
|
component_arg="$2"
|
||||||
|
shift 2
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
-t | --time)
|
-t | --time)
|
||||||
time_option=true
|
time_option=true
|
||||||
if [[ -n "$2" && "$2" != -* ]]; then
|
if [[ -n "$2" && "$2" != -* ]]; then
|
||||||
|
@ -965,6 +993,53 @@ elif [[ "$participant_option" == true ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
elif [[ "$component_option" == true ]]; then
|
||||||
|
|
||||||
|
# argument for "--jitsi-component | -j" can be "jvb", "jicofo"
|
||||||
|
if [[ -n "$component_arg" ]]; then
|
||||||
|
case "$component_arg" in
|
||||||
|
jvb)
|
||||||
|
jitsi_component="'JVB'"
|
||||||
|
;;
|
||||||
|
jicofo)
|
||||||
|
jitsi_component="'JICOFO'"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# we have a component events search, but an unknown component string
|
||||||
|
# exiting with error, it's not a recognized option argument
|
||||||
|
echo "Invalid option: $component_arg" >&2
|
||||||
|
echo -e "$help"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
header="\nJitsi components events for \"$IMPORTANT_TEXT$jitsi_component$NORMAL_TEXT\""
|
||||||
|
|
||||||
|
else
|
||||||
|
jitsi_component="jitsi_component"
|
||||||
|
header="\nJitsi components events for \"$IMPORTANT_TEXT all components$NORMAL_TEXT\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
db_jitsi_components=$(printf "$db_jitsi_components_template" "$jitsi_component" "$from_time" "$until_time")
|
||||||
|
mapfile -t jitsi_components < <(db_query "$db_jitsi_components")
|
||||||
|
|
||||||
|
output=""
|
||||||
|
# prepare the header
|
||||||
|
if [[ "$silent" != true ]]; then
|
||||||
|
if [[ "$time_range_specified" == true ]]; then
|
||||||
|
header+=" for the time period \"$from_time - $until_time\""
|
||||||
|
fi
|
||||||
|
header+="\n"
|
||||||
|
echo -e "$header"
|
||||||
|
output+="jitsi_component\tloglevel\ttime\tcomponent ID\tevent\tparameter\n"
|
||||||
|
fi
|
||||||
|
# prepare the formatted rows
|
||||||
|
for row in "${jitsi_components[@]}"; do
|
||||||
|
IFS='|' read -r jitsi_component loglevel time component_id event_type event_param <<< "$row"
|
||||||
|
output+="$jitsi_component\t$loglevel\t$time\t$component_id\t$event_type\t$event_param\n"
|
||||||
|
done
|
||||||
|
# output
|
||||||
|
echo -e "$output" | column -t -s $'\t'
|
||||||
|
|
||||||
elif [[ "$time_option" == true ]]; then
|
elif [[ "$time_option" == true ]]; then
|
||||||
|
|
||||||
if [[ "$time_range_specified" == true ]]; then
|
if [[ "$time_range_specified" == true ]]; then
|
||||||
|
|
Loading…
Reference in New Issue