New metrics for XMPP IRC Bridge (Biboumi)

This commit is contained in:
root 2021-02-08 20:31:02 +01:00
parent 3e3c2753aa
commit dd3a70f548
1 changed files with 67 additions and 1 deletions

View File

@ -31,6 +31,15 @@ main() {
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() {