diff --git a/.idea/mobilizon.chapril.org-tools.iml b/.idea/mobilizon.chapril.org-tools.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/mobilizon.chapril.org-tools.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..6f68488 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..23b641b --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1605258558512 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/monitoring/mobilizonchaprilorg.cron b/monitoring/mobilizonchaprilorg.cron new file mode 100644 index 0000000..efd9224 --- /dev/null +++ b/monitoring/mobilizonchaprilorg.cron @@ -0,0 +1 @@ + 5 0 1 * * root /srv/mobilizon.chapril.org/tools/rapport_activite/rapport_activite.sh -p >> /srv/mobilizon.chapril.org/Exploitation/rapport_mobilizon.log 2>&1 diff --git a/rapport_activite/rapport_activite.sh b/rapport_activite/rapport_activite.sh index 4d2ea55..7adef67 100755 --- a/rapport_activite/rapport_activite.sh +++ b/rapport_activite/rapport_activite.sh @@ -48,7 +48,7 @@ generateHTTPReport() echo "=§= Rapport d'activité HTTP" echo - + local httpRequestCount=$(zgrep "$monthEnglish" $LOG_PREFIX-access.log*|grep $year|wc -l) echo "Nombre total de requêtes http = $httpRequestCount" @@ -63,7 +63,7 @@ generateHTTPReport() local ipv4VisitorCount=$(zgrep -h "$monthEnglish" $LOG_PREFIX-access.log*|grep "$year"|grep -vi bot|grep -v check_http|egrep "^$IPV4_PATTERN "|cut -d' ' -f1|sort|uniq|wc -l ) echo "Nombre d'ipv4 ayant visité le service = $ipv4VisitorCount" - + local ipv6VisitorCount=$(zgrep -h "$monthEnglish" $LOG_PREFIX-access.log*|grep "$year"|grep -vi bot|grep -v check_http|egrep "^$IPV6_PATTERN "|cut -d' ' -f1|sort|uniq|wc -l ) echo "Nombre d'ipv6 ayant visité le service = $ipv6VisitorCount" @@ -84,13 +84,16 @@ generateSpecificReport() ipv4UserCount=$(zgrep -h "$monthEnglish" $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" - + ipv6UserCount=$(zgrep -h "$monthEnglish" $LOG_PREFIX-access.log*|grep "$year"|grep -vi bot|gre\p -v check_http|egrep "^$IPV6_PATTERN " | cut -d' ' -f 1|sort|uniq|wc -l ) echo "Nombre d'ipv6 utilisatrices du service = $ipv6UserCount" echo "Nombre total d'ip utilisatrices du service = $((ipv4UserCount+ipv6UserCount))" - echo - + # TODO métriques à récupérer + # https://docs.joinmobilizon.org/contribute/graphql_api/ + echo "Nombre de comptes utilisateurs" + echo "Nombre d'évènements passés" + echo "Nombre d'évènements à venir" echo } @@ -136,7 +139,7 @@ elif [ "$#" -eq 2 ]; then elif ! (let "$2") 2>/dev/null; then echo -e "L'année doit être numérique." help - elif [ "$2" -lt 2018 ] || [ "$2" -gt "$(date +%Y)" ]; then + elif [ "$2" -lt 2018 ] || [ "$2" -gt "$(date +%Y)" ]; then echo -e "Année non valable $2." help elif [ "$2" -le 2017 ] || [ "$2" -ge $(($(date +%Y)+1)) ] ; then @@ -147,7 +150,7 @@ elif [ "$#" -eq 2 ]; then yearMonth="$2-0$1" else yearMonth="$2-$1" - fi + fi monthEnglish=$(LANG=en_EN.UTF-8;date -d "$2-$1-01" +%b) year="$2" generateReport "$monthEnglish" "$year" "$yearMonth"