From 4d6fd9ef5aa5d7c9b4132cd22e08acaadd111fe9 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Jun 2021 22:04:11 +0200 Subject: [PATCH] better a/v call stats --- rapport_activite/rapport_activites.sh | 58 ++++++++------------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/rapport_activite/rapport_activites.sh b/rapport_activite/rapport_activites.sh index fc41ebf..a406912 100755 --- a/rapport_activite/rapport_activites.sh +++ b/rapport_activite/rapport_activites.sh @@ -9,7 +9,7 @@ main() { echo "** Active: $(count_active_accounts)" echo "** Inactive: $(count_inactive_accounts '1 MONTH')" 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 "" echo "_* Inactive accounts:_ no connection during last month" @@ -26,20 +26,20 @@ main() { echo "" echo "h2. ## Audio/Video Call usage:" 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 "** 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 "** 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 "** 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 "** 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) 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) MiB, max $(get_max_TLS_turn_relayed_data) MiB, total $(get_total_TLS_turn_relayed_data) MiB" echo "" echo "h2. ## XMPP/IRC Bridge (Biboumi) usage:" echo "" echo "* Total channels active: $(count_biboumi_active_chan)" echo "** through $(count_biboumi_active_servers) IRC server(s)" echo "* Total users: $(count_biboumi_users)" - 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 "* Total messages stored (MAM): $(count_biboumi_archived_messages)" +# 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 "* Total messages stored (MAM): $(count_biboumi_archived_messages)" } get_hard_quota() { @@ -216,60 +216,36 @@ get_last_month() { 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) - if [ -z $n ]; then - echo 0 - else - echo $n - fi + echo "scale=4; $n / 1024" | bc -l } 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) - if [ -z $n ]; then - echo 0 - else - echo $n - fi + echo "scale=4; $n / 1024" | bc -l } 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) - if [ -z $n ]; then - echo 0 - else - echo $n - fi + echo "scale=4; $n / 1024" | bc -l } 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) - if [ -z $n ]; then - echo 0 - else - echo $n - fi + echo "scale=4; $n / 1024" | bc -l } 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) - if [ -z $n ]; then - echo 0 - else - echo $n - fi + echo "scale=4; $n / 1024" | bc -l } 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) - if [ -z $n ]; then - echo 0 - else - echo $n - fi + echo "scale=4; $n / 1024" | bc -l } 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) if [ $n -eq 0 ]; then echo 0 @@ -279,7 +255,7 @@ get_avg_UDP_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) if [ $n -eq 0 ]; then echo 0 @@ -289,7 +265,7 @@ get_avg_TCP_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) if [ $n -eq 0 ]; then echo 0