def __init__(self, mcast_addr, listen, prefix): Thread.__init__(self) self.deamon = True self.server = HTTPChaliceServer(listen, prefix) self.receiver = CauldronReceiver(mcast_addr=mcast_addr, handler=self) self.server.start() self.start() self.server.serve_forever()
def __init__(self,mcast_addr,listen,prefix): self.server=JQueryChaliceServer(listen,prefix) self.client=CauldronReceiver(mcast_addr=mcast_addr,handler=self); self.server.start() self.client.start() self.server.serve_forever()
import re from extremon import CauldronReceiver class Extremon2Graphite: def __init__(self): self.timestamp = 0 def handle_shuttle(self, data): removeItems = set() for (label, value) in data: if re.match(".*\.dispatcher\.timestamp$", label): self.timestamp = value removeItems.add((label, value)) if re.match(".*\.timestamp$", label): self.timestamp = value removeItems.add((label, value)) if re.match(".*\.sequence$", label): removeItems.add((label, value)) if re.match(".*\.comment$", label): removeItems.add((label, value)) for item in removeItems: data.remove(item) for (label, value) in data: print("%s %s %s" % (label, value, self.timestamp)) if __name__ == '__main__': source = CauldronReceiver(Extremon2Graphite(), ('224.0.0.1', 1249)) source.receive_forever()
def __init__(self, mcast_addr, prefix): self.server = StdInCauldronServer(prefix, '/home/frank/plugins') self.client = CauldronReceiver(mcast_addr=mcast_addr, handler=self) self.server.start() self.client.receive_forever()
def run(self): self.running = True self.log("running") self.cauldron = CauldronReceiver(self.cauldronAddr, self) while self.running: self.cauldron.receive_shuttle()