Beispiel #1
0
class UdpService(Service, udp_proto.UDP):

    def __init__(self, cfg):
        self.cfg   = cfg
        self.relay = Relay(self.cfg.get("udp", "relay"), "leela.%s.udp.timeline" % config.hostname())

    def forward_packet(self, packet):
        logger.debug("forward: %d" % len(packet))
        self.relay.relay(packet)

    def startService(self):
        reactor.listenUDP(self.cfg.getint("udp", "port"), self, self.cfg.get("udp", "address"))
Beispiel #2
0
class UdpService(Service, udp_proto.UDP):
    def __init__(self, cfg):
        self.cfg = cfg
        self.relay = Relay(self.cfg.get("udp", "relay"),
                           "leela.%s.udp.timeline" % config.hostname())

    def forward_packet(self, packet):
        logger.debug("forward: %d" % len(packet))
        self.relay.relay(packet)

    def startService(self):
        reactor.listenUDP(self.cfg.getint("udp", "port"), self,
                          self.cfg.get("udp", "address"))
Beispiel #3
0
class CollectdService(Service, collectd_proto.UDP):

    def __init__(self, cfg):
        self.cfg   = cfg
        self.relay = Relay(self.cfg.get("collectd", "relay"), "leela.%s.collectd.timeline" % config.hostname())

    def recv_metrics(self, metrics):
        logger.debug("recv_metrics: %d" % len(metrics))
        try:
            self.relay.relay(metrics)
        except:
            logger.error("cant relay to peer address")

    def startService(self):
        reactor.listenUDP(self.cfg.getint("collectd", "port"), self, self.cfg.get("collectd", "address"))
Beispiel #4
0
    def __init__(self, cfg):
        cfg  = cfg
        bus0 = Relay(cfg.get("http", "multicast"), "leela.%s.http.multicast" % config.hostname())
        bus1 = Relay(cfg.get("http", "timeline"), "leela.%s.http.timeline" % config.hostname())
        sto  = cassandra_proto.CassandraProto(cfg)
        app  = web.Application([
            (r"^/v1/version$"                   , http_proto.Version),
            (r"^/v1/data/past24/(.*)"           , http_proto.Past24         , {"storage": sto, "class_" : data.Data}),
            (r"^/v1/data/pastweek/(.*)"         , http_proto.PastWeek       , {"storage": sto, "class_" : data.Data}),
            (r"^/v1/data/(\d+)/(\d+)/(\d+)/(.*)", http_proto.YearMonthDay   , {"storage": sto, "class_" : data.Data}),
            (r"^/v1/data/(\d+)/(\d+)/(.*)"      , http_proto.YearMonth      , {"storage": sto, "class_" : data.Data}),
            (r"^/v1/data/(.*)"                  , http_proto.RangeDataRdwr  , {"storage": sto, "class_" : data.Data, "relay": bus0}),
            (r"^/v1/past24/(.*)"                , http_proto.Past24         , {"storage": sto, "class_" : event.Event}),
            (r"^/v1/pastweek/(.*)"              , http_proto.PastWeek       , {"storage": sto, "class_" : event.Event}),
            (r"^/v1/(\d+)/(\d+)/(\d+)/(.*)"     , http_proto.YearMonthDay   , {"storage": sto, "class_" : event.Event}),
            (r"^/v1/(\d+)/(\d+)/(.*)"           , http_proto.YearMonth      , {"storage": sto, "class_" : event.Event}),
            (r"^/v1/(.*)"                       , http_proto.RangeMetricRdwr, {"storage": sto, "class_" : event.Event, "relay": bus1}),

            (r".*"                              , resthandler.Always404)
            ])
        self.srv = service.MultiService()
        self.srv.addService(service.IService(internet.TCPServer(cfg.getint("http", "port"), app, interface=cfg.get("http", "address"))))
        self.srv.addService(sto)
Beispiel #5
0
 def __init__(self, cfg):
     self.cfg   = cfg
     self.relay = Relay(self.cfg.get("collectd", "relay"), "leela.%s.collectd.timeline" % config.hostname())
Beispiel #6
0
 def __init__(self, cfg):
     self.cfg = cfg
     self.relay = Relay(self.cfg.get("udp", "relay"),
                        "leela.%s.udp.timeline" % config.hostname())
Beispiel #7
0
 def __init__(self, cfg):
     self.cfg   = cfg
     self.relay = Relay(self.cfg.get("udp", "relay"), "leela.%s.udp.timeline" % config.hostname())