Browse Source

Do not count IRC users in MAM stats, better IRC stats with external accounts

master
Adrien Bourmault 10 months ago
committed by root
parent
commit
0cb00d90d8
  1. 38
      rapport_activite/rapport_activites.sh

38
rapport_activite/rapport_activites.sh

@ -34,12 +34,12 @@ main() {
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)"
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)"
}
get_hard_quota() {
@ -99,11 +99,10 @@ count_removable_accounts() {
}
count_archived_messages() {
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}'
sudo -Hiu postgres psql 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}'
}
count_biboumi_users() {
# Accounts inactive *and* who never read the welcome message.
sql="select count(distinct owner_)
from muclogline_"
@ -111,7 +110,6 @@ count_biboumi_users() {
}
count_biboumi_active_users() {
# Accounts inactive *and* who never read the welcome message.
since=${1:-'1 MONTH'}
sql="select count(distinct owner_)
from muclogline_
@ -120,8 +118,17 @@ count_biboumi_active_users() {
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_active_external_users() {
since=${1:-'1 MONTH'}
sql="select count(distinct owner_)
from muclogline_
where muclogline_.owner_ not like '%chapril.org%'
and 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_
@ -130,17 +137,25 @@ count_biboumi_inactive_users() {
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_inactive_external_users() {
since=${1:-'1 MONTH'}
sql="select count(distinct owner_)
from muclogline_
where muclogline_.owner_ not like '%chapril.org%'
and 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_)
sql="select count(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_
@ -150,7 +165,6 @@ count_biboumi_active_servers() {
}
count_biboumi_active_chan() {
# Accounts inactive *and* who never read the welcome message.
since=${1:-'1 MONTH'}
sql="select count(distinct ircchanname_)
from muclogline_

Loading…
Cancel
Save