GithubHelp home page GithubHelp logo

wouter0100 / nextcloud-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xperimental/nextcloud-exporter

0.0 1.0 0.0 275 KB

Prometheus exporter for Nextcloud servers.

License: MIT License

Go 96.24% Dockerfile 3.76%

nextcloud-exporter's Introduction

nextcloud-exporter Docker Build Status

A prometheus exporter for getting some metrics of a nextcloud server instance.

Installation

If you have a working Go installation, getting the binary should be as simple as

go get github.com/xperimental/nextcloud-exporter

Client credentials

To access the serverinfo API you will need the credentials of an admin user. It is recommended to create a separate user for that purpose.

Usage

$ nextcloud-exporter --help
  Usage of nextcloud-exporter:
    -a, --addr string          Address to listen on for connections. (default ":9205")
    -c, --config-file string   Path to YAML configuration file.
    -p, --password string      Password for connecting to Nextcloud.
    -t, --timeout duration     Timeout for getting server info document. (default 5s)
    -l, --url string           URL to Nextcloud serverinfo page.
    -u, --username string      Username for connecting to Nextcloud.

After starting the server will offer the metrics on the /metrics endpoint, which can be used as a target for prometheus.

Configuration methods

There are three methods of configuring the nextcloud-exporter (higher methods take precedence over lower ones):

  • Environment variables
  • Configuration file
  • Command-line parameters

Environment variables

All settings can also be specified through environment variables:

Environment variable Flag equivalent
NEXTCLOUD_LISTEN_ADDRESS --addr
NEXTCLOUD_PASSWORD --password
NEXTCLOUD_TIMEOUT --timeout
NEXTCLOUD_SERVERINFO_URL --url
NEXTCLOUD_USERNAME --username

Configuration file

The --config-file option can be used to read the configuration options from a YAML file:

listenAddress: ":9205"
password: "example"
timeout: "5s"
infoUrl: "https://example.com"
username: "example"

Password file

Optionally the password can be read from a separate file instead of directly from the input methods above. This can be achieved by setting the password to the path of the password file prefixed with an "@", for example:

$ nextcloud-exporter -c config-without-password.yml -p @/path/to/passwordfile

Other information

Info URL

The exporter reads the metrics from the Nextcloud server using its "serverinfo" API. You can find the URL of this API in the administrator settings in the "Monitoring" section. It should look something like this:

https://example.com/ocs/v2.php/apps/serverinfo/api/v1/info

When you do not specify a path on the --url parameter then the default path will be added automatically.

If you open this URL in a browser you should see an XML structure with the information that will be used by the exporter.

Scrape configuration

The exporter will query the nextcloud server every time it is scraped by prometheus. If you want to reduce load on the nextcloud server you need to change the scrape interval accordingly:

scrape_configs:
  - job_name: 'nextcloud'
    scrape_interval: 90s
    static_configs:
      - targets: ['localhost:9205']

nextcloud-exporter's People

Contributors

xperimental avatar horaynarea avatar spearki avatar willibutz avatar potager avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.