Update rapport_activite/rapport_activites.sh

This commit is contained in:
Adrien Bourmault 2021-11-18 14:45:53 +00:00
parent 58a17409a0
commit ebe3a3739d
1 changed files with 12 additions and 12 deletions

View File

@ -69,7 +69,7 @@ count_active_accounts() {
where to_timestamp(cast(l.seconds as int)) > current_timestamp - interval '${since}' where to_timestamp(cast(l.seconds as int)) > current_timestamp - interval '${since}'
and l.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" and l.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')"
psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -u ejabberd psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_inactive_accounts() { count_inactive_accounts() {
@ -80,7 +80,7 @@ count_inactive_accounts() {
where to_timestamp(cast(l.seconds as int)) < current_timestamp - interval '${since}' where to_timestamp(cast(l.seconds as int)) < current_timestamp - interval '${since}'
and l.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" and l.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')"
psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -u ejabberd psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
@ -95,18 +95,18 @@ count_removable_accounts() {
and s.xml like '%from=''chalec.org'' xmlns=''jabber:client''%Bienvenue sur le serveur%' and s.xml like '%from=''chalec.org'' xmlns=''jabber:client''%Bienvenue sur le serveur%'
and s.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" and s.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')"
psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -u ejabberd psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_archived_messages() { count_archived_messages() {
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}' sudo -Hiu postgres sudo -u ejabberd 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() { count_biboumi_users() {
sql="select count(distinct owner_) sql="select count(distinct owner_)
from muclogline_" from muclogline_"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_biboumi_active_users() { count_biboumi_active_users() {
@ -121,7 +121,7 @@ count_biboumi_active_users() {
where m2.owner_ = m1.owner_ ) ) as m0 where m2.owner_ = m1.owner_ ) ) as m0
where to_timestamp(m0.date_) > current_timestamp - interval '${since}'" where to_timestamp(m0.date_) > current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_biboumi_active_external_users() { count_biboumi_active_external_users() {
@ -137,7 +137,7 @@ count_biboumi_active_external_users() {
where to_timestamp(m0.date_) > current_timestamp - interval '${since}' where to_timestamp(m0.date_) > current_timestamp - interval '${since}'
and m0.owner_ not like '%chalec.org%'" and m0.owner_ not like '%chalec.org%'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_biboumi_inactive_users() { count_biboumi_inactive_users() {
@ -152,7 +152,7 @@ count_biboumi_inactive_users() {
where m2.owner_ = m1.owner_ ) ) as m0 where m2.owner_ = m1.owner_ ) ) as m0
where to_timestamp(m0.date_) < current_timestamp - interval '${since}'" where to_timestamp(m0.date_) < current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_biboumi_inactive_external_users() { count_biboumi_inactive_external_users() {
@ -168,7 +168,7 @@ count_biboumi_inactive_external_users() {
where to_timestamp(m0.date_) < current_timestamp - interval '${since}' where to_timestamp(m0.date_) < current_timestamp - interval '${since}'
and m0.owner_ not like '%chalec.org%'" and m0.owner_ not like '%chalec.org%'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_biboumi_archived_messages() { count_biboumi_archived_messages() {
@ -176,7 +176,7 @@ count_biboumi_archived_messages() {
sql="select count(body_) sql="select count(body_)
from muclogline_" from muclogline_"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_biboumi_active_servers() { count_biboumi_active_servers() {
@ -185,7 +185,7 @@ count_biboumi_active_servers() {
from muclogline_ from muclogline_
where to_timestamp(date_) > current_timestamp - interval '${since}'" where to_timestamp(date_) > current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
count_biboumi_active_chan() { count_biboumi_active_chan() {
@ -194,7 +194,7 @@ count_biboumi_active_chan() {
from muclogline_ from muclogline_
where to_timestamp(date_) > current_timestamp - interval '${since}'" where to_timestamp(date_) > current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
get_last_month() { get_last_month() {