Monitoring of a Nextcloud instance using the servinfo plugin
This repository has been made to monitor a Nextcloud instance using Prometheus through the serverinfo plugin.
Having a working Golang environment:
go install github.com/trazfr/prometheus-nextcloud-exporter@latest
This program is configured through a JSON configuration file.
To run, just prometheus-nextcloud-exporter config.json
This configuration shows:
- A timeout of 20 seconds for each requests (default=
5
) - Listens to the port
9092
(default value=:9091
) - A Nextcloud instance
- using HTTPS (you may also use
http
) - with credentials: user is
myuser
and the password ismypassword
- the server is
cloud.example.com
- it is using the default path for the serverinfo plugin:
/ocs/v2.php/apps/serverinfo/api/v1/info
- using HTTPS (you may also use
{
"timeout": 20,
"nextcloud_url": "https://myuser:mypassword@cloud.example.com",
"listen": ":9092"
}
Another configuration example where the Nextcloud is installed in the path /mynextcloud
:
{
"nextcloud_url": "https://anotheruser:anotherpassword@server.example.com/mynextcloud"
}
Your server may have an exotic configuration and the serverinfo endpoints may be behind another path.
For instance if you have a reverse proxy which rewrites /serverinfo
into /ocs/v2.php/apps/serverinfo/api/v1/info
:
{
"nextcloud_url": "https://anotheruser:anotherpassword@exotic.example.com/serverinfo",
"append_default_serverinfo_path": false
}