示例#1
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)
示例#2
0
 def __init__(self, cfg):
     self.cfg = cfg
     self.relay = Relay(self.cfg.get("udp", "relay"),
                        "leela.%s.udp.timeline" % config.hostname())
示例#3
0
 def __init__(self, cfg):
     self.cfg   = cfg
     self.relay = Relay(self.cfg.get("collectd", "relay"), "leela.%s.collectd.timeline" % config.hostname())
示例#4
0
文件: udp.py 项目: deferraz/leela
 def __init__(self, cfg):
     self.cfg   = cfg
     self.relay = Relay(self.cfg.get("udp", "relay"), "leela.%s.udp.timeline" % config.hostname())