예제 #1
0
    def __init__(self,
                 deviceId,
                 taskName,
                 scheduleIntervalSeconds,
                 taskConfig):
        """
        @param deviceId: the Zenoss deviceId to watch
        @type deviceId: string
        @param taskName: the unique identifier for this task
        @type taskName: string
        @param scheduleIntervalSeconds: the interval at which this task will be
               collected
        @type scheduleIntervalSeconds: int
        @param taskConfig: the configuration for this task
        """
        super(SnmpPerformanceCollectionTask, self).__init__(
                 deviceId, taskName,
                 taskConfig.cycleInterval, taskConfig
                )

        # Needed for interface
        self.name = taskName
        self.configId = deviceId
        self.state = TaskStates.STATE_IDLE

        # The taskConfig corresponds to a DeviceProxy
        self._device = taskConfig
        self._devId = self._device.id
        self._manageIp = self._device.snmpConnInfo.manageIp
        self._maxOidsPerRequest = self._device.zMaxOIDPerRequest
        log.debug("SnmpPerformanceCollectionTask.__init__: self._maxOidsPerRequest=%s" % self._maxOidsPerRequest)
        self.interval = self._device.cycleInterval
        self._collectedOids = set()

        self._dataService = zope.component.queryUtility(IDataService)
        self._eventService = zope.component.queryUtility(IEventService)

        self._preferences = zope.component.queryUtility(ICollectorPreferences,
                                                        COLLECTOR_NAME)

        self._snmpProxy = None
        self._snmpConnInfo = self._device.snmpConnInfo
        self._oids = self._device.oids
        self._oidDeque = deque(self._oids.keys())
        self._good_oids = set()
        # oids not returning data
        self._bad_oids = set()
        self._snmpPort = snmpprotocol.port()
        self.triesPerCycle = max(2, self._preferences.options.triesPerCycle)
        self._maxTimeouts = self._preferences.options.maxTimeouts
        self._chosenOid = self._preferences.options.oid

        self._lastErrorMsg = ''
        self._cycleExceededCount = 0
        self._stoppedTaskCount = 0
        self._snmpV3ErrorCount = 0

        # whether or not we got a response during a collection interval
        self._responseReceived = False
예제 #2
0
    def __init__(self,
                 deviceId,
                 taskName,
                 scheduleIntervalSeconds,
                 taskConfig):
        """
        @param deviceId: the Zenoss deviceId to watch
        @type deviceId: string
        @param taskName: the unique identifier for this task
        @type taskName: string
        @param scheduleIntervalSeconds: the interval at which this task will be
               collected
        @type scheduleIntervalSeconds: int
        @param taskConfig: the configuration for this task
        """
        super(SnmpPerformanceCollectionTask, self).__init__(
                 deviceId, taskName,
                 taskConfig.cycleInterval, taskConfig
                )

        # Needed for interface
        self.name = taskName
        self.configId = deviceId
        self.state = TaskStates.STATE_IDLE

        # The taskConfig corresponds to a DeviceProxy
        self._device = taskConfig
        self._devId = self._device.id
        self._manageIp = self._device.snmpConnInfo.manageIp
        self._maxOidsPerRequest = self._device.zMaxOIDPerRequest
        log.debug("SnmpPerformanceCollectionTask.__init__: self._maxOidsPerRequest=%s" % self._maxOidsPerRequest)
        self.interval = self._device.cycleInterval
        self._collectedOids = set()

        self._dataService = zope.component.queryUtility(IDataService)
        self._eventService = zope.component.queryUtility(IEventService)

        self._preferences = zope.component.queryUtility(ICollectorPreferences,
                                                        COLLECTOR_NAME)

        self._snmpProxy = None
        self._snmpConnInfo = self._device.snmpConnInfo
        self._oids = self._device.oids
        self._oidDeque = deque(self._oids.keys())
        self._good_oids = set()
        #oids not returning data
        self._bad_oids = set()
        self._snmpPort = snmpprotocol.port()
        self.triesPerCycle = max(2, self._preferences.options.triesPerCycle)
        self._maxTimeouts = self._preferences.options.maxTimeouts

        self._lastErrorMsg = ''
        self._cycleExceededCount = 0
        self._stoppedTaskCount = 0
        self._snmpV3ErrorCount = 0

        #whether or not we got a response during a collection interval
        self._responseReceived = False
예제 #3
0
 def initSnmpProxy(self):
     if self.proxy is not None: self.proxy.close()
     srcport = snmpprotocol.port()
     self.proxy = self.connInfo.createSession(srcport.protocol)
     self.proxy.open()
예제 #4
0
 def initSnmpProxy(self):
     if self.proxy is not None: self.proxy.close()
     srcport = snmpprotocol.port()
     self.proxy = self.connInfo.createSession(srcport.protocol)
     self.proxy.open()