4.5.5.1. Monitor

class dyn.tm.services.gslb.Monitor(protocol, interval, retries=None, timeout=None, port=None, path=None, host=None, header=None, expected=None)[source]

A Monitor for a GSLB Service

__init__(protocol, interval, retries=None, timeout=None, port=None, path=None, host=None, header=None, expected=None)[source]

Create a Monitor object

Parameters:
  • protocol – The protocol to monitor. Must be either HTTP, HTTPS, PING, SMTP, or TCP
  • interval – How often (in minutes) to run the monitor. Must be 1, 5, 10, or 15,
  • retries – The number of retries the monitor attempts on failure before giving up
  • timeout – The amount of time in seconds before the connection attempt times out
  • port – For HTTP(S)/SMTP/TCP probes, an alternate connection port
  • path – For HTTP(S) probes, a specific path to request
  • host – For HTTP(S) probes, a value to pass in to the Host
  • header – For HTTP(S) probes, additional header fields/values to pass in, separated by a newline character.
  • expected – For HTTP(S) probes, a string to search for in the response. For SMTP probes, a string to compare the banner against. Failure to find this string means the monitor will report a down status.
expected

For HTTP(S) probes, a string to search for in the response. For SMTP probes, a string to compare the banner against. Failure to find this string means the monitor will report a down status

header

For HTTP(S) probes, additional header fields/values to pass in, separated by a newline character

host

For HTTP(S) probes, a value to pass in to the Host

interval

How often to run this monitor

path

For HTTP(S) probes, a specific path to request

port

For HTTP(S)/SMTP/TCP probes, an alternate connection port

protocol

The protocol to monitor

retries

The number of retries the monitor attempts on failure before giving up

status

Get the current status of this HealthMonitor from the DynECT System

timeout

The amount of time in seconds before the connection attempt times out

to_json()[source]

Convert this HealthMonitor object to a JSON blob

4.5.5.2. GSLBRegionPoolEntry

class dyn.tm.services.gslb.GSLBRegionPoolEntry(zone, fqdn, region_code, address, *args, **kwargs)[source]

GSLBRegionPoolEntry

__init__(zone, fqdn, region_code, address, *args, **kwargs)[source]

Create a GSLBRegionPoolEntry object

Parameters:
  • zone – Zone monitored by this GSLBRegionPoolEntry
  • fqdn – The fqdn of the specific node which will be monitored by this GSLBRegionPoolEntry
  • region_code – ISO Region Code for this GSLBRegionPoolEntry
  • address – The IP address or FQDN of this Node IP
  • label – Identifying descriptive information for this GSLBRegionPoolEntry
  • weight – A number in the range of 1-14 controlling the order in which this GSLBRegionPoolEntry will be served
  • serve_mode – Sets the behavior of this particular record. Must be one of ‘always’, ‘obey’, ‘remove’, ‘no’
address

The IP address or FQDN of this Node IP

delete()[source]

Delete this GSLBRegionPoolEntry from the DynECT System

fqdn

The fqdn of the specific node which will be monitored by this GSLBRegionPoolEntry

label

Identifying descriptive information for this GSLBRegionPoolEntry

region_code

ISO Region Code for this GSLBRegionPoolEntry

serve_mode

Sets the behavior of this particular record. Must be one of ‘always’, ‘obey’, ‘remove’, or ‘no’

sync()[source]

Sync this GSLBRegionPoolEntry object with the DynECT System

task

Task for most recent system action on this ActiveFailover.

to_json()[source]

Convert this object into a json blob

weight

A number in the range of 1-14 controlling the order in which this GSLBRegionPoolEntry will be served.

zone

Zone monitored by this GSLBRegionPoolEntry

4.5.5.3. GSLBRegion

class dyn.tm.services.gslb.GSLBRegion(zone, fqdn, region_code, *args, **kwargs)[source]

docstring for GSLBRegion

