forked from coop-cloud/nextcloud
replace sidecar metrics exporter with native metrics endpoint
This commit is contained in:
+1
-2
@@ -109,5 +109,4 @@ DEFAULT_QUOTA="10 GB"
|
||||
#HSTS_PRELOAD=1
|
||||
|
||||
# Metrics
|
||||
# COMPOSE_FILE="$COMPOSE_FILE:compose.metrics.yml"
|
||||
# SECRET_METRICS_TOKEN_VERSION=v1 # length=32 charset=hex
|
||||
# COMPOSE_FILE="$COMPOSE_FILE:compose.metrics.yml"
|
||||
@@ -131,20 +131,17 @@ To disable dashboard app (since it is so corporate):
|
||||
|
||||
## Metrics
|
||||
|
||||
There is a [metrics exporter](https://github.com/xperimental/nextcloud-exporter)
|
||||
that can be run as sidecar container, also part of the nextcloud helm charts.
|
||||
Since Version 33, Nextcloud offers a /metrics endpoint (see [here](https://docs.nextcloud.com/server/stable/admin_manual/configuration_monitoring/index.html)).
|
||||
Its configured via alloys label-based auto-discovery provided by the updated
|
||||
[monitoring-stack](https://git.coopcloud.tech/coop-cloud/monitoring-ng).
|
||||
|
||||
To enable, uncomment
|
||||
```
|
||||
COMPOSE_FILE="$COMPOSE_FILE:compose.metrics.yml"
|
||||
SECRET_METRICS_TOKEN_VERSION=v1 # length=32 charset=hex
|
||||
```
|
||||
then generate the secret with abra and insert it via `set_metrics_token`
|
||||
and run `configure_metrics`:
|
||||
```
|
||||
abra app secret generate <domain> metrics_token
|
||||
abra app cmd <domain> app set_metrics_token
|
||||
abra app cmd <domain> app configure_metrics
|
||||
```
|
||||
|
||||
## Upgrading Nextcloud
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
export FPM_TUNE_VERSION=v5
|
||||
export NGINX_CONF_VERSION=v8
|
||||
export NGINX_CONF_VERSION=v9
|
||||
export MY_CNF_VERSION=v6
|
||||
export ENTRYPOINT_VERSION=v3
|
||||
export ENTRYPOINT_WHITEBOARD_VERSION=v1
|
||||
@@ -195,8 +195,8 @@ upgrade_mariadb() {
|
||||
mariadb-upgrade -p`cat /run/secrets/db_root_password`
|
||||
}
|
||||
|
||||
set_metrics_token() {
|
||||
run_occ "config:app:set serverinfo token --value '$(cat /run/secrets/metrics_token)'"
|
||||
configure_metrics() {
|
||||
run_occ "config:system:set openmetrics_allowed_clients 0 --value='10.0.0.0/8'"
|
||||
}
|
||||
|
||||
# Checks whether this instance looks ready to update to the next Nextcloud
|
||||
|
||||
+3
-15
@@ -1,22 +1,10 @@
|
||||
version: "3.8"
|
||||
services:
|
||||
app:
|
||||
secrets:
|
||||
- metrics_token
|
||||
metrics:
|
||||
image: xperimental/nextcloud-exporter:0.9.0
|
||||
web:
|
||||
environment:
|
||||
- NEXTCLOUD_SERVER=https://$DOMAIN
|
||||
- NEXTCLOUD_AUTH_TOKEN=@/run/secrets/metrics_token
|
||||
secrets:
|
||||
- metrics_token
|
||||
networks:
|
||||
- proxy
|
||||
- METRICS_ENABLED=true
|
||||
deploy:
|
||||
labels:
|
||||
- "prometheus.io/scrape=true"
|
||||
- "prometheus.io/port=9205"
|
||||
secrets:
|
||||
metrics_token:
|
||||
external: true
|
||||
name: ${STACK_NAME}_metrics_token_${SECRET_METRICS_TOKEN_VERSION}
|
||||
- "prometheus.io/path=/metrics"
|
||||
@@ -185,4 +185,23 @@ http {
|
||||
try_files $uri $uri/ /index.php$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
{{ if env "METRICS_ENABLED" }}
|
||||
server {
|
||||
listen 9205;
|
||||
|
||||
location = /metrics {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/html/index.php;
|
||||
fastcgi_param SCRIPT_NAME /index.php;
|
||||
fastcgi_param REQUEST_URI /metrics;
|
||||
fastcgi_param HTTP_HOST {{ env "DOMAIN" }};
|
||||
fastcgi_pass php-handler;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
add option to scrape native /metrics endpoint via alloys auto-discovery
|
||||
Reference in New Issue
Block a user