better a/v call stats

This commit is contained in:
root 2021-06-30 22:04:11 +02:00
parent 86f411ef92
commit 4d6fd9ef5a

View File

@ -9,7 +9,7 @@ main() {
echo "** Active: $(count_active_accounts)" echo "** Active: $(count_active_accounts)"
echo "** Inactive: $(count_inactive_accounts '1 MONTH')" echo "** Inactive: $(count_inactive_accounts '1 MONTH')"
echo "** Removable: $(count_removable_accounts '6 MONTHS')" echo "** Removable: $(count_removable_accounts '6 MONTHS')"
echo "* Total messages stored (MAM): $(count_archived_messages) " # echo "* Total messages stored (MAM): $(count_archived_messages) "
echo "* Total rooms active: $(sudo -u ejabberd ejabberdctl muc_online_rooms global | wc -l)" echo "* Total rooms active: $(sudo -u ejabberd ejabberdctl muc_online_rooms global | wc -l)"
echo "" echo ""
echo "_* Inactive accounts:_ no connection during last month" echo "_* Inactive accounts:_ no connection during last month"
@ -26,20 +26,20 @@ main() {
echo "" echo ""
echo "h2. ## Audio/Video Call usage:" echo "h2. ## Audio/Video Call usage:"
echo "" echo ""
echo "* Total calls relayed: $(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)" echo "* Total calls: $(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)"
echo "* Data relayed per protocol per call:" echo "* Data relayed per protocol per call:"
echo "** UDP: avg $(get_avg_UDP_turn_relayed_data) KiB, max $(get_max_UDP_turn_relayed_data) KiB, total $(get_total_UDP_turn_relayed_data) KiB" echo "** UDP: avg $(get_avg_UDP_turn_relayed_data) MiB, max $(get_max_UDP_turn_relayed_data) MiB, total $(get_total_UDP_turn_relayed_data) MiB"
echo "** TCP: avg $(get_avg_TCP_turn_relayed_data) KiB, max $(get_max_TCP_turn_relayed_data) KiB, total $(get_total_TCP_turn_relayed_data) KiB" echo "** TCP: avg $(get_avg_TCP_turn_relayed_data) MiB, max $(get_max_TCP_turn_relayed_data) MiB, total $(get_total_TCP_turn_relayed_data) MiB"
echo "** TLS: avg $(get_avg_TLS_turn_relayed_data) KiB, max $(get_max_TLS_turn_relayed_data) KiB, total $(get_total_TLS_turn_relayed_data) KiB" echo "** TLS: avg $(get_avg_TLS_turn_relayed_data) MiB, max $(get_max_TLS_turn_relayed_data) MiB, total $(get_total_TLS_turn_relayed_data) MiB"
echo "" echo ""
echo "h2. ## XMPP/IRC Bridge (Biboumi) usage:" echo "h2. ## XMPP/IRC Bridge (Biboumi) usage:"
echo "" echo ""
echo "* Total channels active: $(count_biboumi_active_chan)" echo "* Total channels active: $(count_biboumi_active_chan)"
echo "** through $(count_biboumi_active_servers) IRC server(s)" echo "** through $(count_biboumi_active_servers) IRC server(s)"
echo "* Total users: $(count_biboumi_users)" echo "* Total users: $(count_biboumi_users)"
echo "** Active: $(count_biboumi_active_users '1 MONTH') (External accounts: $(count_biboumi_active_external_users '1 MONTH'))" # echo "** Active: $(count_biboumi_active_users '1 MONTH') (External accounts: $(count_biboumi_active_external_users '1 MONTH'))"
echo "** Inactive: $(count_biboumi_inactive_users '1 MONTH') (External accounts: $(count_biboumi_inactive_external_users '1 MONTH'))" # echo "** Inactive: $(count_biboumi_inactive_users '1 MONTH') (External accounts: $(count_biboumi_inactive_external_users '1 MONTH'))"
echo "* Total messages stored (MAM): $(count_biboumi_archived_messages)" # echo "* Total messages stored (MAM): $(count_biboumi_archived_messages)"
} }
get_hard_quota() { get_hard_quota() {
@ -216,60 +216,36 @@ get_last_month() {
get_total_UDP_turn_relayed_data() { get_total_UDP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | paste -sd+ - | bc) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | paste -sd+ - | bc)
if [ -z $n ]; then echo "scale=4; $n / 1024" | bc -l
echo 0
else
echo $n
fi
} }
get_total_TCP_turn_relayed_data() { get_total_TCP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | paste -sd+ - | bc) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | paste -sd+ - | bc)
if [ -z $n ]; then echo "scale=4; $n / 1024" | bc -l
echo 0
else
echo $n
fi
} }
get_total_TLS_turn_relayed_data() { get_total_TLS_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | paste -sd+ - | bc) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | paste -sd+ - | bc)
if [ -z $n ]; then echo "scale=4; $n / 1024" | bc -l
echo 0
else
echo $n
fi
} }
get_max_UDP_turn_relayed_data() { get_max_UDP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | sort -g | tail -n 1) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | sort -g | tail -n 1)
if [ -z $n ]; then echo "scale=4; $n / 1024" | bc -l
echo 0
else
echo $n
fi
} }
get_max_TCP_turn_relayed_data() { get_max_TCP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | sort -g | tail -n 1) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | sort -g | tail -n 1)
if [ -z $n ]; then echo "scale=4; $n / 1024" | bc -l
echo 0
else
echo $n
fi
} }
get_max_TLS_turn_relayed_data() { get_max_TLS_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | sort -g | tail -n 1) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | sort -g | tail -n 1)
if [ -z $n ]; then echo "scale=4; $n / 1024" | bc -l
echo 0
else
echo $n
fi
} }
get_avg_UDP_turn_relayed_data() { get_avg_UDP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "UDP" | wc -l) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)
total=$(get_total_UDP_turn_relayed_data) total=$(get_total_UDP_turn_relayed_data)
if [ $n -eq 0 ]; then if [ $n -eq 0 ]; then
echo 0 echo 0
@ -279,7 +255,7 @@ get_avg_UDP_turn_relayed_data() {
} }
get_avg_TCP_turn_relayed_data() { get_avg_TCP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TCP" | wc -l) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)
total=$(get_total_TCP_turn_relayed_data) total=$(get_total_TCP_turn_relayed_data)
if [ $n -eq 0 ]; then if [ $n -eq 0 ]; then
echo 0 echo 0
@ -289,7 +265,7 @@ get_avg_TCP_turn_relayed_data() {
} }
get_avg_TLS_turn_relayed_data() { get_avg_TLS_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TLS" | wc -l) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)
total=$(get_total_TLS_turn_relayed_data) total=$(get_total_TLS_turn_relayed_data)
if [ $n -eq 0 ]; then if [ $n -eq 0 ]; then
echo 0 echo 0