__init__(zone, fqdn, region_code, *args, **kwargs)[source]

Create a GSLBRegion object

Parameters:
  • zone – Zone monitored by this GSLBRegion
  • fqdn – The fqdn of the specific node which will be monitored by this GSLBRegion
  • region_code – ISO region code of this GSLBRegion
  • pool – (*arg) The IP Pool list for this GSLBRegion
  • serve_count – How many records will be returned in each DNS response
  • failover_mode – How the GSLBRegion should failover. Must be one of ‘ip’, ‘cname’, ‘region’, ‘global’
  • failover_data – Dependent upon failover_mode. Must be one of ‘ip’, ‘cname’, ‘region’, ‘global’
delete()[source]

Delete this GSLBRegion

failover_data

Dependent upon failover_mode. Must be one of ‘ip’, ‘cname’, ‘region’, ‘global’

failover_mode

How the GSLBRegion should failover. Must be one of ‘ip’, ‘cname’, ‘region’, ‘global’

fqdn

The fqdn of the specific node which will be monitored by this GSLBRegion

pool

The IP Pool list for this GSLBRegion

region_code

ISO region code of this GSLBRegion

serve_count

How many records will be returned in each DNS response

sync()[source]

Sync this GSLBRegion object with the DynECT System

task

Task for most recent system action on this ActiveFailover.

zone

Zone monitored by this GSLBRegion

4.5.5.4. GSLB

class dyn.tm.services.gslb.GSLB(zone, fqdn, *args, **kwargs)[source]

A Global Server Load Balancing (GSLB) service

__init__(zone, fqdn, *args, **kwargs)[source]

Create a GSLB object

Parameters:
  • auto_recover – Indicates whether or not the service should automatically come out of failover when the IP addresses resume active status or if the service should remain in failover until manually reset. Must be ‘Y’ or ‘N’
  • ttl – Time To Live in seconds of records in the service. Must be less than 1/2 of the Health Probe’s monitoring interval. Must be one of 30, 60, 150, 300, or 450
  • notify_events – A comma separated list of the events which trigger notifications. Must be one of ‘ip’, ‘svc’, or ‘nosrv’
  • syslog_server – The Hostname or IP address of a server to receive syslog notifications on monitoring events
  • syslog_port – The port where the remote syslog server listens for notifications
  • syslog_ident – The ident to use when sending syslog notifications
  • syslog_facility – The syslog facility to use when sending syslog notifications. Must be one of ‘kern’, ‘user’, ‘mail’, ‘daemon’, ‘auth’, ‘syslog’, ‘lpr’, ‘news’, ‘uucp’, ‘cron’, ‘authpriv’, ‘ftp’, ‘ntp’, ‘security’, ‘console’, ‘local0’, ‘local1’, ‘local2’, ‘local3’, ‘local4’, ‘local5’, ‘local6’, or ‘local7’
  • syslog_delivery – The syslog delivery action type. ‘all’ will deliver notifications no matter what the endpoint state. ‘change’ (default) will deliver only on change in the detected endpoint state
  • region – A list of GSLBRegion’s
  • monitor – The health Monitor for this service
  • contact_nickname – Name of contact to receive notifications
  • syslog_probe_fmt – see below for format:
  • syslog_status_fmt – see below for format: Use the following format for syslog_xxxx_fmt paramaters. %hos hostname %tim current timestamp or monitored interval %reg region code %sta status %ser record serial %rda rdata %sit monitoring site %rti response time %msg message from monitoring %adr address of monitored node %med median value %rts response times (RTTM)
  • recovery_delay – number of up status polling intervals to consider service up
activate()[source]

Activate this GSLB service on the DynECT System

active

Indicates if the service is active. When setting directly, rather than using activate/deactivate valid arguments are ‘Y’ or True to activate, or ‘N’ or False to deactivate. Note: If your service is already active and you try to activate it, nothing will happen. And vice versa for deactivation.

Returns:An Active object representing the current state of this GSLB Service
auto_recover

Indicates whether or not the service should automatically come out of failover when the IP addresses resume active status or if the service should remain in failover until manually reset. Must be ‘Y’ or ‘N’

contact_nickname

Name of contact to receive notifications from this GSLB service

deactivate()[source]

Deactivate this GSLB service on the DynECT System

delete()[source]

Delete this GSLB service from the DynECT System

monitor

The health Monitor for this service

notify_events

A comma separated list of the events which trigger notifications. Must be one of ‘ip’, ‘svc’, or ‘nosrv’

recover(address=None)[source]

Recover the GSLB service on the designated zone node or a specific node IP within the service

recovery_delay
region

A list of GSLBRegion’s

status

The current state of the service. Will be one of ‘unk’, ‘ok’, ‘trouble’, or ‘failover’

sync()[source]

Sync this GSLB object with the DynECT System

syslog_delivery
syslog_facility

The syslog facility to use when sending syslog notifications. Must be one of ‘kern’, ‘user’, ‘mail’, ‘daemon’, ‘auth’, ‘syslog’, ‘lpr’, ‘news’, ‘uucp’, ‘cron’, ‘authpriv’, ‘ftp’, ‘ntp’, ‘security’, ‘console’, ‘local0’, ‘local1’, ‘local2’, ‘local3’, ‘local4’, ‘local5’, ‘local6’, or ‘local7’

syslog_ident

The ident to use when sending syslog notifications

syslog_port

The port where the remote syslog server listens for notifications

syslog_probe_format
syslog_server

The Hostname or IP address of a server to receive syslog notifications on monitoring events

syslog_status_format
task

Task for most recent system action on this GSLB.

ttl

Time To Live in seconds of records in the service. Must be less than 1/2 of the Health Probe’s monitoring interval. Must be one of 30, 60, 150, 300, or 450

4.5.5.4.1. GSLB Examples

The following examples highlight how to use the GSLB class to get/create GSLB’s on the dyn.tm System and how to edit these objects from within a Python script.

4.5.5.4.1.1. Creating a new GSLB Service

The following example shows how to create a new GSLB on the dyn.tm System and how to edit some of the fields using the returned GSLB object.

>>> from dyn.tm.services.gslb import Monitor, GSLBRegionPoolEntry, \
...    GSLBRegion, GSLB
>>> # Create a dyn.tmSession
>>> # Assuming you own the zone 'example.com'
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> pool = GSLBRegionPoolEntry(zone, fqdn, 'global', '8.8.4.4', None,
...                            label='APIv2 GSLB')
>>> region = GSLBRegion(zone, fqdn, 'mycontactnickname', pool=[pool])
>>> monitor = Monitor('HTTP', 5, expected='Example')
>>> gslb = GSLB(zone, fqdn, 'mycontactname', region=[region], monitor=monitor)

4.5.5.4.1.2. Getting an Existing GSLB Service

The following example shows how to get an existing GSLB from the dyn.tm System and how to edit some of the same fields mentioned above.

>>> from dyn.tm.services.gslb import GSLB
>>> # Create a dyn.tmSession
>>> # Once again, assuming you own 'example.com'
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> gslb = GSLB(zone, fqdn)

4.5.5.4.1.3. Replacing a GSLB Monitor

If you’d like to create a brand new Monitor for your GSLB service, rather than update your existing one, the following example shows how simple it is to accomplish this task

>>> from dyn.tm.services.gslb import GSLB, Monitor
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> gslb = GSLB(zone, fqdn)
>>> gslb.monitor.protocol
'HTTP'
>>> expected_text = "This is the text you're looking for."
>>> new_monitor = Monitor('HTTPS', 10, timeout=500, port=5005,
                          expected=expected_text)
>>> gslb.monitor = new_monitor
>>> gslb.monitor.protocol
'HTTPS'