4.5.1.1. HealthMonitor

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

A health monitor for an ActiveFailover service

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

Create a HealthMonitor object

Parameters:
  • protocol – The protocol to monitor. Must be either HTTP, HTTPS, PING, SMTP, or TCP
  • interval – How often (in minutes) to run this HealthMonitor. 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.1.2. Active Failover

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

With Active Failover, we monitor your Primary IP. If a failover event is detected, our system auto switches (hot swaps) to your dedicated back-up IP

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

Create a new ActiveFailover object

Parameters:
  • zone – The zone to attach this ActiveFailover service to
  • fqdn – The FQDN where this ActiveFailover service will be attached
  • address – IPv4 Address or FQDN being monitored by this ActiveFailover service
  • failover_mode – Indicates the target failover resource type.
  • failover_data – The IPv4 Address or CNAME data for the failover target
  • auto_recover – Indicates whether this service should restore its original state when the source IPs resume online status
  • notify_events – A comma separated list of what events trigger notifications
  • 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
  • syslog_ident – The ident to use when sending syslog notifications
  • syslog_facility – The syslog facility to use when sending syslog notifications
  • 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
  • monitor – The HealthMonitor for this ActiveFailover service
  • contact_nickname – Name of contact to receive notifications from this ActiveFailover service
  • ttl – Time To Live in seconds of records in the service. Must be less than 1/2 of the Health Probe’s monitoring interval
  • 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 ActiveFailover service

active

Return whether or not this ActiveFailover 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 ActiveFailover Service
address

IPv4 Address or FQDN being monitored by this ActiveFailover service

auto_recover

Indicates whether this service should restore its original state when the source IPs resume online status

contact_nickname

Name of contact to receive notifications from this ActiveFailover service

deactivate()[source]

Deactivate this ActiveFailover service

delete()[source]

Delete this ActiveFailover service from the Dynect System

failover_data

The IPv4 Address or CNAME data for the failover target

failover_mode

Indicates the target failover resource type.

fqdn

The FQDN where this ActiveFailover service will be attached

monitor

The HealthMonitor for this ActiveFailover service

notify_events

A comma separated list of what events trigger notifications

recover()[source]

Recover this ActiveFailover service

recovery_delay
syslog_delivery
syslog_facility

The syslog facility to use when sending syslog notifications

syslog_ident

The ident to use when sending syslog notifications

syslog_port

The port where the remote syslog server listens

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 ActiveFailover.

ttl

Time To Live in seconds of records in the service. Must be less than 1/2 of the Health Probe’s monitoring interval

zone

The zone to attach this ActiveFailover service to

4.5.1.2.1. Active Failover Examples

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

4.5.1.2.1.1. Creating a new Active Failover Service

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

>>> from dyn.tm.services.active_failover import HealthMonitor, ActiveFailover,
>>> # Create a dyn.tmSession
>>> mon = HealthMonitor(protocol='HTTP', interval='1', expected='Example')
>>> # Assuming you own the zone 'example.com'
>>> afo = ActiveFailover('example.com', 'example.com.', '127.0.0.1', 'ip',
...                      '127.0.0.2', mon, 'mycontact')
>>> afo.notify_events = 'ip, nosrv'
>>> afo.notify_events
u'ip, nosrv'

4.5.1.2.1.2. Getting an Existing Active Failover Service

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

>>> from dyn.tm.services.active_failover import HealthMonitor, ActiveFailover,
>>> # Create a dyn.tmSession
>>> # Once again, assuming you own 'example.com'
>>> afo = ActiveFailover('example.com', 'example.com.')
>>> afo.active
u'Y'
>>> afo.deactivate()
>>> afo.active
u'N'