Пример #1
0
    def run_check(self, force=False):
        if not self.should_run_check() and not force:
            return

        check_result = monitoring.check_dns(target=self.target,
                                            expected_address=self.resolved_address,
                                            record_type=self.record_type)

        # Initialize the log instance
        log = CheckLog(check=self)

        if check_result['valid']:
            if check_result['status_ok']:
                log.status = 0
            else:
                log.status = 1
        else:
            log.status = 2

        log.save()
Пример #2
0
 def test_no_register(self):
     res = monitoring.check_dns('josetomastocino.com', 'AAAA', '78.47.140.228')
     self.assertFalse(res['valid'])
Пример #3
0
 def test_valid(self):
     res = monitoring.check_dns('josetomastocino.com', 'A', '78.47.140.228')
     self.assertTrue(res['valid'])
     self.assertTrue(res['status_ok'])
Пример #4
0
 def test_wrong_resolved_address(self):
     res = monitoring.check_dns('josetomastocino.com', 'A', '1.1.1.1')
     self.assertTrue(res['valid'])
     self.assertFalse(res['status_ok'])
Пример #5
0
 def test_wrong_host(self):
     res = monitoring.check_dns('josetomasitotocinote.com', 'A', '1.1.1.1')
     self.assertFalse(res['valid'])
Пример #6
0
 def test_wrong_record_type(self):
     res = monitoring.check_dns('bad', 'BAD', '1.1.1.1')
     self.assertFalse(res['valid'])