Nextcloud Munin plugins

I took the time to write some munin plugins to monitor the nextcloud instance via the ServerInfo App API.
I made every part as a single plugin to comply with munin version < 1.4 and a multigraph and dirtyconfig compatible plugin compatible with munin version > 2.0.

If someone uses munin and would like to try and maybe even give some feedback, give it a try.

Can you explain how to install the files?

thank you!
it looks interesting but i cannot get it to work on debian stretch.
i put your plugins into the plugins-dir and symlinked them to /etc/munin/plugins.
i put the suggested config into configfile, and since munin complained i changed url to env.url, username to env.username etc.

munin-run --pidebug nextcloud_multi.py 
Failed to parse line: username = XXX. Should it have been 'env.username = XXX? at /usr/share/perl5/Munin/Node/Service.pm line 110.
 at /etc/munin/plugin-conf.d/custom-config line 5. Skipping the rest of the file at /usr/share/perl5/Munin/Node/Service.pm line 110.

i then had to install python3-requests.
now i get:

munin-run --pidebug nextcloud_apps.py
Traceback (most recent call last):
File “/etc/munin/plugins/nextcloud_apps.py”, line 99, in
NextcloudApps().main()
File “/etc/munin/plugins/nextcloud_apps.py”, line 95, in main
self.run()
File “/etc/munin/plugins/nextcloud_apps.py”, line 62, in run
r = s.get(os.environ.get(‘url’))
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 501, in get
return self.request(‘GET’, url, **kwargs)
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 603, in send
adapter = self.get_adapter(url=request.url)
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 685, in get_adapter
raise InvalidSchema(“No connection adapters were found for ‘%s’” % url)
requests.exceptions.InvalidSchema: No connection adapters were found for MY- URL

(not only with multi, but with the other plugs, too.)

@pete.dawgg @Sanook
I am really sorry, I completly forgot about this post.

About the install process: I would recommend to create a new plugin-config file for custom modules under /etc/munin/plugin-conf.d/ containing your configuration.

For example mine reads something like this:

[nextcloud_*]
env.username fancyusername123
env.password Passwortstring123
env.url https://cloud.example.net/ocs/v2.php/apps/serverinfo/api/v1/info

That way all plugins which start with nextcloud something can access those config parameters. I messed up the README which threw many people off right aways as Munin is not able to parse the = sign.

Essentially the plugin calls the serverinfo api endpoint, extracts some info and parses the info to be caompatible with the munin server.

addition

I hopefully corrected most mistakes in my bad documentation with this commit.

THX for the reply - i had already forgotten about this.
i set it up like you decribe but now i get “unknown error.”
when put the api-url into a browser with user/pw i just get the login-page and when i then login i get “error - status 997”

(in the meantime i have upgraded to debian buster)
but don’t worry about it, it’s really not top priority.

@pete.dawgg that status code is quite common, meaning that the current session is not logged into any account.
I am not sure if http basic auth is working with Nextcloud, thus you need to first get the login token by logging into your cloud normally and then you could visit the api-url with your browser.
The plugin does the login for you, hence no manual step is necessary, only if you wish to see the lengthy xml/ json output in your browser. :smiley: