Ejemplo n.º 1
0
    def _traffic_director_monitor(self, fqdn):
        if self._traffic_director_monitors is None:
            self._traffic_director_monitors = \
                {m.label: m for m in get_all_dsf_monitors()}

        try:
            return self._traffic_director_monitors[fqdn]
        except KeyError:
            monitor = DSFMonitor(fqdn, protocol='HTTPS', response_count=2,
                                 probe_interval=60, retries=2, port=443,
                                 active='Y', host=fqdn[:-1], timeout=10,
                                 header='User-Agent: Dyn Monitor',
                                 path='/_dns')
            self._traffic_director_monitors[fqdn] = monitor
            return monitor
Ejemplo n.º 2
0
 def _traffic_director_monitor(self, record):
     fqdn = record.fqdn
     label = '{}:{}'.format(fqdn, record._type)
     try:
         try:
             monitor = self.traffic_director_monitors[label]
             self.log.debug('_traffic_director_monitor: existing for %s',
                            label)
         except KeyError:
             # UNTIL 1.0 We don't have one for the new label format, see if
             # we still have one for the old and update it
             monitor = self.traffic_director_monitors[fqdn]
             self.log.info(
                 '_traffic_director_monitor: upgrading label '
                 'to %s', label)
             monitor.label = label
             self.traffic_director_monitors[label] = \
                 self.traffic_director_monitors[fqdn]
             del self.traffic_director_monitors[fqdn]
         if _monitor_doesnt_match(monitor, record.healthcheck_host,
                                  record.healthcheck_path,
                                  record.healthcheck_protocol,
                                  record.healthcheck_port):
             self.log.info(
                 '_traffic_director_monitor: updating monitor '
                 'for %s', label)
             monitor.update(record.healthcheck_host,
                            record.healthcheck_path,
                            record.healthcheck_protocol,
                            record.healthcheck_port)
         return monitor
     except KeyError:
         self.log.info(
             '_traffic_director_monitor: creating monitor '
             'for %s', label)
         monitor = DSFMonitor(label,
                              protocol=record.healthcheck_protocol,
                              response_count=2,
                              probe_interval=60,
                              retries=2,
                              port=record.healthcheck_port,
                              active='Y',
                              host=record.healthcheck_host,
                              timeout=self.MONITOR_TIMEOUT,
                              header=self.MONITOR_HEADER,
                              path=record.healthcheck_path)
         self._traffic_director_monitors[label] = monitor
         return monitor