Skip to content

Commit

Permalink
Bump 1.6.0. Add mtr and redis check
Browse files Browse the repository at this point in the history
  • Loading branch information
NodePing committed Oct 6, 2022
1 parent 9058c42 commit 2767b1d
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 1 deletion.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ All notable changes to this project will be documented in this file.

(Placeholder for unreleased content)

## [1.6.0]

2022-10-06

### Added

* Add support for redis check https://nodeping.com/redis_check.html
* Add support for mtr check https://nodeping.com/mtr_check.html

## [1.5.0]

2022-03-23
Expand Down
136 changes: 136 additions & 0 deletions nodeping_api/create_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,72 @@ def imap4_check(
return _query_nodeping_api.post(url, check_variables)


def mtr_check(
token,
target,
customerid=None,
label="",
autodiag=False,
ipv6=DEFAULTS['ipv6'],
interval=DEFAULTS['interval'],
enabled=DEFAULTS['enabled'],
public=DEFAULTS['public'],
runlocations=DEFAULTS['runlocations'],
homeloc=DEFAULTS['homeloc'],
threshold=DEFAULTS['threshold'],
sens=DEFAULTS['sens'],
dep="",
notifications="",
**kwargs
):
""" Creates a NodePing MTR 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 autodiag: bool
:param autodiag: Enable/disable auto diagnostics for this check
:type ipv6: bool
:param ipv6: If the ping should be icmpv6
: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(), 'MTR')

url = _utils.create_url(token, API_URL, customerid)

return _query_nodeping_api.post(url, check_variables)


def mysql_check(
token,
target,
Expand Down Expand Up @@ -1236,6 +1302,76 @@ def port_check(
return _query_nodeping_api.post(url, check_variables)


def redis_check(
token,
target,
redistype,
hosts=[],
sentinelname=None,
customerid=None,
label="",
autodiag=False,
interval=DEFAULTS['interval'],
enabled=DEFAULTS['enabled'],
public=DEFAULTS['public'],
runlocations=DEFAULTS['runlocations'],
homeloc=DEFAULTS['homeloc'],
threshold=DEFAULTS['threshold'],
sens=DEFAULTS['sens'],
oldresultfail=False,
dep="",
notifications="",
**kwargs
):
""" Creates a NodePing REDIS check
:type token: string
:param token: NodePing account API token
:type target: string
:param target: URL to target host
:type redistype: string
:param redistype: standalone, sentinel, cluster
:type hosts: list
:param hosts: For sentinel or cluster. The hostname, port, and password to connect
:sentinelname: The master/primary name for the sentinel to query
:type customerid: string
:param customerid: Optional NodePing subaccount ID
:type label: string
:param label: Name of the check that will be created
:type autodiag: bool
:param autodiag: Enable/disable auto diagnostics for this check
:type fields: dict
:param fields: Contents of each metric collected with min/max values
: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: Time in seconds for an acceptable response
: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(), 'REDIS')

url = _utils.create_url(token, API_URL, customerid)

return _query_nodeping_api.post(url, check_variables)


def push_check(
token,
checktoken="reset",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
URL = "https://github.com/NodePing/python-nodeping-api"
EMAIL = "[email protected]"
AUTHOR = "NodePing"
VERSION = "1.5.0"
VERSION = "1.6.0"
LICENSE = "MIT"

setuptools.setup(
Expand Down

0 comments on commit 2767b1d

Please sign in to comment.