hajo62
(Hajo)
April 26, 2021, 7:59am
1
I wonder, if someone uses the nextcloud integration.
When I have a look at the nextcloud_storage_num_files sensor, it reports a much bigger number than a linux file count (ls -FR data | grep -v / | wc -l
) in the nextcloud base directory.
Any ideas what this sensor reports?
poudenes
(Poudenes)
April 26, 2021, 1:15pm
2
you’re lucky… tried to let it work in general for weeks without success… Give it up…
Every time got error that integration was not correct
hajo62
(Hajo)
April 26, 2021, 3:49pm
3
The integration itself was setup straight forward. But the sensors…
From my point of view most of them are not very useful… Maybe except the num_shares-group.
I tried a bit with some sql and command line sensors. Maybe that’s something:
#================================
#=== Monitoring Nextcloud
#================================
- platform: sql
db_url: !secret nextcloud_db_url
scan_interval: 3600 # Aktualisieren jede Stunde
queries:
- name: 'Nextcloud Database size'
query: 'SELECT table_schema "ncdb", Round(Sum(data_length + index_length) / 1048576, 0) "value" FROM information_schema.tables WHERE table_schema="ncdb" GROUP BY table_schema;'
column: 'value'
unit_of_measurement: MB
- platform: command_line
scan_interval: 3600 # Aktualisieren jede Stunde
name: Nextcloud Files Size
command: "du -ms /nextcloud/userid/files | cut -f1"
unit_of_measurement: 'GB'
value_template: '{{ (value | float) / 1024 }}'
- platform: command_line
scan_interval: 3600 # Aktualisieren jede Stunde
name: Nextcloud Files
command: "ls -aFR /nextcloud/userid/files | grep -v / | grep -v ^$ | wc -l"
value_template: '{{ value | int }}'
- platform: command_line
scan_interval: 43200 # Aktualisieren 2 mal am Tag
name: Nextcloud Thumbnails Size
command: "du -ms /nextcloud/appdata_xyz4711/preview | cut -f1"
command_timeout: 30
unit_of_measurement: 'GB'
value_template: '{{ (value | float) / 1024 }}'
- platform: command_line
scan_interval: 43200 # Aktualisieren 2 mal am Tag
name: Nextcloud Thumbnails
command: "ls -aFR /nextcloud/appdata_xyz4711/preview | grep -v / | grep -v ^$ | wc -l"
command_timeout: 30
value_template: '{{ value | int }}'
1 Like
Good inspirations. I´m currently thinking of making a “Nextcloud update available” sensor and I have two ideas for that - but that´s another topic.
For me the nextcloud_storage_num_files
is working from the beginning. Only had some struggles after a NC version update, but according to Number of files missing · Issue #314 · nextcloud/serverinfo · GitHub there´s a workaround for that.