Merge branch 'master' of ssh://forge.april.org:221/Chapril/mobilizon.chapril.org-tools
This commit is contained in:
commit
3cae67750e
@ -30,6 +30,17 @@ source "/etc/mobilizon.chapril.org/mobilizonchaprilorg.conf"
|
|||||||
|
|
||||||
IPV4_PATTERN="[0-9]{1,3}(\.[0-9]{1,3}){3}"
|
IPV4_PATTERN="[0-9]{1,3}(\.[0-9]{1,3}){3}"
|
||||||
IPV6_PATTERN="[0-9a-f]{0,4}(:[0-9a-f]{0,4}){2,7}"
|
IPV6_PATTERN="[0-9a-f]{0,4}(:[0-9a-f]{0,4}){2,7}"
|
||||||
|
|
||||||
|
# TODO métriques à récupérer
|
||||||
|
# https://docs.joinmobilizon.org/contribute/graphql_api/
|
||||||
|
API_URL="https://mobilizon.chapril.org/api/"
|
||||||
|
|
||||||
|
# get statistics from the graphQL api of the website
|
||||||
|
json=$(curl -X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data '{"query":"{\n statistics {\n numberOfUsers\n numberOfEvents\n numberOfLocalEvents\n numberOfComments\n numberOfLocalComments\n numberOfGroups\n numberOfLocalGroups\n numberOfInstanceFollowers\n numberOfInstanceFollowings\n }\n}\n"}' $API_URL)
|
||||||
|
|
||||||
|
echo $json;
|
||||||
#
|
#
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
@ -73,9 +84,19 @@ generateHTTPReport()
|
|||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# display the value of a key in the json fetched with curl
|
||||||
|
function show
|
||||||
|
{
|
||||||
|
# to navigate to sub keys like data.statistics.my_key , we must use multiple -e extract options
|
||||||
|
local value=$(echo "$json" | jshon -e "data" -e "statistics" -e $1 -u)
|
||||||
|
printf " $key=$value"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
generateSpecificReport()
|
generateSpecificReport()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
local monthEnglish="$1"
|
local monthEnglish="$1"
|
||||||
local year="$2"
|
local year="$2"
|
||||||
local yearMonth="$3"
|
local yearMonth="$3"
|
||||||
@ -90,11 +111,19 @@ generateSpecificReport()
|
|||||||
echo "Nombre d'ipv6 utilisatrices du service = $ipv6UserCount"
|
echo "Nombre d'ipv6 utilisatrices du service = $ipv6UserCount"
|
||||||
|
|
||||||
echo "Nombre total d'ip utilisatrices du service = $((ipv4UserCount+ipv6UserCount))"
|
echo "Nombre total d'ip utilisatrices du service = $((ipv4UserCount+ipv6UserCount))"
|
||||||
# TODO métriques à récupérer
|
|
||||||
# https://docs.joinmobilizon.org/contribute/graphql_api/
|
# echo "Nombre de comptes utilisateurs = "
|
||||||
echo "Nombre de comptes utilisateurs"
|
show "numberOfEvents"
|
||||||
echo "Nombre d'évènements passés"
|
show "numberOfLocalEvents"
|
||||||
echo "Nombre d'évènements à venir"
|
show "numberOfGroups"
|
||||||
|
show "numberOfLocalGroups"
|
||||||
|
show "numberOfComments"
|
||||||
|
show "numberOfLocalComments"
|
||||||
|
show "numberOfInstanceFollowers"
|
||||||
|
show "numberOfInstanceFollowings"
|
||||||
|
show "numberOfUsers"
|
||||||
|
# echo "Nombre d'évènements passés"
|
||||||
|
# echo "Nombre d'évènements à venir"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user