|
|
@ -26,11 +26,20 @@ main() {
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "h2. ## Audio/Video Call usage:"
|
|
|
|
echo "h2. ## Audio/Video Call usage:"
|
|
|
|
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: $(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) 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 "** 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 "** 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 ""
|
|
|
|
|
|
|
|
echo "h2. ## XMPP/IRC Bridge (Biboumi) usage:"
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo "* Total users: $(count_biboumi_users)"
|
|
|
|
|
|
|
|
echo "** Active: $(count_biboumi_active_users '1 MONTH')"
|
|
|
|
|
|
|
|
echo "** Inactive: $(count_biboumi_inactive_users '1 MONTH')"
|
|
|
|
|
|
|
|
echo "* Total messages stored (MAM): $(count_biboumi_archived_messages)"
|
|
|
|
|
|
|
|
echo "* Total channels active: $(count_biboumi_active_chan)"
|
|
|
|
|
|
|
|
echo "** through $(count_biboumi_active_servers) IRC server(s)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get_hard_quota() {
|
|
|
|
get_hard_quota() {
|
|
|
@ -90,7 +99,64 @@ count_removable_accounts() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
count_archived_messages() {
|
|
|
|
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}'
|
|
|
|
sudo -Hiu postgres psql biboumi -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}'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count_biboumi_users() {
|
|
|
|
|
|
|
|
# Accounts inactive *and* who never read the welcome message.
|
|
|
|
|
|
|
|
sql="select count(distinct owner_)
|
|
|
|
|
|
|
|
from muclogline_"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count_biboumi_active_users() {
|
|
|
|
|
|
|
|
# Accounts inactive *and* who never read the welcome message.
|
|
|
|
|
|
|
|
since=${1:-'1 MONTH'}
|
|
|
|
|
|
|
|
sql="select count(distinct owner_)
|
|
|
|
|
|
|
|
from muclogline_
|
|
|
|
|
|
|
|
where to_timestamp(date_) > current_timestamp - interval '${since}'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count_biboumi_inactive_users() {
|
|
|
|
|
|
|
|
# Accounts inactive *and* who never read the welcome message.
|
|
|
|
|
|
|
|
since=${1:-'1 MONTH'}
|
|
|
|
|
|
|
|
sql="select count(distinct owner_)
|
|
|
|
|
|
|
|
from muclogline_
|
|
|
|
|
|
|
|
where to_timestamp(date_) < current_timestamp - interval '${since}'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count_biboumi_archived_messages() {
|
|
|
|
|
|
|
|
# Accounts inactive *and* who never read the welcome message.
|
|
|
|
|
|
|
|
since=${1:-'1 MONTH'}
|
|
|
|
|
|
|
|
sql="select count(distinct body_)
|
|
|
|
|
|
|
|
from muclogline_"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count_biboumi_active_servers() {
|
|
|
|
|
|
|
|
# Accounts inactive *and* who never read the welcome message.
|
|
|
|
|
|
|
|
since=${1:-'1 MONTH'}
|
|
|
|
|
|
|
|
sql="select count(distinct ircservername_)
|
|
|
|
|
|
|
|
from muclogline_
|
|
|
|
|
|
|
|
where to_timestamp(date_) > current_timestamp - interval '${since}'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count_biboumi_active_chan() {
|
|
|
|
|
|
|
|
# Accounts inactive *and* who never read the welcome message.
|
|
|
|
|
|
|
|
since=${1:-'1 MONTH'}
|
|
|
|
|
|
|
|
sql="select count(distinct ircchanname_)
|
|
|
|
|
|
|
|
from muclogline_
|
|
|
|
|
|
|
|
where to_timestamp(date_) > current_timestamp - interval '${since}'"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get_last_month() {
|
|
|
|
get_last_month() {
|
|
|
@ -107,7 +173,7 @@ get_last_month() {
|
|
|
|
year="$(($(date +%Y)-1))"
|
|
|
|
year="$(($(date +%Y)-1))"
|
|
|
|
yearMonth="$year-$precedingMonth"
|
|
|
|
yearMonth="$year-$precedingMonth"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "$year-$precedingMonth"
|
|
|
|
echo $yearMonth
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get_total_UDP_turn_relayed_data() {
|
|
|
|
get_total_UDP_turn_relayed_data() {
|
|
|
@ -138,7 +204,7 @@ get_total_TLS_turn_relayed_data() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 | 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
|
|
|
|
if [ -z $n ]; then
|
|
|
|
echo 0
|
|
|
|
echo 0
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -147,7 +213,7 @@ get_max_UDP_turn_relayed_data() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 | 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
|
|
|
|
if [ -z $n ]; then
|
|
|
|
echo 0
|
|
|
|
echo 0
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -156,7 +222,7 @@ get_max_TCP_turn_relayed_data() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 | 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
|
|
|
|
if [ -z $n ]; then
|
|
|
|
echo 0
|
|
|
|
echo 0
|
|
|
|
else
|
|
|
|
else
|
|
|
|