Ejemplo n.º 1
0
class StdInCauldronDispatcher:
    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 handle_shuttle(self, data):
        if len(data):
            self.server.write(data)
Ejemplo n.º 2
0
class StdInCauldronDispatcher:
	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 handle_shuttle(self,data):
		if len(data):
			self.server.write(data)
Ejemplo n.º 3
0
class HTTPChaliceDispatcher(Thread):
	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 run(self):
		self.receiver.receive_forever()

	def handle_shuttle(self,data):
		self.server.write(data)
Ejemplo n.º 4
0
class HTTPChaliceDispatcher(Thread):
    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 run(self):
        self.receiver.receive_forever()

    def handle_shuttle(self, data):
        self.server.write(data)
Ejemplo n.º 5
0
#

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()
Ejemplo n.º 6
0
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()