Merge branch 'master' of ssh://forge.april.org:221/Chapril/mobilizon.chapril.org-tools
This commit is contained in:
commit
962747e932
75
.gitignore
vendored
Normal file
75
.gitignore
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
.idea
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
8
.idea/mobilizon.chapril.org-tools.iml
generated
Normal file
8
.idea/mobilizon.chapril.org-tools.iml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/mobilizon.chapril.org-tools.iml" filepath="$PROJECT_DIR$/.idea/mobilizon.chapril.org-tools.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
70
.idea/workspace.xml
generated
Normal file
70
.idea/workspace.xml
generated
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="76e62301-cc1d-40d1-8025-77ac5d7e8dda" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ComposerSettings">
|
||||
<execution />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectId" id="1kEGuLSSTM6Dx3fhMyumeTik3ys" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
<ConfirmationsSetting value="2" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="autoscrollFromSource" value="true" />
|
||||
<option name="autoscrollToSource" value="true" />
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
<property name="nodejs_package_manager_path" value="npm" />
|
||||
<property name="vue.rearranger.settings.migration" value="true" />
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="76e62301-cc1d-40d1-8025-77ac5d7e8dda" name="Default Changelist" comment="" />
|
||||
<created>1605258558512</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1605258558512</updated>
|
||||
<workItem from="1605258559558" duration="1754000" />
|
||||
<workItem from="1605602229773" duration="5663000" />
|
||||
<workItem from="1605690163417" duration="137000" />
|
||||
<workItem from="1606396769239" duration="2931000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
<option featureType="com.intellij.fileTypeFactory" implementationName="*.sh" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="1980" y="174" key="#Plugins" timestamp="1605258857518">
|
||||
<screen x="0" y="24" width="3440" height="1353" />
|
||||
</state>
|
||||
<state x="1980" y="174" key="#Plugins/0.24.3440.1353@0.24.3440.1353" timestamp="1605258857518" />
|
||||
<state x="439" y="324" key="run.anything.popup" timestamp="1605609348424">
|
||||
<screen x="0" y="24" width="3440" height="1353" />
|
||||
</state>
|
||||
<state x="439" y="324" key="run.anything.popup/0.24.3440.1353@0.24.3440.1353" timestamp="1605609348424" />
|
||||
</component>
|
||||
</project>
|
51
README.md
Normal file
51
README.md
Normal file
@ -0,0 +1,51 @@
|
||||
#Mobilizon Chapril Tools
|
||||
|
||||
## Monitoring
|
||||
Surveiller les signes de vie du site depuis Icinga.
|
||||
https://icinga.chapril.org
|
||||
|
||||
|
||||
## Rapport d'activité
|
||||
Générer un rapport incluant des statistiques à propos de l'utilisation du site et le publier dans un ticket Redmine de Agir.chapril.org
|
||||
|
||||
## Statistiques
|
||||
obtention des statistiques publiques de l'instance par une requête GraphQL à l'url https://mobilizon.chapril.org/api/ dont le corps est:
|
||||
|
||||
```graphql
|
||||
{
|
||||
statistics {
|
||||
numberOfUsers
|
||||
numberOfEvents
|
||||
numberOfLocalEvents
|
||||
numberOfComments
|
||||
numberOfLocalComments
|
||||
numberOfGroups
|
||||
numberOfLocalGroups
|
||||
numberOfInstanceFollowers
|
||||
numberOfInstanceFollowings
|
||||
}
|
||||
}
|
||||
```
|
||||
exemple de réponse:
|
||||
```
|
||||
{
|
||||
"data": {
|
||||
"statistics": {
|
||||
"numberOfComments": 9,
|
||||
"numberOfEvents": 45,
|
||||
"numberOfGroups": 7,
|
||||
"numberOfInstanceFollowers": 0,
|
||||
"numberOfInstanceFollowings": 1,
|
||||
"numberOfLocalComments": 0,
|
||||
"numberOfLocalEvents": 0,
|
||||
"numberOfLocalGroups": 0,
|
||||
"numberOfUsers": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Détail des paramètres à demander sur la doc:
|
||||
https://framagit.org/framasoft/mobilizon/-/blob/master/js/schema.graphql
|
||||
|
||||
On peut tester des requêtes sur cette sandbox
|
||||
https://mobilizon.fr/graphiql
|
@ -26,15 +26,14 @@ else
|
||||
lastVersion=$(curl -s https://framagit.org/api/v4/projects/$FRAMAGIT_PROJECT_ID/releases | jshon -a -e name|cut -d '"' -f2|grep -v '[\^\(alpha\)]'|head -n 1)
|
||||
currentVersion=$(cd $LOCAL_REPO && git branch | grep '*'|cut -c 3-100 )
|
||||
|
||||
# echo "current version: $currentVersion"
|
||||
# echo "last version: $lastVersion"
|
||||
echo "current version: $currentVersion"
|
||||
echo "last version: $lastVersion"
|
||||
if [ $currentVersion = $lastVersion ]; then
|
||||
echo "OK"
|
||||
result=0
|
||||
else
|
||||
echo "WARNING : new version available, current is $currentVersion, last is $lastVersion."
|
||||
result=1
|
||||
result=2
|
||||
fi
|
||||
fi
|
||||
exit $result
|
||||
|
||||
|
1
monitoring/mobilizonchaprilorg.cron
Normal file
1
monitoring/mobilizonchaprilorg.cron
Normal file
@ -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
|
@ -18,11 +18,12 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# access_log /var/log/nginx/mobilizon.chapril.org/mobilizon.chapril.org-access.log
|
||||
# error_log /var/log/nginx/mobilizon.chapril.org/mobilizon.chapril.org-error.log
|
||||
|
||||
# ============================================
|
||||
|
||||
LOG_PREFIX="/var/log/apache2/mobilizon.chapril.org/mobilizon.chapril.org"
|
||||
LOG_PREFIX="/var/log/nginx/mobilizon.chapril.org/mobilizon.chapril.org"
|
||||
SERVICE_NAME="mobilizon.chapril.org"
|
||||
|
||||
source "/etc/mobilizon.chapril.org/mobilizonchaprilorg.conf"
|
||||
@ -48,7 +49,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 +64,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 +85,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 +140,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 +151,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"
|
||||
|
Loading…
Reference in New Issue
Block a user