fix missing self -.-
parent
637f37a560
commit
d1bb9d9816
|
|
@ -5,7 +5,7 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Target:
|
class Target:
|
||||||
def send_data(date, status, time, url, protocol, station):
|
def send_data(self, date, status, time, url, protocol, station):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ class Influx(Target):
|
||||||
string = string.replace(c, "\\"+c)
|
string = string.replace(c, "\\"+c)
|
||||||
return string
|
return string
|
||||||
|
|
||||||
def send_data(date, status, time, url, protocol, station=00):
|
def send_data(self, date, status, time, url, protocol, station=00):
|
||||||
data = "response_time,url={url},status={status},protocol={protocol},station={station} value={time} {timestamp}".format(
|
data = "response_time,url={url},status={status},protocol={protocol},station={station} value={time} {timestamp}".format(
|
||||||
url=influx_escape(url),
|
url=influx_escape(url),
|
||||||
status=influx_escape(str(status)),
|
status=influx_escape(str(status)),
|
||||||
|
|
@ -29,11 +29,11 @@ class Influx(Target):
|
||||||
protocol=self.escape(protocol),
|
protocol=self.escape(protocol),
|
||||||
station=station
|
station=station
|
||||||
)
|
)
|
||||||
r=requests.post(INFLUX_URL, data=data)
|
r = requests.post(INFLUX_URL, data=data)
|
||||||
log.info(str(r) + " " + str(r.text))
|
log.info(str(r) + " " + str(r.text))
|
||||||
return r.ok
|
return r.ok
|
||||||
|
|
||||||
|
|
||||||
TARGETS = {
|
TARGETS = {
|
||||||
"Influx": Influx,
|
"Influx": Influx,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue