Skip to content

Commit

Permalink
MongoDB check type added
Browse files Browse the repository at this point in the history
  • Loading branch information
NodePing committed Jun 21, 2023
1 parent 7c0a703 commit 94896a1
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions nodeping_api/create_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 94896a1

Please sign in to comment.