4.5.7.1. Monitor¶
-
class
dyn.tm.services.rttm.
Monitor
(protocol, interval, retries=None, timeout=None, port=None, path=None, host=None, header=None, expected=None)[source]¶ A
Monitor
for RTTM Service. May be used as a HealthMonitor-
__init__
(protocol, interval, retries=None, timeout=None, port=None, path=None, host=None, header=None, expected=None)[source]¶ Create a
Monitor
objectParameters: - 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
-
4.5.7.2. RegionPoolEntry¶
-
class
dyn.tm.services.rttm.
RegionPoolEntry
(address, label, weight, serve_mode, **kwargs)[source]¶ Creates a new RTTM service region pool entry in the zone/node indicated
-
__init__
(address, label, weight, serve_mode, **kwargs)[source]¶ Create a
RegionPoolEntry
objectParameters: - address – The IPv4 address or FQDN of this Node IP
- label – A descriptive string identifying this IP
- weight – A number from 1-15 describing how often this record should be served. The higher the number, the more often the address is served
- serve_mode – Sets the behavior of this particular record. Must be one of ‘always’, ‘obey’, ‘remove’, or ‘no’
-
address
¶ The IPv4 address or FQDN of this Node IP
-
fqdn
¶ FQDN for this
RegionPoolEntry
, this is stored locally for REST command completion
-
label
¶ A descriptive string identifying this IP
-
logs
¶
-
region_code
¶ region_code for this
RegionPoolEntry
, this is stored locally for REST command completion
-
serve_mode
¶ Sets the behavior of this particular record
-
task
¶ Task
for most recent system action on thisRegionPoolEntry
.
-
weight
¶ A number from 1-15 describing how often this record should be served. The higher the number, the more often the address is served
-
zone
¶ Zone for this
RegionPoolEntry
, this is stored locally for REST command completion
-
4.5.7.3. RTTMRegion¶
-
class
dyn.tm.services.rttm.
RTTMRegion
(zone, fqdn, region_code, *args, **kwargs)[source]¶ docstring for RTTMRegion
-
__init__
(zone, fqdn, region_code, *args, **kwargs)[source]¶ Create a
RTTMRegion
objectParameters: - region_code – Name of the region
- pool – (*arg) The IP Pool list for this region
- autopopulate – If set to Y, this region will automatically be filled in from the global pool, and any other options passed in for this region will be ignored
- ep – Eligibility Pool - How many records will make it into the eligibility pool. The addresses that get chosen will be those that respond the fastest
- apmc – The minimum amount of IPs that must be in the up state, otherwise the region will be in failover
- epmc – The minimum amount of IPs that must be populated in the EP, otherwise the region will be in failover
- serve_count – How many records will be returned in each DNS response
- failover_mode – How the region should failover. Must be one of ‘ip’, ‘cname’, ‘region’, or ‘global’
- failover_data – Dependent upon failover_mode. Must be one of ip’, ‘cname’, ‘region’, or ‘global’
-
apmc
¶ The minimum amount of IPs that must be in the up state, otherwise the region will be in failover.
-
autopopulate
¶ If set to Y, this region will automatically be filled in from the global pool, and any other options passed in for this region will be ignored. Must be either ‘Y’ or ‘N’.
-
ep
¶ Eligibility Pool - How many records will make it into the eligibility pool. The addresses that get chosen will be those that respond the fastest
-
epmc
¶ The minimum amount of IPs that must be populated in the EP, otherwise the region will be in failover
-
failover_data
¶ Dependent upon failover_mode. Must be one of ip’, ‘cname’, ‘region’, or ‘global’
-
failover_mode
¶ How the region should failover. Must be one of ‘ip’, ‘cname’, ‘region’, or ‘global’
-
pool
¶ The IP Pool list for this
RTTMRegion
-
serve_count
¶ How many records will be returned in each DNS response
-
status
¶ The current state of the region.
-
task
¶ Task
for most recent system action on thisActiveFailover
.
-
4.5.7.4. Real Time Traffic Manager¶
-
class
dyn.tm.services.rttm.
RTTM
(zone, fqdn, *args, **kwargs)[source]¶ -
__init__
(zone, fqdn, *args, **kwargs)[source]¶ Create a
RTTM
objectParameters: - 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 one of ‘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 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
RTTMRegion
‘s - monitor – The
Monitor
for this service - performance_monitor – The performance monitor for the service
- contact_nickname – Name of contact to receive notifications
- syslog_probe_fmt – see below for format:
- syslog_status_fmt – see below for format:
- syslog_rttm_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
-
active
¶ Returns whether or not this
RTTM
Service is currently 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 thisReverseDNS
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 one of ‘Y’ or ‘N’
-
contact_nickname
¶ The name of contact to receive notifications from this service
-
get_log_report
(start_ts, end_ts=None)[source]¶ Generates a report with information about changes to an existing RTTM service
Parameters: - start_ts – datetime.datetime instance identifying point in time for the start of the log report
- end_ts – datetime.datetime instance identifying point in time for the end of the log report. Defaults to datetime.datetime.now()
Returns: dictionary containing log report data
-
get_rrset_report
(ts)[source]¶ Generates a report of regional response sets for this RTTM service at a given point in time
Parameters: ts – UNIX timestamp identifying point in time for the log report Returns: dictionary containing rrset report data
-
monitor
¶ The
Monitor
for this service
-
notify_events
¶ A list of events which trigger notifications. Valid values are: ‘ip’, ‘svc’, and ‘nosrv’
-
performance_monitor
¶ The Performance
Monitor
for this service
-
recover
(recoverip=None, address=None)[source]¶ Recovers the RTTM service or a specific node IP within the service
-
recovery_delay
¶
-
region
¶ A list of
RTTMRegion
‘s
-
status
¶ Status
-
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_rttm_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 thisActiveFailover
.
-
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.7.4.1. Real Time Traffic Manager Examples¶
The following examples highlight how to use the RTTM
class to
get/create RTTM
‘s on the dyn.tm System and how to edit these
objects from within a Python script.
4.5.7.4.1.1. Creating a new Real Time Traffic Manager Service¶
The following example shows how to create a new RTTM
on the
dyn.tm System and how to edit some of the fields using the returned
RTTM
object.
>>> from dyn.tm.services.rttm import Monitor, RegionPoolEntry, RTTMRegion, \
... RTTM
>>> # Create a dyn.tmSession
>>> # Assuming you own the zone 'example.com'
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> entry = RegionPoolEntry('1.1.1.1', 'RPE Label', 5, 'always')
>>> region = RTTMRegion(zone, fqdn, 'global', [self.entry])
>>> monitor = Monitor('HTTP', 5, expected='Example')
>>> performance_monitor = Monitor('HTTP', 20)
>>> rttm = RTTM(zone, fqdn, 'mycontactname', region=[region],
... monitor=monitor, performance_monitor=performance_monitor)
4.5.7.4.1.2. Getting an Existing Real Time Traffic Manager Service¶
The following example shows how to get an existing RTTM
from
the dyn.tm System and how to edit some of the same fields mentioned above.
>>> from dyn.tm.services.rttm import RTTM
>>> # Create a dyn.tmSession
>>> # Once again, assuming you own 'example.com'
>>> zone = 'example.com'
>>> fqdn = zone + '.'
>>> rttm = RTTM(zone, fqdn)
>>> rttm.notify_events
u'ip'
>>> rttm.notify_events = 'ip, nosrv'
>>> rttm.notify_events
u'ip, nosrv'