xperimental / nextcloud-exporter

Prometheus exporter for Nextcloud servers.
MIT License
226 stars 34 forks source link

level=error msg="Error during scrape: too many requests" #106

Closed urbaman closed 8 months ago

urbaman commented 8 months ago

Hi,

Deployed in kubernetes, can't seem to be able to scrape, while the serverinfo page responds via blowser. It seems the exporter keeps running every 5s (default timeout) even if I try to set it to 30s, and it's too frequent.

Running Nextcloud 28.0.1.1

Logs:

kubectl logs -n nextcloud nextcloud-exporter-85d86498c9-q8prb
level=info msg="nextcloud-exporter 0.6.2"
level=info msg="Nextcloud server: https://nextcloud.urbaman.it User: admin"
level=info msg="Listen on :9205..."
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"
level=error msg="Error during scrape: too many requests"

Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nextcloud-exporter
  namespace: nextcloud
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nextcloud-exporter
  template:
    metadata:
      labels:
        app: nextcloud-exporter
    spec:
      containers:
      - name: nextcloud-exporter
        image: xperimental/nextcloud-exporter:latest
        ports:
        - containerPort: 9205
          name: metrics
        env:
          #        - name: NEXTCLOUD_AUTH_TOKEN
          #          value: "JJrbN-iD8pi-aDYMp-geias-3Jmqk"
        - name: NEXTCLOUD_USERNAME
          value: "admin"
        - name: NEXTCLOUD_PASSWORD
          valueFrom:
            secretKeyRef:
              key: ADMIN_PASSWORD
              name: nextcloud-secrets
        - name: NEXTCLOUD_SERVER
          value: "https://nextcloud.domain.com"
        - name: NEXTCLOUD_TIMEOUT
          value: "30s"
---
apiVersion: v1
kind: Service
metadata:
  name: nextcloud-exporter
  namespace: nextcloud
  labels:
    app: nextcloud-exporter
spec:
  type: ClusterIP
  ports:
  - port: 9205
    protocol: TCP
    name: http
  selector:
    app: nextcloud-exporte
urbaman commented 8 months ago

Found out it's about brute-force, I'll check it out, both for this and credentials.

urbaman commented 8 months ago

Ok, it actually was MFA, now disabled for the exporter user.

Is there a way to use the app_password? Is it the token (it doesn't seem to work)? I wouldn't leave an admin user without MFA.

Thank you.

xperimental commented 8 months ago

Token authentication and app-passwords are not the same thing. Have you seen the documentation about token authentication already?

Second, the timeout configured in the exporter does not configure how often it is scraped by Prometheus (which is what controls how often it tries to reach Nextcloud). This is done in the scrape configuration of Prometheus.

urbaman commented 8 months ago

Hi @xperimental

Sorry for the late response, I solved the "too many requests" thing, I'll close this up and open a new one for the credentials problem.

Thank you.