From 404eb546fff4d3138c25740d6755fe9e875afea1 Mon Sep 17 00:00:00 2001 From: lpoujoulat Date: Tue, 31 Mar 2020 10:26:00 +0200 Subject: [PATCH] Addition of the number of user files in the activity report --- rapports_activites/rapport_activites.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rapports_activites/rapport_activites.sh b/rapports_activites/rapport_activites.sh index 8d434e1..2762905 100755 --- a/rapports_activites/rapport_activites.sh +++ b/rapports_activites/rapport_activites.sh @@ -23,10 +23,12 @@ # and writes a plain text report on stdout # ============================================ -# Configuration file +# Configuration data CURL_CREDENTIAL="/etc/valise.chapril.org/curl_credential" VALISE_STATS_DIR="/var/lib/valise.chapril.org" VALISE_STATS_FILE="${VALISE_STATS_DIR}/stats" +VALISE_BASE_DIR="/var/www/valise.chapril.org" +VALISE_UPDATER_DIR="${VALISE_BASE_DIR}/data/updater-oc30zo96k0y3" # Extract a json value by path (given as argument) # The global JSON state is expected to be in NEXTCLOUD_STATE @@ -66,6 +68,8 @@ NEXTCLOUD_STATE=`curl --silent --netrc-file ${CURL_CREDENTIAL} http://localhost/ # Extraction of Nextcloud important values NB_OF_USERS=$(getNcState "nextcloud.storage.num_users") NB_OF_FILES=$(getNcState "nextcloud.storage.num_files") +NB_OF_UPDATER_FILES=$(find ${VALISE_UPDATER_DIR} -type f|wc -l) +NB_OF_USER_FILES=$(( (${NB_OF_FILES}) - (${NB_OF_UPDATER_FILES}) - 4 )) NB_OF_SHARES=$(getNcState "nextcloud.shares.num_shares") FREE_DISK_GB=$(( $(getNcState "nextcloud.system.freespace") / (1024*1024*1024) )) DATABASE_SIZE_MB=$(( $(getNcState "server.database.size") / (1024*1024) )) @@ -73,6 +77,7 @@ DATABASE_SIZE_MB=$(( $(getNcState "server.database.size") / (1024*1024) )) # Get previous values NB_OF_USERS_P=0 NB_OF_FILES_P=0 +NB_OF_USER_FILES_P=0 NB_OF_SHARES_P=0 FREE_DISK_GB_P=0 DATABASE_SIZE_MB_P=0 @@ -86,6 +91,7 @@ fi mkdir -p ${VALISE_STATS_DIR} echo "NB_OF_USERS_P="${NB_OF_USERS} >> ${VALISE_STATS_FILE} echo "NB_OF_FILES_P="${NB_OF_FILES} >> ${VALISE_STATS_FILE} +echo "NB_OF_USER_FILES_P="${NB_OF_USER_FILES} >> ${VALISE_STATS_FILE} echo "NB_OF_SHARES_P="${NB_OF_SHARES} >> ${VALISE_STATS_FILE} echo "FREE_DISK_GB_P="${FREE_DISK_GB} >> ${VALISE_STATS_FILE} echo "DATABASE_SIZE_MB_P="${DATABASE_SIZE_MB} >> ${VALISE_STATS_FILE} @@ -96,7 +102,8 @@ echo echo "=================================================================" echo writeStatValue "Nombre d'utilisateurs" "" ${NB_OF_USERS} ${NB_OF_USERS_P} -writeStatValue "Nombre de fichiers" "" ${NB_OF_FILES} ${NB_OF_FILES_P} +writeStatValue "Nombre total de fichiers" "" ${NB_OF_FILES} ${NB_OF_FILES_P} +writeStatValue "Nombre de fichiers utilisateurs" "" ${NB_OF_USER_FILES} ${NB_OF_USER_FILES_P} writeStatValue "Nombre de partages" "" ${NB_OF_SHARES} ${NB_OF_SHARES_P} writeStatValue "Espace disque disponible" "Go" ${FREE_DISK_GB} ${FREE_DISK_GB_P} writeStatValue "Espace occupé par la base de données" "Mo" ${DATABASE_SIZE_MB} ${DATABASE_SIZE_MB_P}