{"id":18750920,"url":"https://github.com/borntoberoot/check_nextcloud","last_synced_at":"2025-04-13T00:09:31.145Z","repository":{"id":41160171,"uuid":"104855125","full_name":"BornToBeRoot/check_nextcloud","owner":"BornToBeRoot","description":"Nagios/Centreon plugin for nextcloud serverinfo API (https://github.com/nextcloud/serverinfo)","archived":false,"fork":false,"pushed_at":"2024-01-26T23:10:52.000Z","size":58,"stargazers_count":32,"open_issues_count":2,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-13T00:08:36.464Z","etag":null,"topics":["api","centreon","centreon-plugin","monitoring","nagios","nagios-plugin","nextcloud","nextcloud-server","python","python-script","serverinfo"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BornToBeRoot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-09-26T08:05:44.000Z","updated_at":"2024-02-11T03:10:34.000Z","dependencies_parsed_at":"2024-01-18T20:39:30.062Z","dependency_job_id":"b1c4e77f-0923-4c26-bb57-3200537b9ba4","html_url":"https://github.com/BornToBeRoot/check_nextcloud","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BornToBeRoot%2Fcheck_nextcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BornToBeRoot%2Fcheck_nextcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BornToBeRoot%2Fcheck_nextcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BornToBeRoot%2Fcheck_nextcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BornToBeRoot","download_url":"https://codeload.github.com/BornToBeRoot/check_nextcloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647299,"owners_count":21139086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","centreon","centreon-plugin","monitoring","nagios","nagios-plugin","nextcloud","nextcloud-server","python","python-script","serverinfo"],"created_at":"2024-11-07T17:13:37.276Z","updated_at":"2025-04-13T00:09:31.090Z","avatar_url":"https://github.com/BornToBeRoot.png","language":"Python","readme":"# Nagios/Centron check | Nextcloud serverinfo\n\nNagios/Centreon plugin for nextcloud serverinfo API (https://github.com/nextcloud/serverinfo)\n\nThis branch contains the check for Python 3. A version for Python 2.7 can be found [here](https://github.com/BornToBeRoot/check_nextcloud/tree/stable-python2.7).\n\n## Syntax / Help\n\n```\n./check_nextcloud.py -u username -p password -H cloud.example.com -c [system|storage|shares|webserver|php|database|users|apps]\n\n\nOptions:\n  -h, --help            show this help message and exit\n  -v, --version         Print the version of this script\n  -u USERNAME, --username=USERNAME\n                        Username of the user with administrative permissions\n                        on the nextcloud server\n  -p PASSWORD, --password=PASSWORD\n                        Password of the user\n  -t TOKEN, --nc-token=TOKEN\n                        NC-Token for the Serverinfo API\n  -H HOSTNAME, --hostname=HOSTNAME\n                        Nextcloud server address (make sure that the address\n                        is a trusted domain in the config.php)\n  -c CHECK, --check=CHECK\n                        The thing you want to check\n                        [system|storage|shares|webserver|php|database|activeUsers|uploadFilesize|apps]\n  --upload-filesize     Filesize in MiB, GiB without spaces (default=\"512.0GiB\")\n  --protocol=PROTOCOL   Protocol you want to use [http|https]\n                        (default=\"https\")\n  --ignore-proxy        Ignore any configured proxy server on this system for\n                        this request\n  --api-url=API_URL     Url of the api\n                        (default=\"/ocs/v2.php/apps/serverinfo/api/v1/info\")\n\n```\n\n## Install\n\n* Copy the check (python script) in your nagios/centreon plugins folder\n* Create a check with the following command line:\n  ```\n  $USER1$/plugins_custom/check_nextcloud.py -u $_HOSTCLOUDUSER$ -p $_HOSTCLOUDPWD$ -H $HOSTNAME$ -c $ARG1$ --ignore-proxy\n  ```\n  or for the check: `uploadFilesize`\n  ```\n  $USER1$/plugins_custom/check_nextcloud.py -u $_HOSTCLOUDUSER$ -p $_HOSTCLOUDPWD$ -H $HOSTNAME$ -c $ARG1$ --upload-filesize=$ARG2$ --ignore-proxy\n  ```\n* Create a service for each thing you want to check (system, storage, etc.) and link it to your host(s)\n* Add the credentials of your nextcloud admin user as custom macro (CLOUDUSER, COUDPWD) to your host.\n\n## Example 1\n\n```\n./check_nextcloud.py -u adminUser -p secretPassword -H cloud.example.com -c system --ignore-proxy\n\nOK - Nextcloud version: 12.0.3.3\n```\n\n## Example 2\n\n```\n./check_nextcloud.py -u adminUser -p secretPassword -H cloud.example.com -c activeUsers --ignore-proxy\n\nOK - Last 5 minutes: 3 user(s), last 1 hour: 10 user(s), last 24 hour: 44 user(s) | users_last_5_minutes=3, users_last_1_hour=10, users_last_24_hours=44\n```\n\nThis will return a status message and create a graph based on the performance data.\n\n## Example 3\n\n```\n./check_nextcloud.py -u adminUser -p secretPassword -H cloud.example.com -c uploadFilesize --upload-filesize=2.0GiB --ignore-proxy\n\nOK - Upload max filesize: 2.0GiB\n\n# Or, when changed after an update...\n\nCRITICAL - Upload max filesize is set to 512.0MiB, but should be 2.0GiB\n\n```\n\n\n\n## Icinga config example\n\n\nAdjust the command path to your local situation.\n\n```\nobject CheckCommand \"check_nextcloud\" {\n  command = [ \"/var/lib/nagios/src/check_nextcloud/check/check_nextcloud.py\" ]\n  arguments = {\n    \"--nc-token\" = {\n      value = \"$nextcloud_token$\"\n      description = \"NC-Token for the Serverinfo API\"\n    }\n    \"--hostname\" = {\n      value = \"$nextcloud_hostname$\"\n      description = \"Hostname\"\n    }\n    \"--api-url\" = {\n      value = \"$nextcloud_api_url$\"\n      set_if = \"$nextcloud_api_url$\"\n      description = \"Api-url\"\n    }\n    \"--check\" = {\n      value = \"$nextcloud_check$\"\n      description = \"Which check to run\"\n    }\n    \"--perfdata-format\" = {\n      value = \"nagios\"\n      description = \"The perfdata format we like\"\n    }\n  }\n}\n```\n\n```\napply Service for (checkname in [\"system\",\"storage\",\"shares\",\"webserver\",\"php\",\"database\",\"activeUsers\",\"uploadFilesize\",\"apps\"]) {\n  import \"generic-service\"\n  name = \"check-nextcloud-\" + checkname\n  check_interval = 30m\n  retry_interval = 10m\n  display_name = \"Nextcloud monitor \" + checkname\n  vars.notification_interval = 1d\n\n  vars.nextcloud_check = checkname\n  vars.nextcloud_hostname = host.vars.nextcloud_hostname\n  vars.nextcloud_token = host.vars.nextcloud_token\n  vars.nextcloud_api_url = host.vars.nextcloud_api_url\n  vars.notification[\"mail\"] = {  }\n  check_command = \"check_nextcloud\"\n\n  assign where (host.address || host.address6) \u0026\u0026 host.vars.nextcloud_token\n}\n```\n\n```\nobject Host \"server42.example.com\" {\n\n  display_name = \"My Nextcloud server\"\n  address = \"\u003cIP\u003e\"\n\n  ...\n\n  # The token can be set with: occ config:app:set serverinfo token --value yourtoken\n  vars.nextcloud_token = \"XXX\"\n  vars.nextcloud_hostname = \"nextcloud.example.com\"\n\n  # Optional if you e.g. use a subdirectory.\n  vars.nextcloud_api_url = \"/subdir/ocs/v2.php/apps/serverinfo/api/v1/info\"\n}\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborntoberoot%2Fcheck_nextcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborntoberoot%2Fcheck_nextcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborntoberoot%2Fcheck_nextcloud/lists"}