Addition of the used disk space (total and user) in the report.
This commit is contained in:
parent
404eb546ff
commit
0296b4218b
@ -62,7 +62,6 @@ writeStatValue()
|
||||
|
||||
|
||||
# Read and store the current service state
|
||||
# If something fails,
|
||||
NEXTCLOUD_STATE=`curl --silent --netrc-file ${CURL_CREDENTIAL} http://localhost/ocs/v2.php/apps/serverinfo/api/v1/info?format=json`
|
||||
|
||||
# Extraction of Nextcloud important values
|
||||
@ -71,14 +70,21 @@ 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")
|
||||
USED_DISK_BYTES=$(du -sb "${VALISE_BASE_DIR}/data"|cut -f 1)
|
||||
USED_DISK_GB=$(( (${USED_DISK_BYTES}) / (1024*1024*1024) ))
|
||||
USED_DISK_USER_BYTES=$(du -sb --exclude="${VALISE_UPDATER_DIR}" --exclude="${VALISE_BASE_DIR}/data/*.log" "${VALISE_BASE_DIR}/data"|cut -f 1)
|
||||
USED_DISK_USER_GB=$(( (${USED_DISK_USER_BYTES}) / (1024*1024*1024) ))
|
||||
FREE_DISK_GB=$(( $(getNcState "nextcloud.system.freespace") / (1024*1024*1024) ))
|
||||
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
|
||||
USED_DISK_GB_P=0
|
||||
USED_DISK_USER_GB_P=0
|
||||
FREE_DISK_GB_P=0
|
||||
DATABASE_SIZE_MB_P=0
|
||||
|
||||
@ -93,9 +99,12 @@ 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 "USED_DISK_GB_P="${USED_DISK_GB} >> ${VALISE_STATS_FILE}
|
||||
echo "USED_DISK_USER_GB_P="${USED_DISK_USER_GB} >> ${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}
|
||||
|
||||
|
||||
# Generate report
|
||||
echo "Rapport d'activité du service valise.chapril.org au "`date "+%-d %B %Y"`
|
||||
echo
|
||||
@ -105,6 +114,8 @@ writeStatValue "Nombre d'utilisateurs" "" ${NB_OF_USERS} ${NB_OF_USERS_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 occupé total" "Go" ${USED_DISK_GB} ${USED_DISK_GB_P}
|
||||
writeStatValue "Espace disque occupé par les utilisateurs" "Go" ${USED_DISK_USER_GB} ${USED_DISK_USER_GB_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}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user