1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Rapid recheck for NS1 monitors

This commit is contained in:
Viranch Mehta
2021-12-03 15:25:38 -08:00
parent ec1be7b6f5
commit 85eeec988c
3 changed files with 13 additions and 2 deletions

View File

@@ -207,6 +207,7 @@ Sonar check regions (sonar_regions) possible values:
| frequency | Frequency (in seconds) of health-check | 60 |
| connect_timeout | Timeout (in seconds) before we give up trying to connect | 2 |
| response_timeout | Timeout (in seconds) after connecting to wait for output | 10 |
| rapid_recheck | Enable or disable a second, automatic verification test before changing the status of a host. Enabling this option can help prevent false positives. | False |
```yaml
@@ -218,4 +219,5 @@ Sonar check regions (sonar_regions) possible values:
frequency: 60
connect_timeout: 2
response_timeout: 10
rapid_recheck: True
```

View File

@@ -1068,6 +1068,11 @@ class Ns1Provider(BaseProvider):
.get('healthcheck', {}) \
.get('frequency', 60)
def _healthcheck_rapid_recheck(self, record):
return record._octodns.get('ns1', {}) \
.get('healthcheck', {}) \
.get('rapid_recheck', False)
def _healthcheck_connect_timeout(self, record):
return record._octodns.get('ns1', {}) \
.get('healthcheck', {}) \
@@ -1101,7 +1106,6 @@ class Ns1Provider(BaseProvider):
self._healthcheck_response_timeout(record) * 1000,
'ssl': record.healthcheck_protocol == 'HTTPS',
},
'frequency': self._healthcheck_frequency(record),
'job_type': 'tcp',
'name': f'{host} - {_type} - {value}',
'notes': self._encode_notes({
@@ -1109,7 +1113,8 @@ class Ns1Provider(BaseProvider):
'type': _type,
}),
'policy': self._healthcheck_policy(record),
'rapid_recheck': False,
'frequency': self._healthcheck_frequency(record),
'rapid_recheck': self._healthcheck_rapid_recheck(record),
'region_scope': 'fixed',
'regions': self.monitor_regions,
}

View File

@@ -933,6 +933,10 @@ class TestNs1ProviderDynamic(TestCase):
monitor = provider._monitor_gen(record, value)
self.assertEquals(300, monitor['frequency'])
record._octodns['ns1']['healthcheck']['rapid_recheck'] = True
monitor = provider._monitor_gen(record, value)
self.assertTrue(monitor['rapid_recheck'])
record._octodns['ns1']['healthcheck']['connect_timeout'] = 1
monitor = provider._monitor_gen(record, value)
self.assertEquals(1000, monitor['config']['connect_timeout'])