From fed23af3d42e4e0ec5142600725bd3ae10d0dde0 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 2 Jun 2021 10:57:38 +0200 Subject: [PATCH] counting profiles with a psql request --- rapport_activite/bdd.sh | 0 rapport_activite/rapport_activite.sh | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 rapport_activite/bdd.sh diff --git a/rapport_activite/bdd.sh b/rapport_activite/bdd.sh new file mode 100644 index 0000000..e69de29 diff --git a/rapport_activite/rapport_activite.sh b/rapport_activite/rapport_activite.sh index 753bb51..6a64c13 100755 --- a/rapport_activite/rapport_activite.sh +++ b/rapport_activite/rapport_activite.sh @@ -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 } #