aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnextcloud_apps.py (renamed from nextcloud_apps)2
-rwxr-xr-xnextcloud_dbsize.py (renamed from nextcloud_dbsize)2
-rwxr-xr-xnextcloud_multi.py (renamed from nextcloud_multi)14
-rwxr-xr-xnextcloud_shares.py (renamed from nextcloud_shares)4
-rwxr-xr-xnextcloud_users.py (renamed from nextcloud_users)13
-rw-r--r--requirements.txt1
6 files changed, 26 insertions, 10 deletions
diff --git a/nextcloud_apps b/nextcloud_apps.py
index e7ec543..4ef3abc 100755
--- a/nextcloud_apps
+++ b/nextcloud_apps.py
@@ -35,7 +35,7 @@ class NextcloudApps:
return config
def get_data(self, api_response):
- data ={
+ data = {
'nextcloud_available_updates': []
}
diff --git a/nextcloud_dbsize b/nextcloud_dbsize.py
index 0d4ce9d..b9377a7 100755
--- a/nextcloud_dbsize
+++ b/nextcloud_dbsize.py
@@ -36,7 +36,7 @@ class NextcloudDB:
return config
def get_data(self, api_response):
- data ={
+ data = {
'nextcloud_dbsize': [],
}
diff --git a/nextcloud_multi b/nextcloud_multi.py
index c419ee1..5e4b18e 100755
--- a/nextcloud_multi
+++ b/nextcloud_multi.py
@@ -40,7 +40,10 @@ class NextcloudMultiGraph:
'last1hour.min 0',
'last24hours.label last 24 hours',
'last24hours.info users connected in the last 24 hours',
- 'last24hours.min 0'
+ 'last24hours.min 0',
+ 'num_users.label number of users',
+ 'num_users.info total number of users',
+ 'num_users.min 0'
],
'shares': [
'multigraph nextcloud_shares',
@@ -92,7 +95,8 @@ class NextcloudMultiGraph:
'graph_category nextcloud',
'num_updates_available.label available app updates',
'num_updates_available.info number of available app updates',
- 'num_updates_available.min 0'
+ 'num_updates_available.min 0',
+ 'num_updates_available.warning 1'
]
}
@@ -107,13 +111,17 @@ class NextcloudMultiGraph:
}
# users
- users = api_response['ocs']['data']['activeUsers']
+ users = api_response['ocs']['data']['activeUsers']
+ num_users = api_response['ocs']['data']['nextcloud']['storage']['num_users']
data['nextcloud_users'].append('multigraph nextcloud_users')
# append for every key in users the key and the value to the results
[data['nextcloud_users'].append(str(key) + ".value " + str(users[key]))
for key in users.keys()]
+ # append total number of users
+ data['nextcloud_users'].append('num_users.value %s' % num_users)
+
# shares
shares = api_response['ocs']['data']['nextcloud']['shares']
data['nextcloud_shares'].append('multigraph nextcloud_shares')
diff --git a/nextcloud_shares b/nextcloud_shares.py
index dc56fba..0057a4c 100755
--- a/nextcloud_shares
+++ b/nextcloud_shares.py
@@ -12,7 +12,6 @@
#
# #%# family=manual
# #%# capabilities=autoconf
-import re
import requests
import sys
import os
@@ -54,7 +53,7 @@ class NextcloudShares:
return config
def get_data(self, api_response):
- data ={
+ data = {
'nextcloud_shares': [],
}
@@ -113,5 +112,6 @@ class NextcloudShares:
else:
self.run()
+
if __name__ == "__main__":
NextcloudShares().main()
diff --git a/nextcloud_users b/nextcloud_users.py
index 350f14e..b2c651d 100755
--- a/nextcloud_users
+++ b/nextcloud_users.py
@@ -35,23 +35,30 @@ class NextcloudUsers:
'last1hour.min 0',
'last24hours.label last 24 hours',
'last24hours.info users connected in the last 24 hours',
- 'last24hours.min 0'
+ 'last24hours.min 0',
+ 'num_users.label number of users',
+ 'num_users.info total number of users',
+ 'num_users.min 0'
]
}
return config
def get_data(self, api_response):
- data ={
+ data = {
'nextcloud_users': [],
}
# users
- users = api_response['ocs']['data']['activeUsers']
+ users = api_response['ocs']['data']['activeUsers']
+ num_users = api_response['ocs']['data']['nextcloud']['storage']['num_users']
# append for every key in users the key and the value to the results
[data['nextcloud_users'].append(str(key) + ".value " + str(users[key]))
for key in users.keys()]
+ # append total number of users
+ data['nextcloud_users'].append('num_users.value %s' % num_users)
+
return data
def run(self):
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..111f18b
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+requests>=2.20.0