24
0
Fork 0

counting profiles with a psql request

This commit is contained in:
Tykayn 2021-06-02 10:57:38 +02:00 committed by tykayn
parent b70c75eead
commit fed23af3d4
2 changed files with 17 additions and 2 deletions

0
rapport_activite/bdd.sh Normal file
View File

View File

@ -101,6 +101,12 @@ generateSpecificReport()
errorsCount=$(zgrep -h "$errorLogFormatDate" $LOG_PREFIX-error.log*|wc -l )
# trier par passage à la création
# schéma recherché dans les logs d'accès : mobilizon.chapril.org/events/create
# trier par passage à la suppression
# schéma recherché dans les logs d'accès :
ipv4UserCount=$(zgrep -h "$accessLogFormatDate" $LOG_PREFIX-access.log*|grep "$year"|grep -vi bot|grep -v check_http|egrep "^$IPV4_PATTERN " | cut -d' ' -f 1|sort|uniq|wc -l )
echo "Nombre d'ipv4 utilisatrices du service = $ipv4UserCount"
@ -117,9 +123,18 @@ generateSpecificReport()
echo "Nombre de commentaires locaux = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfLocalComments" -u)"
echo "Nombre d'instances abonnées = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfInstanceFollowers" -u)"
echo "Nombre d'instances suivies = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfInstanceFollowings" -u)"
echo "Nombre d'utilisateurices selon l'api = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfUsers" -u)"
# vérifier si les comptes incluent les identités différentes
echo "Nombre de comptes selon l'api = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfUsers" -u)"
# décompte des profils
DAY_INTERVAL=300;
profiles_all_time=$(sudo -u postgres -H -- psql -d mobilizon_prod -c "SELECT count(user_id) FROM actors WHERE type='Person' AND user_id is not null AND inserted_at >= ('now'::date - '$DAY_INTERVAL day'::interval )" -t | grep -v '^$' | awk '{print $1}' )
DAY_INTERVAL=30;
profiles_created_last_month=$(sudo -u postgres -H -- psql -d mobilizon_prod -c "SELECT count(user_id) FROM actors WHERE type='Person' AND user_id is not null AND inserted_at >= ('now'::date - '$DAY_INTERVAL day'::interval )" -t | grep -v '^$' | awk '{print $1}' )
echo "Nombre de profils en tout = $profiles_all_time"
echo "Nombre de profils créés ces 30 derniers jours = $profiles_created_last_month"
echo
}
#