monitoring.py/exporter/statsdExporter.py

12 lines
381 B
Python
Raw Normal View History

2019-12-30 15:24:28 +00:00
import socket
import statsd
2019-12-30 15:25:34 +00:00
class StatsdExporter:
2019-12-30 15:24:28 +00:00
def __init__(self):
self.servername = socket.gethostname()
2019-12-30 15:25:10 +00:00
self.c = statsd.StatsClient('grafana2.keks.cloud', 8125)
2019-12-30 15:24:28 +00:00
def gauge(self, name, value):
self.c.gauge("server."+self.servername+"."+name, value)
def incr(self, name, value):
self.c.incr("server."+self.servername+"."+name, value)