zabbix / community-templates

Zabbix Community Templates repository
https://share.zabbix.com
MIT License
1.39k stars 1.81k forks source link

Connect to Nextcloud API with enabled 2-factor auth #88

Open yukh975 opened 2 years ago

yukh975 commented 2 years ago

Unable to connect to Nextcloud API with enabled 2-factor auth with App Nextcloud Template.

Just-Insane commented 1 year ago

Not sure if you still need this, but you can modify the template to use the following Key for the Nextcloud Monitoring API item:

system.run[curl -s -H "NC-Token: {$NC_TOKEN}" {$HTTP_OR_HTTPS}://{$FQDN_NEXTCLOUD}/ocs/v2.php/apps/serverinfo/api/v1/info]

Then, instead of setting a user and password macro on the host, set the nc_token macro. You can find more information on the system page of your Nextcloud instance on how to set the token used by the monitoring API. Something like:

occ config:app:set serverinfo token --value yourtoken where yourtoken is an app password token (which you can optionally disable file access for).