@defer.inlineCallbacks
    def get(self):

        method = self.config.get('method', 'GET')
        url = self.config.get('url', 'http://%s/' % self.hostname)
        match = self.config.get('match', None)
        ua = self.config.get('useragent', 'Tensor HTTP checker')
        timeout = self.config.get('timeout', 60)

        t0 = time.time()

        try:
            body = yield HTTPRequest(timeout).getBody(url, method,
                {'User-Agent': [ua]},
            )
        except Timeout:
            log.msg('[%s] Request timeout' % url)
            t_delta = (time.time() - t0) * 1000
            defer.returnValue(
                self.createEvent('critical', '%s - timeout' % url, t_delta,
                    prefix="latency")
            )
        except Exception, e:
            log.msg('[%s] Request error %s' % (url, e))
            t_delta = (time.time() - t0) * 1000
            defer.returnValue(
                self.createEvent('critical', '%s - %s' % (url, e), t_delta,
                    prefix="latency")
            )

        t_delta = (time.time() - t0) * 1000

        if match:
            if (match in body):
                state = 'ok'
            else:
                state = 'critical'
        else:
            state = 'ok'
        
        defer.returnValue(
            self.createEvent(state, 'Latency to %s' % url, t_delta,
                prefix="latency")
        )
dataset/ETHPy150Open calston/tensor/tensor/sources/network.py/HTTP.get/original