From 334331e4a9cbdd891e9ef0ef579de1aba856cf38 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Thu, 2 Nov 2023 13:07:28 +0100 Subject: [PATCH] Nextcloud prometeus exporter --- monitoring/docker-compose.yaml | 13 ++++++++++++- monitoring/prometheus.yml | 5 +++++ nextcloud/docker-compose.yaml | 12 ++++++------ nextcloud/update-nc.sh | 11 +++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 nextcloud/update-nc.sh diff --git a/monitoring/docker-compose.yaml b/monitoring/docker-compose.yaml index c0c45c5..4c14b36 100644 --- a/monitoring/docker-compose.yaml +++ b/monitoring/docker-compose.yaml @@ -92,9 +92,20 @@ services: labels: - "docker.group=monitoring" + # https://github.com/xperimental/nextcloud-exporter + nextcloud-exporter: + image: ghcr.io/xperimental/nextcloud-exporter + networks: + - monitoring + environment: + - NEXTCLOUD_SERVER=${NEXTCLOUD_URL} + - NEXTCLOUD_AUTH_TOKEN=${NEXTCLOUD_MONITORING_AUTH_TOKEN} + - NEXTCLOUD_LISTEN_ADDRESS=:9205 + labels: + - "docker.group=monitoring" ################################################################## - # here starts data collection + # here starts data collection of local host telegraf_host: image: telegraf:${TELEGRAF_VERSION} diff --git a/monitoring/prometheus.yml b/monitoring/prometheus.yml index 5f0575b..fdaaa7b 100644 --- a/monitoring/prometheus.yml +++ b/monitoring/prometheus.yml @@ -35,3 +35,8 @@ scrape_configs: - job_name: "grafana" static_configs: - targets: ["grafana:3000"] + + - job_name: 'nextcloud' + scrape_interval: 60s + static_configs: + - targets: ['nextcloud-exporter:9205'] diff --git a/nextcloud/docker-compose.yaml b/nextcloud/docker-compose.yaml index 90aaf18..371936a 100644 --- a/nextcloud/docker-compose.yaml +++ b/nextcloud/docker-compose.yaml @@ -33,7 +33,7 @@ services: app: image: nextcloud:${NC_MAIN_VERSION}-fpm-own - build: + build: context: ./ args: - NC_MAIN_VERSION=${NC_MAIN_VERSION} @@ -58,7 +58,7 @@ services: - redis labels: - "docker.group=netxtcloud" - + cron: image: nextcloud:${NC_MAIN_VERSION}-fpm-own @@ -134,7 +134,7 @@ services: test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] interval: 20s timeout: 3s - labels: + labels: - "docker.group=netxtcloud" @@ -173,7 +173,7 @@ services: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s - labels: + labels: - "docker.group=netxtcloud" @@ -182,7 +182,7 @@ services: networks: - nextcloud - web - volumes: + volumes: - /etc/timezone:/etc/timezone - /etc/localtime:/etc/localtime cap_add: @@ -212,7 +212,7 @@ services: networks: - nextcloud volumes: - - ${VOLUMES_PATH}/nextcloud/fonts:/usr/share/fonts/drawio + - ${VOLUMES_PATH}/nextcloud/fonts:/usr/share/fonts/drawio restart: unless-stopped labels: - "docker.group=netxtcloud" diff --git a/nextcloud/update-nc.sh b/nextcloud/update-nc.sh new file mode 100755 index 0000000..2886d18 --- /dev/null +++ b/nextcloud/update-nc.sh @@ -0,0 +1,11 @@ +#docker compose build --pull +#docker compose pull --ignore-buildable +#docker compose --project-directory /home/flz/git/selfhost/nextcloud exec --user www-data app php occ status +#docker compose up -d +#watch docker compose ps +docker compose --project-directory /home/flz/git/selfhost/nextcloud exec --user www-data app php occ upgrade +docker compose --project-directory /home/flz/git/selfhost/nextcloud exec --user www-data app php occ maintenance:repair +docker compose --project-directory /home/flz/git/selfhost/nextcloud exec --user www-data app php occ db:add-missing-indices +docker compose --project-directory /home/flz/git/selfhost/nextcloud exec --user www-data app php occ db:add-missing-columns +docker compose --project-directory /home/flz/git/selfhost/nextcloud exec --user www-data app php occ db:add-missing-primary-keys +docker compose --project-directory /home/flz/git/selfhost/nextcloud exec --user www-data app php occ status