Hi everybody. I share with you this bash monitoring script kit which allow to creat quite easily some conky for the nextcloud feature âExternal Monitoringâ.
We will see here how to monitor your nextcloud server(s) from a conky on your Debian/Ubuntu desktop.
The Bash script kit used to create the conky itself uses the nextcloud functionality âExternal Monitoring Toolâ (based on Open Collabora).
By default the conky provided as an example displays the main informations but not all. This way you can easily choose what to display yourself.
Cluster and self-signed https : The script allows you to force the IP address for a domain name (see the second connection function). You can thus retrieve information on each node of your web cluster. This function, unlike the first one, does not check the authenticity of the https certificate, so avoid using it on an unsecured link.
Install :
Not mandatory but strongly recommended for security: create a dedicated admin user with a very strong password, then connect to it via the WEBUI and create a connection Token on which you delete access to the file system.
Download the following folder and move it in ~/.conky/conky-perso/ You can choose another destination if you want, but you need change the path in the code.
Edit the script ~/.conky/conky-perso/conky_nextcloud/conky_nextcloud.bash . Specify the nc_login, the nc_password (token) and the server hostname.
Hereâs what the 1st part of the bash script looks like:
#!/bin/bash ## SCRIPT VERSION::1.1 function nextcloudUpdateInfos { INFOS_NEXTCLOUD_SRV1=$(curl https://mySpecialUser:aK88x-74ok9-7Hz4P-oYrXs-qdZZa@cloud.mydomain/ocs/v2.php/apps/serverinfo/api/v1/info) # WARNING, FOR SECURITY REASON : USE ONLY TOKEN NOT DIRECTLY PASSWORD, REMOVE FILEACCESS AND IF POSSIBLE USE A DEDIED ADMIN USER #INFOS_NEXTCLOUD_SRV1=$(cat ~/.conky/conky-perso/conky_dev/test.txt) }
Where mySpecialUser is an admin user I created for this purpose and mydomain is replacing the real one, as you can guess.
Now when I try to launch this conky, I get:
$conky -c ~/.conky/conky-perso/conky_nextcloud/conky_nextcloud.bash
conky: Syntax error (/home/blabla/.conky/conky-perso/conky_nextcloud/conky_nextcloud.bash:2: unexpected symbol near â#â) while reading config file.
conky: Assuming itâs in old syntax and attempting conversion.
conky: [string ââŠâ]:139: attempt to index local âsettingsâ (a nil value)
The machine is an Ubuntu 18.04 with:
conky-all 1.10.8-1 amd64 highly configurable system monitor (all features enabled)
Hello @manu.p. This is the âconkyrcâ file to give to the command âconky -câ.
The file âconkyrcâ is a configuration file for the conky core.
Example :
ââ $ ⶠconky -c conkyrc
conky: Syntax error (conkyrc:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: desktop window (1600042) is subwindow of root window (142)
conky: window type - normal
conky: drawing to created window (0x5000002)
conky: drawing to double buffer
conky: Unknown setting 'maximum_height'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2518 100 2518 0 0 8122 0 --:--:-- --:--:-- --:--:-- 8122
(standard_in) 1: syntax error
expr: syntax error
^Cconky: received SIGINT or SIGTERM to terminate. bye!
The displayed errors are not a problem, the conky is displayed on the desktop (tested )
The error displayed come from the conkyrc file i think. If delete the header comments i have a strange error about â=â.
But the conky work, i think itâs the conky core that has a little bug.
I will search but actually i donât know how to solve this strange bug. Do you have curl installed ? (sudo apt install curl) (normally âcurlâ is installed by default on ubuntu)
PS: i use a english translator for speak, if I say crap or youâre unsure, just talk.