From 94896a14437a2a95c464ba71226ead2e45f34834 Mon Sep 17 00:00:00 2001 From: NodePing Date: Wed, 21 Jun 2023 14:34:25 -0700 Subject: [PATCH] MongoDB check type added --- nodeping_api/create_check.py | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/nodeping_api/create_check.py b/nodeping_api/create_check.py index 5919bfe..14e71b1 100644 --- a/nodeping_api/create_check.py +++ b/nodeping_api/create_check.py @@ -906,6 +906,82 @@ def imap4_check( return _query_nodeping_api.post(url, check_variables) +def mongodb_check( + token, + target, + customerid=None, + label="", + query="", + fields=None, + database="", + namespace="", + autodiag=False, + interval=DEFAULTS['interval'], + enabled=DEFAULTS['enabled'], + public=DEFAULTS['public'], + runlocations=DEFAULTS['runlocations'], + homeloc=DEFAULTS['homeloc'], + threshold=DEFAULTS['threshold'], + sens=DEFAULTS['sens'], + mute=DEFAULTS['mute'], + dep="", + notifications="", + **kwargs +): + """ Creates a NodePing MongoDB check + + Expects a token and target variable. The rest are optional + and are configured to match the NodePing defaults as described + in the documentation. + + :type token: string + :param token: NodePing account API token + :type target: string + :param target: URL to target host + :type customerid: string + :param customerid: Optional NodePing subaccount ID + :type label: string + :param label: Name of the check that will be created + :type query: string + :param query: query to send to the database server + :type fields: dict + :param fields: name, min, max key/values for matching + :type database: string + :param database: Name of the database to query + :type namespace: string + :param namespace: MongoDB collection + :type autodiag: bool + :param autodiag: Enable/disable auto diagnostics for this check + :type interval: int + :param interval: Interval in minutes to monitor target + :type enabled: bool + :param enabled: If created check will be enabled or disabled + :type public: bool + :param public: If the results for the created check will be public or not + :type runlocations: str or list + :param runlocations: Which region to be originated from + :type homeloc: str + :param homeloc: Which probe in the region to originate the check from + :type threshold: int + :param threshold: The max acceptable packet loss + :type sens: int + :param sens: Rechecks to help avoid unecessary notifications + :type dep: string + :param dep: ID of the check used for the notification dependency + :type notifications: list + :param notifications: list of objects containing contact ID, delay, and + scheduling for notifications + :return: Response from NodePing + :rtype: dict + """ + + check_variables = _package_variables(locals(), 'MONGODB') + + url = _utils.create_url(token, API_URL, customerid) + + return _query_nodeping_api.post(url, check_variables) + + def mtr_check( token, target,