Example #1
0
    def _check(self, instance):
        addr, username, password, timeout = self._load_conf(instance)
        try:
            self.log.debug("Connecting to %s" % addr)
            h = Http(timeout=timeout, disable_ssl_certificate_validation=True)
            if username is not None and password is not None:
                h.add_credentials(username, password)
            resp, content = h.request(addr, "GET")

        except socket.timeout, e:
            self.log.info("%s is DOWN, error: %s" % (addr, str(e)))
            return Status.DOWN, str(e)
Example #2
0
    def _check(self, instance):
        addr, username, password, timeout = self._load_conf(instance)
        try:
            self.log.debug("Connecting to %s" % addr)
            h = Http(timeout=timeout, disable_ssl_certificate_validation=True)
            if username is not None and password is not None:
                h.add_credentials(username, password)
            resp, content = h.request(addr, "GET")

        except socket.timeout, e:
            self.log.info("%s is DOWN, error: %s" % (addr, str(e)))
            return Status.DOWN, str(e)
Example #3
0
    def check(self, instance):
        url             = instance['url']
        default_timeout = self.init_config.get('default_timeout', 5)
        timeout         = float(instance.get('timeout', default_timeout))

        aggregation_key = md5(url).hexdigest()

        try:
            h = Http(timeout=timeout)
            resp, content = h.request(url, "GET")

        except socket.timeout, e:
            self.timeout_event(url, timeout, aggregation_key)
            return
Example #4
0
    def check(self, instance):
        url = instance['url']
        default_timeout = self.init_config.get('default_timeout', 5)
        timeout = float(instance.get('timeout', default_timeout))

        aggregation_key = md5(url).hexdigest()

        try:
            h = Http(timeout=timeout)
            resp, content = h.request(url, "GET")

        except socket.timeout, e:
            self.timeout_event(url, timeout, aggregation_key)
            return
Example #5
0
    def _check(self, instance):
        addr, username, password, timeout, include_content, headers, response_time = self._load_conf(instance)
        content = ''
        start = time.time()
        try:
            self.log.debug("Connecting to %s" % addr)
            h = Http(timeout=timeout, disable_ssl_certificate_validation=True)
            if username is not None and password is not None:
                h.add_credentials(username, password)
            resp, content = h.request(addr, "GET", headers=headers)

        except socket.timeout, e:
            length = int((time.time() - start) * 1000)
            self.log.info("%s is DOWN, error: %s. Connection failed after %s ms" % (addr, str(e), length))
            return Status.DOWN, "%s. Connection failed after %s ms" % (str(e), length)