Exemplo n.º 1
0
def LatestTaskInfo(NamespaceID):
    try:
        objNamespace = Namespace.GetNamespace(NamespaceID)
        if None != objNamespace:
            return objNamespace.GetLastActorCalled()

    except Exception as Ex:
        pass
Exemplo n.º 2
0
def SetMinValueOperatorValue(NamespaceID, CollectorID, newValue):
    try:
        objNamespace = Namespace.GetNamespace(NamespaceID)
        if None != objNamespace:
            objCollector = objNamespace.GetCollector(CollectorID)
            if None != objCollector:
                if hasattr(objCollector, "SetMinValueForAll"):
                    objCollector.SetMinValueForAll(newValue)

    except Exception as Ex:
        pass
Exemplo n.º 3
0
def ZeroOutAverageOperatorHistory(NamespaceID, CollectorID):
    try:
        objNamespace = Namespace.GetNamespace(NamespaceID)
        if None != objNamespace:
            objCollector = objNamespace.GetCollector(CollectorID)
            if None != objCollector:
                if hasattr(objCollector, "historyList"):
                    objCollector.historyList = []

    except Exception as Ex:
        pass
Exemplo n.º 4
0
def SetMaxValueOperatorValue(NamespaceID, CollectorID, newValue):
    try:
        objNamespace = Namespace.GetNamespace(NamespaceID)
        if None != objNamespace:
            objCollector = objNamespace.GetCollector(CollectorID)
            if None != objCollector:
                if hasattr(objCollector, "SetMaxValueForAll"):
                    objCollector.SetMaxValueForAll(newValue)
    #pylint: disable=unused-variable
    except Exception as Ex:
        pass
    def AddCollector(self, objCollector, beforeID=None):
        if True == self._NamespaceObject.AddCollector(objCollector, beforeID):
            # Dynamic Collectors should be inserted right AFTER the DynamicCollector collector, otherwise if appended to the end, operators that use data from
            # a dynamic collector will be run using stale data
            if None == beforeID:
                self._CollectorList.append(objCollector)

            else:
                Namespace.InsertAfterInList(self._CollectorList, beforeID,
                                            objCollector)

            return True

        return False
Exemplo n.º 6
0
    def __ReadNamespaces(self):
        Namespaces = []

        if not self.__ReadAliasList(self.m_dom):
            return False
        #go through every Namespace and create an Namespace Class for each, and
        #put all in an array
        for inst in self.m_dom.getElementsByTagName('Namespace'):
            _Which = 'Name'
            try:
                ID = Alias.Alias(
                    inst.getElementsByTagName(_Which)[0].firstChild.nodeValue)

                _Which = 'TargetConnection'
                node = inst.getElementsByTagName(_Which)[0]
                _Which = 'IP'
                TargetIP = Alias.Alias(node.attributes["IP"].nodeValue)
                _Which = 'PORT'
                TargetPort = Alias.Alias(node.attributes["PORT"].nodeValue)

                _Which = 'DefaultFrequency'
                Interval = Alias.Alias(
                    inst.getElementsByTagName(_Which)[0].firstChild.nodeValue)

                try:
                    _Which = 'DefaultPrecision'
                    Precision = Alias.Alias(
                        inst.getElementsByTagName(_Which)
                        [0].firstChild.nodeValue)
                    try:
                        Precision = int(Precision)

                    except Exception as Ex:
                        Log.getLogger().error(str(Ex))
                        self.HandleInvalidXML(_Which)
                        return

                except:
                    Precision = self._DefaultNamespacePrecision  # the default
                    pass

                objNamespace = Namespace.Namespace(ID, TargetIP, TargetPort,
                                                   Interval)
                objNamespace.setDefaultPrecision(Precision)

            except Exception as Ex:
                Log.getLogger().error(str(Ex))
                self.HandleInvalidXML(_Which)
                return

            nodeList = inst.getElementsByTagName("IncomingConnection")
            if None != nodeList and len(nodeList) > 0:
                attributes = nodeList[0].attributes
                if "IP" in attributes:
                    objNamespace.__ListenIP = Alias.Alias(
                        attributes["IP"].nodeValue)

                if "PORT" in attributes:
                    try:
                        objNamespace.__ListenPort = int(
                            Alias.Alias(attributes["PORT"].nodeValue))
                    except Exception as Ex:
                        Log.getLogger().error(str(ex))
                        Log.getLogger().error(
                            "Invalid Port set for Incoming Connection")
                        return None

            if not self.ReadGoodiesFromFile(inst, objNamespace):
                return

            Namespaces.append(objNamespace)

        self.Valid = True
        return Namespaces
Exemplo n.º 7
0
def GetMaxTransmitBufferBeforeRest():
    ThreadCount = Namespace.GetActiveProcessingThreadCount()
    if ThreadCount < 1:
        ThreadCount = 1
    return Configuration._MaxTxBeforeRest / ThreadCount