From 0695a250ebc95e47721413f564dfafbb58b09aff Mon Sep 17 00:00:00 2001 From: NodePing Date: Sat, 28 Aug 2021 16:24:25 -0700 Subject: [PATCH] 2021-08-24 API updates and version bump --- changelog.md | 28 +++++++++--- nodeping_api/accounts.py | 6 ++- nodeping_api/create_check.py | 84 ++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 4 files changed, 112 insertions(+), 8 deletions(-) diff --git a/changelog.md b/changelog.md index 86856a1..f34bb5e 100644 --- a/changelog.md +++ b/changelog.md @@ -3,8 +3,17 @@ All notable changes to this project will be documented in this file. ## [Unreleased] + (Placeholder for unreleased content) +## [1.2.5] + +### Added + +- `autodiag` flag for check creation +- Verify subminute interval check creation works +- Add `autodiagnotifications` to account creation and update options + ## [1.2.4] ### Added @@ -18,7 +27,6 @@ All notable changes to this project will be documented in this file. - Added the `sendheaders` field to the HTTP Parse check - Improved the `create_check.httpparse_check` docstring - ## [1.2.2] ### Added @@ -53,6 +61,7 @@ Fixed the `disabled_checks` function to check the `enable` field to see if the c 2020-08-25 ### Added + - Added the `servername` variable to `create_check.ssl_check` ## [1.1.3] @@ -60,6 +69,7 @@ Fixed the `disabled_checks` function to check the `enable` field to see if the c 2020-07-16 ### Fixed + - Failed import fixed for Python 2.7 ## [1.1.2] @@ -67,53 +77,61 @@ Fixed the `disabled_checks` function to check the `enable` field to see if the c 2020-05-06 ### Added + - Support for getting diagnostics data ## [1.1.1] ### Added + - Support for creating AGENT checks - Test added for creating an AGENT check ## [1.1] ### Added + - Support for the new maintenance functionality ## [1.0] ### Added + - New tests via pytest -- Code reuse was simplified with a couple functions in a _utils.py file for simple URL creation as well as a function that will escape strings that are used in URLs +- Code reuse was simplified with a couple functions in a \_utils.py file for simple URL creation as well as a function that will escape strings that are used in URLs ### Changed + - Error outputs are different. Instead of ambiguous errors or 403 Forbidden results due to an invalid token or customerid, error responses given directly from the API will be provided in dictionary format. ### Fixed -- group_contacts.py update_groups got a required vairable "name" for the name of the contact group that will be modified. Previously, group changes resulted in a new group being created instead of updated. +- group_contacts.py update_groups got a required vairable "name" for the name of the contact group that will be modified. Previously, group changes resulted in a new group being created instead of updated. ## [0.9.9_3] ### Changed + - Added Spec10DNS create check functionality - Added Spec10RDDS create check functionality - Added a verify parameter to verify DNSSEC when creating a DNS check (default is False) ### Fixed + - Contacts were not being created properly outside of email and sms contact types. - Refer to the README and contacts.create_contact docstring. Instead of a list of addresses, it is now a list of dictionaries with the address and type. ## [0.9.9] - 2019-08-10 ### Changed + - update_checks.update - **checktype** parameter now required. This is the TYPE for the check (PING, HTTP, DNS, etc.) - update_checks.update_many - The `checkids` type was changed to a dictionary from a list to match the checktype with the check - When updating many checks, the dict would look like {checkid1: TYPE, checkid2: TYPE} - - + ### Fixed + - update_checks.update properly updates all fields. The lack of checktype could cause some fields for a check to not update - update_checks.update_many properly updates all fields, for the same reason as above. diff --git a/nodeping_api/accounts.py b/nodeping_api/accounts.py index 1d62212..2e89d99 100644 --- a/nodeping_api/accounts.py +++ b/nodeping_api/accounts.py @@ -39,7 +39,8 @@ def create_subaccount(token, email, timezone, location, - emailme=False + emailme=False, + autodiagnotifications=False ): """ Create a subaccount with your NodePing account. @@ -79,7 +80,8 @@ def update_account(token, timezone=None, location=None, emailme=False, - status=None + status=None, + autodiagnotifications=False ): """ Update information about the parent account or subaccounts diff --git a/nodeping_api/create_check.py b/nodeping_api/create_check.py index e667ab5..6cdece4 100644 --- a/nodeping_api/create_check.py +++ b/nodeping_api/create_check.py @@ -46,6 +46,7 @@ def agent_check( token, customerid=None, label="", + autodiag=False, interval=1, enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -71,6 +72,8 @@ def agent_check( :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 interval: int :param interval: Interval in minutes to monitor target :type enabled: bool @@ -103,6 +106,7 @@ def audio_check( target, customerid=None, label="", + autodiag=False, verifyvolume=False, volumemin=-45, interval=DEFAULTS['interval'], @@ -130,6 +134,8 @@ def audio_check( :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 :param verifyvolume: enable/disable volume detection :type verifyvolume: bool :param volumemin: The acceptable range for volume detection @@ -168,6 +174,7 @@ def cluster_check( data, customerid="", label="", + autodiag=False, interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -202,6 +209,8 @@ def cluster_check( :param customerid: Optional NodePing subaccount ID :type label: string :param label: Name of check that will be created + :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 @@ -246,6 +255,7 @@ def dns_check( contentstring="", dnstoresolve="", label="", + autodiag=False, interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -280,6 +290,8 @@ def dns_check( :param dnstoresolve: FQDN/IP you want to resolve :type label: string :param label: Name of check that will be created + :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 @@ -317,6 +329,7 @@ def doh_dot_check( target, dnstoresolve, label="", + autodiag=False, customerid="", dohdot="doh", method="GET", @@ -349,6 +362,8 @@ def doh_dot_check( :param dnstoresolve: FQDN to query on target :type label: str :param label: name for the check + :type autodiag: bool + :param autodiag: Enable/disable auto diagnostics for this check :type customerid: string :param customerid: Optional NodePing subaccount ID :type dohdot: str @@ -406,6 +421,7 @@ def ftp_check( target, customerid="", label="", + autodiag=False, port=21, username="", password="", @@ -432,6 +448,8 @@ def ftp_check( :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 port: int :param port: Port to FTP server :type username: string @@ -477,6 +495,7 @@ def http_check( target, customerid="", label="", + autodiag=False, ipv6=False, follow=False, interval=DEFAULTS['interval'], @@ -500,6 +519,8 @@ def http_check( :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: Whether to resolve IPv4 or IPv6 :type follow: bool @@ -539,6 +560,7 @@ def httpadv_check( target, customerid="", label="", + autodiag=False, invert=False, contentstring="", data="", @@ -578,6 +600,8 @@ def httpadv_check( :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 invert: bool :param invert: Used for "Does not contain" functionality :type data: dict @@ -631,6 +655,7 @@ def httpcontent_check( target, customerid="", label="", + autodiag=False, invert=False, contentstring="", ipv6=False, @@ -658,6 +683,8 @@ def httpcontent_check( :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 invert: bool :param invert: Used for "Does not contain" functionality :type contentstring: string @@ -701,6 +728,7 @@ def httpparse_check( target, customerid="", label="", + autodiag=False, fields="", sendheaders={}, interval=DEFAULTS['interval'], @@ -747,6 +775,8 @@ def httpparse_check( :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: Keyed list of fields, with an arbitrary string as the key. Should contain 3 elements: name, min, and max @@ -789,6 +819,7 @@ def imap4_check( target, customerid="", label="", + autodiag=False, port=143, verify=True, email="", @@ -817,6 +848,8 @@ def imap4_check( :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 port: int :param port: The port used to test IMAP4 communications :type verify: bool @@ -866,6 +899,7 @@ def mysql_check( target, customerid=None, label="", + autodiag=False, interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -887,6 +921,8 @@ def mysql_check( :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 interval: int :param interval: Interval in minutes to monitor target :type enabled: bool @@ -922,6 +958,7 @@ def ntp_check( target, customerid=None, label="", + autodiag=False, invert=False, port=123, interval=DEFAULTS['interval'], @@ -949,6 +986,8 @@ def ntp_check( :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 invert: bool :param invert: True means the check will pass if there is a response :type port: int @@ -988,6 +1027,7 @@ def ping_check( target, customerid=None, label="", + autodiag=False, ipv6=DEFAULTS['ipv6'], interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], @@ -1014,6 +1054,8 @@ def ping_check( :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 @@ -1051,6 +1093,7 @@ def pop3_check( target, customerid=None, label="", + autodiag=False, port="", verify=True, email="", @@ -1083,6 +1126,8 @@ def pop3_check( :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 port: int :param port: The port used to test POP communications :type verify: bool @@ -1132,6 +1177,7 @@ def port_check( target, customerid=None, label="", + autodiag=False, invert=False, port="", interval=DEFAULTS['interval'], @@ -1154,6 +1200,8 @@ def port_check( :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 invert: bool :param invert: False if you expect to not have connections to port accepted :type port: int @@ -1193,6 +1241,7 @@ def push_check( checktoken="reset", customerid=None, label="", + autodiag=False, fields="", interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], @@ -1241,6 +1290,8 @@ def push_check( :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 @@ -1280,6 +1331,7 @@ def rbl_check( target, customerid=None, label="", + autodiag=False, ignore="", interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], @@ -1307,6 +1359,8 @@ def rbl_check( :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 ignore: list :param ignore: A list of DNSBL blacklists to ignore :type interval: int @@ -1344,6 +1398,7 @@ def rdp_check( target, customerid=None, label="", + autodiag=False, interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -1365,6 +1420,8 @@ def rdp_check( :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 interval: int :param interval: Interval in minutes to monitor target :type enabled: bool @@ -1400,6 +1457,7 @@ def spec10dns_check( data, customerid="", label="", + autodiag=False, interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -1434,6 +1492,8 @@ def spec10dns_check( :param customerid: Optional NodePing subaccount ID :type label: string :param label: Name of check that will be created + :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 @@ -1471,6 +1531,7 @@ def spec10rdds_check( data, customerid="", label="", + autodiag=False, interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -1505,6 +1566,8 @@ def spec10rdds_check( :param customerid: Optional NodePing subaccount ID :type label: string :param label: Name of check that will be created + :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 @@ -1542,6 +1605,7 @@ def sip_check( target, customerid=None, label="", + autodiag=False, interval=DEFAULTS['interval'], enabled=DEFAULTS['enabled'], public=DEFAULTS['public'], @@ -1563,6 +1627,8 @@ def sip_check( :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 interval: int :param interval: Interval in minutes to monitor target :type enabled: bool @@ -1598,6 +1664,7 @@ def smtp_check( target, customerid=None, label="", + autodiag=False, invert=False, port=25, verify=True, @@ -1626,6 +1693,8 @@ def smtp_check( :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 invert: bool :param invert: Check whether or not SMTP accepts mail from the address :type port: int @@ -1677,6 +1746,7 @@ def snmp_check( target, customerid=None, label="", + autodiag=False, port=161, fields="", snmpv=1, @@ -1722,6 +1792,8 @@ def snmp_check( :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 port: int :param port: Port for testing SNMP connectivity :type fields: dict @@ -1767,6 +1839,7 @@ def ssh_check( target, customerid=None, label="", + autodiag=False, invert=False, contentstring="", port=22, @@ -1793,6 +1866,8 @@ def ssh_check( :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 contentstring: string :param contentstring: string to look for in the response after login :type port: int @@ -1836,6 +1911,7 @@ def ssl_check( target, customerid=None, label="", + autodiag=False, warningdays="", servername="", interval=DEFAULTS['interval'], @@ -1859,6 +1935,8 @@ def ssl_check( :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 warningdays: int :param warningdays: Number of days to warn about expiring SSL/TLS cert :type servername: string @@ -1898,6 +1976,7 @@ def websocket_check( target, customerid=None, label="", + autodiag=False, invert=False, contentstring="", data="", @@ -1922,6 +2001,8 @@ def websocket_check( :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 invert: bool :param invert: If the response does/does not contain a string :type contentstring: string @@ -1963,6 +2044,7 @@ def whois_check( target, customerid=None, label="", + autodiag=False, whoisserver="", ipv6=False, invert=False, @@ -1989,6 +2071,8 @@ def whois_check( :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 whoisserver: string :param whoisserver: Server to query for whois entry :type ipv6: bool diff --git a/setup.py b/setup.py index a614079..3e74829 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ URL = "https://github.com/NodePing/python-nodeping-api" EMAIL = "support@nodeping.com" AUTHOR = "NodePing" -VERSION = "1.2.4" +VERSION = "1.2.5" LICENSE = "MIT" setuptools.setup(