Version 2.2.1
This commit is contained in:
@@ -30,6 +30,7 @@ OPTIONS:
|
||||
-h, --help Show this help message and exit
|
||||
""")
|
||||
|
||||
# set this to true to produce debug output (this clutters the agent output)
|
||||
DEBUG = False
|
||||
|
||||
nc_api_endpoint = "ocs/v2.php/apps/serverinfo/api/v1/info?format=json"
|
||||
@@ -190,7 +191,8 @@ def getDataUser(url, verify):
|
||||
|
||||
def doCmkOutput(data):
|
||||
print("<<<nextcloud_info:sep(59)>>>")
|
||||
print(f"NC_Version;{data['ocs']['data']['nextcloud']['system']['version']}")
|
||||
print(f"NC_Version;{data['ocs']['data']['nextcloud']['system']['version']}")
|
||||
print(f"NC_Freespace;{data['ocs']['data']['nextcloud']['system']['freespace']}")
|
||||
print(f"NC_Status;{data['ocs']['meta']['status']}")
|
||||
print(f"NC_Num_Users;{data['ocs']['data']['nextcloud']['storage']['num_users']}")
|
||||
print(f"NC_Num_Files;{data['ocs']['data']['nextcloud']['storage']['num_files']}")
|
||||
@@ -204,6 +206,8 @@ def doCmkOutput(data):
|
||||
print(f"NC_Active_Users_Last_5Min;{data['ocs']['data']['activeUsers']['last5minutes']}")
|
||||
print(f"NC_Active_Users_Last_1Hour;{data['ocs']['data']['activeUsers']['last1hour']}")
|
||||
print(f"NC_Active_Users_Last_1Day;{data['ocs']['data']['activeUsers']['last24hours']}")
|
||||
print(f"NC_Webserver;{data['ocs']['data']['server']['webserver']}")
|
||||
print(f"NC_PHP_Version;{data['ocs']['data']['server']['php']['version']}")
|
||||
|
||||
print("<<<nextcloud_database:sep(59)>>>")
|
||||
print(f"NC_Database_Type;{data['ocs']['data']['server']['database']['type']}")
|
||||
@@ -261,7 +265,13 @@ def main():
|
||||
protocol = "http"
|
||||
else:
|
||||
protocol = "https"
|
||||
port = opt_port
|
||||
port = opt_port
|
||||
if (protocol == "http" and port == "443"):
|
||||
sys.stderr.write(f"Combining HTTP with port 443 is not supported.\n")
|
||||
sys.exit(1)
|
||||
if (protocol == "https" and port == "80"):
|
||||
sys.stderr.write(f"Combining HTTPS with port 80 is not supported.\n")
|
||||
sys.exit(1)
|
||||
nc_url = createUrl(nc_api_endpoint, opt_hostname, protocol, port, opt_folder)
|
||||
nc_data = getData(nc_url, verify)
|
||||
doCmkOutput(nc_data)
|
||||
|
||||
Reference in New Issue
Block a user