A Prometheus Nextcloud exporter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Florian Charlaix db31278ef7 Merge branch 'dev' into 'master' 2 years ago
nextcloud_exporter Exclude all directory from user quota used 2 years ago
.env.example Better logging and support custom port and interface binding 2 years ago
.gitignore Fix UserQuota query and converter 2 years ago
.gitlab-ci.yml Fix CI 2 years ago
LICENSE Init commit 3 years ago
README.md Update README.md with more commands for installation 3 years ago
VERSION Set version to 1.0.0 2 years ago
setup.py Set install_requires with specific versions 3 years ago
tox.ini Base program and user's quota as first metric 3 years ago

README.md

Nextcloud exporter

Installation

apt install -y python3-pip
pip install Nextcloud-exporter --extra-index-url https://git.open-dsi.fr/api/v4/projects/649/packages/pypi/simple
useradd -r nextcloud_exporter

Install a database driver with apt :

  • PostgreSQL : python3-psycopg2
  • MariaDB : python3-mysqldb
  • SQLite : Shipped with Python3

Create SystemD service :

/etc/systemd/system/nextcloud_exporter.service :

[Unit]
Description=Nextcloud exporter
After=syslog.target
After=network.target
Documentation=https://git.open-dsi.fr/nextcloud-extension/nextcloud_exporter

[Service]
ExecStart=/usr/bin/python3 -m nextcloud_exporter
EnvironmentFile=/etc/default/nextcloud_exporter
User=nextcloud_exporter
Type=simple
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nextcloud_exporter
SuccessExitStatus=143
TimeoutStopSec=120
Restart=always

[Install]
WantedBy=multi-user.target

Create configuration in /etc/default/nextcloud_exporter :

DB_URL="sqlite://"
DB_PREFIX=oc_
[...]

Apply, enable and start new service :

systemctl daemon-reload
systemctl enable --now nextcloud_exporter

Configuration

Environment variables :

Name Description Example of variable
DB_URL The SQLAlchemy database URL postgresql+psycopg2://user:passwd@localhost:5432/db_name
DB_PREFIX The Nextcloud Database prefix (usually oc_) oc_