Adaptation to log rotation and more infos for calls
This commit is contained in:
parent
e591ef175b
commit
81cf0d9fbe
|
@ -26,15 +26,11 @@ main() {
|
||||||
echo "h2. ## Audio/Video Call usage:"
|
echo "h2. ## Audio/Video Call usage:"
|
||||||
# Dans la config actuelle de logrotate, le log du mois dernier est stocké en tete clair, et tous les autres sont compressés par gzip. Un cat ne sortira de texte lisible que pour les fichiers en clair soit forcément celui du mois précédent
|
# Dans la config actuelle de logrotate, le log du mois dernier est stocké en tete clair, et tous les autres sont compressés par gzip. Un cat ne sortira de texte lisible que pour les fichiers en clair soit forcément celui du mois précédent
|
||||||
echo ""
|
echo ""
|
||||||
echo "* Number of calls relayed: $(cat /var/log/ejabberd/ejabberd.log* | grep "Offering STUN/TURN services" | wc -l)"
|
echo "* Number of calls relayed: $(ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Offering stun" | wc -l)"
|
||||||
echo "* Average data relayed per protocol per call:"
|
echo "* Data relayed per protocol per call:"
|
||||||
echo "** UDP: $(get_avg_UDP_turn_relayed_data) KiB"
|
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: $(get_avg_TCP_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 over TCP: $(get_avg_TLS_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 "* Total data relayed per protocol:"
|
|
||||||
echo "** UDP: $(get_total_UDP_turn_relayed_data) KiB"
|
|
||||||
echo "** TCP: $(get_total_TCP_turn_relayed_data) KiB"
|
|
||||||
echo "** TLS over TCP: $(get_total_TLS_turn_relayed_data) KiB"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_hard_quota() {
|
get_hard_quota() {
|
||||||
|
@ -97,32 +93,47 @@ count_archived_messages() {
|
||||||
psql -U ejabberd -h localhost ejabberd -c "select count(*) from archive where peer not like 'irc%' and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" -t | grep -v '^$' | awk '{print $1}'
|
psql -U ejabberd -h localhost ejabberd -c "select count(*) from archive where peer not like 'irc%' and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" -t | grep -v '^$' | awk '{print $1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_stunstats_from_log() {
|
||||||
|
ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Offering stun"
|
||||||
|
}
|
||||||
get_total_UDP_turn_relayed_data() {
|
get_total_UDP_turn_relayed_data() {
|
||||||
cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "UDP" | cut -d" " -f6-6 | paste -sd+ - | bc
|
ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | paste -sd+ - | bc
|
||||||
}
|
}
|
||||||
|
|
||||||
get_total_TCP_turn_relayed_data() {
|
get_total_TCP_turn_relayed_data() {
|
||||||
cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TCP" | cut -d" " -f6-6 | paste -sd+ - | bc
|
ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | paste -sd+ - | bc
|
||||||
}
|
}
|
||||||
|
|
||||||
get_total_TLS_turn_relayed_data() {
|
get_total_TLS_turn_relayed_data() {
|
||||||
cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TLS" | cut -d" " -f6-6 | paste -sd+ - | bc
|
ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | paste -sd+ - | bc
|
||||||
|
}
|
||||||
|
|
||||||
|
get_max_UDP_turn_relayed_data() {
|
||||||
|
ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | sort | tail -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_max_TCP_turn_relayed_data() {
|
||||||
|
ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | sort | tail -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_max_TLS_turn_relayed_data() {
|
||||||
|
ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | paste -sd+ - | sort | tail -n 1
|
||||||
}
|
}
|
||||||
|
|
||||||
get_avg_UDP_turn_relayed_data() {
|
get_avg_UDP_turn_relayed_data() {
|
||||||
num=$(cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "UDP" | wc -l)
|
num=$(ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "UDP" | wc -l)
|
||||||
total=$(get_total_UDP_turn_relayed_data)
|
total=$(get_total_UDP_turn_relayed_data)
|
||||||
echo "scale=2; $total / $num" | bc -l
|
echo "scale=2; $total / $num" | bc -l
|
||||||
}
|
}
|
||||||
|
|
||||||
get_avg_TCP_turn_relayed_data() {
|
get_avg_TCP_turn_relayed_data() {
|
||||||
num=$(cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TCP" | wc -l)
|
num=$(ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "TCP" | wc -l)
|
||||||
total=$(get_total_TCP_turn_relayed_data)
|
total=$(get_total_TCP_turn_relayed_data)
|
||||||
echo "scale=2; $total / $num" | bc -l
|
echo "scale=2; $total / $num" | bc -l
|
||||||
}
|
}
|
||||||
|
|
||||||
get_avg_TLS_turn_relayed_data() {
|
get_avg_TLS_turn_relayed_data() {
|
||||||
num=$(cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TLS" | wc -l)
|
num=$(ls -1tr /var/log/ejabberd/ejabberd.log* | tail -n 5 | xargs zcat -f | grep -i -e "Relayed" | grep "TLS" | wc -l)
|
||||||
total=$(get_total_TLS_turn_relayed_data)
|
total=$(get_total_TLS_turn_relayed_data)
|
||||||
echo "scale=2; $total / $num" | bc -l
|
echo "scale=2; $total / $num" | bc -l
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue