Completed the mumble specific activity report

This commit is contained in:
Laurent Poujoulat 2020-04-27 16:20:37 +02:00 committed by root
parent c4e5501b47
commit 513b5d9e14

View File

@ -25,7 +25,7 @@
# Configuration data # Configuration data
MUMBLE_STATS_DIR="/var/lib/mumble.chapril.org" MUMBLE_STATS_DIR="/var/lib/mumble.chapril.org"
MUMBLE_STATS_FILE="${VALISE_STATS_DIR}/stats" MUMBLE_STATS_FILE="${MUMBLE_STATS_DIR}/stats"
# Format statistic value for the report # Format statistic value for the report
writeStatValue() writeStatValue()
@ -53,16 +53,19 @@ writeStatValue()
# Extraction mumble important values # Extraction mumble important values
NB_OF_USERS=0 NB_OF_USERS=0
NB_OF_CONNECTIONS=0 NB_OF_CONNECTIONS=0
NB_OF_ROOMS=0
# Work out iso date match for prev month # Work out iso date match for prev month
PREV_MONTH_MATCH=$(date +%Y-%m -d "1 month ago") PREV_MONTH_MATCH=$(date +%Y-%m -d "1 month ago")
NB_OF_CONNECTIONS=$(grep -hE "<W>${PREV_MONTH_MATCH}.*New connection" /var/log/mumble-server/*.log.*|wc -l) NB_OF_CONNECTIONS=$(grep -hE "<W>${PREV_MONTH_MATCH}.*New connection" /var/log/mumble-server/*.log.*|wc -l)
NB_OF_USERS=$(grep -hE "<W>${PREV_MONTH_MATCH}.*Authenticated" /var/log/mumble-server/*.log.*|grep -hEo "<[0-9]+\:.*\(-1\)"|grep -hEo "\:.*"|sort|uniq|wc -l) NB_OF_USERS=$(grep -hE "<W>${PREV_MONTH_MATCH}.*Authenticated" /var/log/mumble-server/*.log.*|grep -hEo "<[0-9]+\:.*\(-1\)"|grep -hEo "\:.*"|sort|uniq|wc -l)
NB_OF_ROOMS=$(grep -hE "<W>${PREV_MONTH_MATCH}.*Moved" /var/log/mumble-server/*.log.*|grep -hEo "to [^[]+"|sort|uniq|wc -l)
# Get previous values # Get previous values
NB_OF_USERS_P=0 NB_OF_USERS_P=0
NB_OF_CONNECTIONS_P=0 NB_OF_CONNECTIONS_P=0
NB_OF_ROOMS_P=0
if [ -e ${MUMBLE_STATS_FILE} ] if [ -e ${MUMBLE_STATS_FILE} ]
then then
@ -81,8 +84,9 @@ echo
echo "=================================================================" echo "================================================================="
echo echo
writeStatValue "Nombre d'utilisateurs" "" ${NB_OF_USERS} ${NB_OF_USERS_P} writeStatValue "Nombre d'utilisateurs" "" ${NB_OF_USERS} ${NB_OF_USERS_P}
writeStatValue "Nombre de salons utilisés" "" ${NB_OF_ROOMS} ${NB_OF_ROOMS_P}
writeStatValue "Nombre de connexions" "" ${NB_OF_CONNECTIONS} ${NB_OF_CONNECTIONS_P} writeStatValue "Nombre de connexions" "" ${NB_OF_CONNECTIONS} ${NB_OF_CONNECTIONS_P}
# Addition des infos HTTP # Addition des infos HTTP
# /srv/mumble.chapril.org/tools/rapports_activites/rapport_activites_http.sh -p /srv/mumble.chapril.org/tools/rapports_activites/rapport_activites_http.sh -p