Esempio n. 1
0
    def fetchOid(self, oid):
        """
        Retrieve a single value from the device using the +oid+ supplied.
        This is necessary here because Zenoss component templates can only use
        SNMP index, but Sentry devices come from multiple vendors with their own
        MIB trees.
        """
        parent = self.device()
        proxy = AgentProxy(parent.id,
                           parent.zSnmpPort,
                           timeout=parent.zSnmpTimeout,
                           community=parent.zSnmpCommunity,
                           snmpVersion=parent.zSnmpVer,
                           tries=2)
        proxy.open()
        log = logging.getLogger('zen.ZenEvent')
        log.info('SENTRY fetch FETCHING OID %s.  Got proxy open already' % oid)

        defered = proxy.get([oid])

        self.finished = False
        defered.addBoth(self.gotResult, proxy, oid)
        defered.addErrback(self.gotFailure)

        # wait until this call is done
        while not self.finished:
            reactor.iterate(TIMEOUT)

        return self.result
def get_snmp_proxy(host, version, community):
    """Return an SNMP proxy given host, version and community."""
    snmp_proxy = AgentProxy(ip=host, community=community, snmpVersion=version)

    snmp_proxy.open()

    return snmp_proxy
def get_snmp_proxy(host, version, community):
    """Return an SNMP proxy given host, version and community."""
    snmp_proxy = AgentProxy(
        ip=host,
        community=community,
        snmpVersion=version)

    snmp_proxy.open()

    return snmp_proxy
def get_snmp_proxy(ds0, config):
    snmpV3Args = getSnmpV3Args(ds0)
    log.debug('snmpV3Args are %s ' % snmpV3Args)
    snmp_proxy = AgentProxy(ip=ds0.manageIp,
                            port=int(ds0.zSnmpPort),
                            timeout=ds0.zSnmpTimeout,
                            snmpVersion=ds0.zSnmpVer,
                            community=ds0.zSnmpCommunity,
                            cmdLineArgs=snmpV3Args,
                            protocol=None,
                            allowCache=False)
    snmp_proxy.open()
    return snmp_proxy
Esempio n. 5
0
    def fetchLoad(self):
        parent = self.device()
        proxy = AgentProxy(parent.id, parent.zSnmpPort, timeout=parent.zSnmpTimeout, community=parent.zSnmpCommunity, snmpVersion=parent.zSnmpVer, tries=2)
        proxy.open()
        d = proxy.get([ self.loadOid ])

        self.finished = False
        d.addBoth(self.gotResult, proxy)
        d.addErrback(self.gotFailure)

        # wait until this call is done
        while not self.finished:
            reactor.iterate(TIMEOUT)

        return self.load
    def fetchOid(self, oid):
        """
        Retrieve a single value from the device using the +oid+ supplied.
        This is necessary here because Zenoss component templates can only use
        SNMP index, but Sentry devices come from multiple vendors with their own
        MIB trees.
        """
        parent = self.device()
        proxy = AgentProxy(parent.id, parent.zSnmpPort, timeout=parent.zSnmpTimeout, community=parent.zSnmpCommunity, snmpVersion=parent.zSnmpVer, tries=2)
        proxy.open()
	log = logging.getLogger('zen.ZenEvent')
	log.info('SENTRY fetch FETCHING OID %s.  Got proxy open already' % oid)

        defered = proxy.get([ oid ])

        self.finished = False
        defered.addBoth(self.gotResult, proxy, oid)
        defered.addErrback(self.gotFailure)

	# wait until this call is done
        while not self.finished:
            reactor.iterate(TIMEOUT)

        return self.result