Пример #1
0
    def add(self, exporterId, serverIP, serverPort):
        checkInteger('exporterId', exporterId, 0)
        checkIPv4('serverIP', serverIP)
        checkPort('serverPort', serverPort)
        if (exporterId in self.__exporters):
            raise Exception('Exporter(%d) already exists' % (exporterId))
        exporterConfig = copy.deepcopy(self.__configTemplate)
        exporterConfig.update({'serverIP': serverIP, 'serverPort': serverPort})

        session = Session()
        exporter = Exporter(session)
        exporter.configure(exporterConfig)
        exporter.start()
        self.__exporters[exporterId] = exporter