Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/llaumgui/nextcloud2prom
Convert a Nextcloud monitoring in JSON to prom textfile
https://github.com/llaumgui/nextcloud2prom
Last synced: about 6 hours ago
JSON representation
Convert a Nextcloud monitoring in JSON to prom textfile
- Host: GitHub
- URL: https://github.com/llaumgui/nextcloud2prom
- Owner: llaumgui
- License: gpl-2.0
- Created: 2024-09-04T12:56:30.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-09-07T17:13:17.000Z (2 months ago)
- Last Synced: 2024-09-08T02:59:50.055Z (2 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Nextcloud to prom
Get Nextcloud server's info in JSON and convert to [node_exporter textfile format](https://github.com/prometheus/node_exporter?tab=readme-ov-file#textfile-collector).
![image](https://github.com/user-attachments/assets/ad11f6a0-9924-4cb8-9481-4a24d06fe803)
## Install
### On Nextcloud
* Make sur that application server info is enable:
```bash
https://domain.ltd/settings/admin/serverinfo
```* Set a token:
```bash
occ config:app:set serverinfo token --value MY_TOKEN
```### On your server
* Create folder /var/lib/prometheus/node-exporter
```bash
mkdir /var/lib/prometheus/node-exporter
chown prometheus:prometheus /var/lib/prometheus/node-exporter
```* Allow collect textfiles from it:
```bash
cat /etc/default/node_exporter
NODE_EXPORTER_OPTS="--collector.textfile.directory=/var/lib/prometheus/node-exporter"
```* Get scripts:
```bash
cd /tmp
git clone https://github.com/llaumgui/nextcloud2prom.git
cd nextcloud2prom
```* Install requirements from `dnf`, `apt`, etc. Or use `pip`:
```bash
pip install -r requirements.txt
```* Install scripts:
```bash
cp prom_nextcloud.py /usr/local/bin
chmod +x /usr/local/bin/prom_nextcloud.py
cp system.d/prom* /etc/systemd/system
```* Edit /etc/systemd/system/prom-nextcloud.service with your `NC_URL` and `NC_TOKEN` informations.
* Check:```bash
systemd-analyze verify /etc/systemd/system/prom-nextcloud*
systemctl start prom-nextcloud.service
```* and start systemd:
```bash
systemctl start prom-nextcloud.timer
systemctl enable prom-nextcloud.timer
```## Develop
```bash
python -m venv env
source env/bin/activate
pip install -r requirements.txt
```