Compare commits
No commits in common. "bd878b6cc2755c92b370a3ae230d0ffd67fb8d0a" and "e591ef175b60d429ffdb14c8b96f405c7b59b44e" have entirely different histories.
bd878b6cc2
...
e591ef175b
@ -22,16 +22,19 @@ main() {
|
|||||||
echo "* Total disk usage: $(du -sh ${STORAGE_DIR} | awk '{print $1}')"
|
echo "* Total disk usage: $(du -sh ${STORAGE_DIR} | awk '{print $1}')"
|
||||||
per_account_storage_usage
|
per_account_storage_usage
|
||||||
|
|
||||||
DATE=$(get_last_month)
|
|
||||||
echo ""
|
echo ""
|
||||||
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: $(zgrep DATE /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)"
|
echo "* Number of calls relayed: $(cat /var/log/ejabberd/ejabberd.log* | grep "Offering STUN/TURN services" | wc -l)"
|
||||||
echo "* Data relayed per protocol per call:"
|
echo "* Average 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: $(get_avg_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 "** TCP: $(get_avg_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 "** TLS over TCP: $(get_avg_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() {
|
||||||
@ -94,105 +97,34 @@ 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_last_month() {
|
|
||||||
if [ "$(date +%m)" -gt 1 ]; then
|
|
||||||
precedingMonth="$((10#$(date +%m)-1))"
|
|
||||||
year="$(date +%Y)"
|
|
||||||
if [ $precedingMonth -lt 10 ]; then
|
|
||||||
yearMonth="$year-0$precedingMonth"
|
|
||||||
else
|
|
||||||
yearMonth="$year-$precedingMonth"
|
|
||||||
fi
|
|
||||||
else [ "$(date +%m)" -eq 1 ]
|
|
||||||
precedingMonth=12
|
|
||||||
year="$(($(date +%Y)-1))"
|
|
||||||
yearMonth="$year-$precedingMonth"
|
|
||||||
fi
|
|
||||||
echo "$year-$precedingMonth"
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "UDP" | cut -d" " -f6-6 | paste -sd+ - | bc
|
||||||
if [ -z $n ]; then
|
|
||||||
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)
|
cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TCP" | cut -d" " -f6-6 | paste -sd+ - | bc
|
||||||
if [ -z $n ]; then
|
|
||||||
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)
|
cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TLS" | cut -d" " -f6-6 | paste -sd+ - | bc
|
||||||
if [ -z $n ]; then
|
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo $n
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
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 | tail -n 1)
|
|
||||||
if [ -z $n ]; then
|
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo $n
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
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 | tail -n 1)
|
|
||||||
if [ -z $n ]; then
|
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo $n
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
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 | tail -n 1)
|
|
||||||
if [ -z $n ]; then
|
|
||||||
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)
|
num=$(cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "UDP" | wc -l)
|
||||||
total=$(get_total_UDP_turn_relayed_data)
|
total=$(get_total_UDP_turn_relayed_data)
|
||||||
if [ $n -eq 0 ]; then
|
echo "scale=2; $total / $num" | bc -l
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo "scale=2; $total / $n" | bc -l
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
num=$(cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TCP" | wc -l)
|
||||||
total=$(get_total_TCP_turn_relayed_data)
|
total=$(get_total_TCP_turn_relayed_data)
|
||||||
if [ $n -eq 0 ]; then
|
echo "scale=2; $total / $num" | bc -l
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo "scale=2; $total / $n" | bc -l
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
num=$(cat /var/log/ejabberd/ejabberd.log* |grep "Relayed" | grep "TLS" | wc -l)
|
||||||
total=$(get_total_TLS_turn_relayed_data)
|
total=$(get_total_TLS_turn_relayed_data)
|
||||||
if [ $n -eq 0 ]; then
|
echo "scale=2; $total / $num" | bc -l
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo "scale=2; $total / $n" | bc -l
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
Loading…
Reference in New Issue
Block a user