Skip to content

prometheus gets 400 bad request scraping metrics from nextcloud #838

@BinaryMan32

Description

@BinaryMan32

Describe your Issue

In prometheus I can see the service monitor tries to get metrics from both nextcloud and nextcloud-metrics.
Scraping nextcloud-metrics works but nextcloud fails with 400 bad request.
Image

Logs and Errors

The nextcloud pod logs look pretty repetitive with messages similar to the below cycling.
I copied from lens with "show resource names" selected so the container name is on the beginning of each line.

[nextcloud-nginx]10.42.13.45 - admin [08/Mar/2026:19:00:44 +0000] "GET /ocs/v2.php/apps/serverinfo/api/v1/info?format=json&skipApps=true&skipUpdate=true HTTP/1.1" 200 1705 "-" "nextcloud-exporter/0.8.0" "-"
[nextcloud]127.0.0.1 -  08/Mar/2026:19:00:50 +0000 "GET /status.php" 200
[nextcloud]127.0.0.1 -  08/Mar/2026:19:00:50 +0000 "GET /status.php" 200
[nextcloud-nginx]10.42.5.1 - - [08/Mar/2026:19:00:50 +0000] "GET /status.php HTTP/1.1" 200 182 "-" "kube-probe/1.35" "-"
[nextcloud-nginx]10.42.5.1 - - [08/Mar/2026:19:00:50 +0000] "GET /status.php HTTP/1.1" 200 182 "-" "kube-probe/1.35" "-"
[nextcloud]127.0.0.1 -  08/Mar/2026:19:00:56 +0000 "GET /index.php" 400
[nextcloud-nginx]10.42.15.202 - - [08/Mar/2026:19:00:56 +0000] "GET /metrics HTTP/1.1" 400 13443 "-" "Prometheus/3.10.0" "-"
[nextcloud]127.0.0.1 -  08/Mar/2026:19:01:00 +0000 "GET /status.php" 200
[nextcloud]127.0.0.1 -  08/Mar/2026:19:01:00 +0000 "GET /status.php" 200
[nextcloud-nginx]10.42.5.1 - - [08/Mar/2026:19:01:00 +0000] "GET /status.php HTTP/1.1" 200 182 "-" "kube-probe/1.35" "-"
[nextcloud-nginx]10.42.5.1 - - [08/Mar/2026:19:01:00 +0000] "GET /status.php HTTP/1.1" 200 182 "-" "kube-probe/1.35" "-"
[nextcloud]127.0.0.1 -  08/Mar/2026:19:01:10 +0000 "GET /status.php" 200
[nextcloud]127.0.0.1 -  08/Mar/2026:19:01:10 +0000 "GET /status.php" 200
[nextcloud-nginx]10.42.5.1 - - [08/Mar/2026:19:01:10 +0000] "GET /status.php HTTP/1.1" 200 182 "-" "kube-probe/1.35" "-"
[nextcloud-nginx]10.42.5.1 - - [08/Mar/2026:19:01:10 +0000] "GET /status.php HTTP/1.1" 200 182 "-" "kube-probe/1.35" "-"
[nextcloud]127.0.0.1 - admin 08/Mar/2026:19:01:13 +0000 "GET /ocs/v2.php" 200

Describe your Environment

  • Kubernetes distribution: k3s 1.35.2
  • Helm Version (or App that manages helm): ArgoCD 3.3.2 using helm 3.19.4
  • Helm Chart Version: 9.0.1
  • values.yaml:
# https://github.com/nextcloud/helm/blob/main/charts/nextcloud/values.yaml
# use nginx to serve files instead of apache
image:
  flavor: fpm-alpine
nginx:
  enabled: true
ingress:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 2g
    nginx.ingress.kubernetes.io/proxy-read-timeout: "180"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "180"
  enabled: true
  className: public
  annotations:
    nginx.org/websocket-services: nextcloud
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
  tls:
    - secretName: nextcloud-tls
      hosts:
      - REDACTED
nextcloud:
  host: REDACTED
  configs:
    protocol.config.php: |-
      <?php
      $CONFIG = array (
        'overwriteprotocol' => 'https'
      );
  existingSecret:
    enabled: true
    secretName: nextcloud-admin
    usernameKey: username
    passwordKey: password
internalDatabase:
  enabled: false
externalDatabase:
  enabled: true
  type: postgresql
  existingSecret:
    enabled: true
    secretName: nextcloud-db-app
    usernameKey: username
    passwordKey: password
    hostKey: host
    databaseKey: dbname
cronjob:
  enabled: true
  type: sidecar
persistence:
  enabled: true
  storageClass: longhorn
  nextcloudData:
    enabled: true
    storageClass: mercury-nfs
startupProbe:
  enabled: true
metrics:
  enabled: true
prometheus:
  serviceMonitor:
    enabled: true
  rules:
    enabled: true

Additional context, if any

The below seem like the most "unusual" things about my setup. I'm wondering whether I should still be using this configuration:

image:
  flavor: fpm-alpine
nginx:
  enabled: true

Can you clarify whether after #834 I should be able to remove the below and scrape all metrics directly from nextcloud? Of course I'd need to solve the above issue first or I would have no metrics at all.

metrics:
  enabled: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions