(
        self, config  # type: InstanceConfig
    )
return results, scalar_oids, error
Perform a snmpwalk on the domain specified by the oids, on the device
        configured in instance.

        Returns a dictionary:
        dict[oid/metric_name][row index] = value
        In case of scalar objects, the row index is just 0
Perform a snmpwalk on the domain specified by the oids, on the device
        configured in instance.
Perform a snmpwalk on the domain specified by the oids on the device configured in instance .
def fetch_results(
        self, config  # type: InstanceConfig
    ):
        # type: (...) -> Tuple[Dict[str, Dict[Tuple[str, ...], Any]], List[OID], Optional[str]]
        """
        Perform a snmpwalk on the domain specified by the oids, on the device
        configured in instance.

        Returns a dictionary:
        dict[oid/metric_name][row index] = value
        In case of scalar objects, the row index is just 0
        """
        results = defaultdict(dict)  # type: DefaultDict[str, Dict[Tuple[str, ...], Any]]
        enforce_constraints = config.enforce_constraints
        fetch_id = self._get_next_fetch_id()

        all_binds, error = self.fetch_oids(
            config,
            config.oid_config.scalar_oids,
            config.oid_config.next_oids,
            enforce_constraints=enforce_constraints,
            fetch_id=fetch_id,
        )
        for oid in config.oid_config.bulk_oids:
            try:
                oid_object_type = oid.as_object_type()
                self.log.debug(
                    '[%s] Running SNMP command getBulk on OID %s',
                    fetch_id,
                    OIDPrinter((oid_object_type,), with_values=False),
                )
                binds = snmp_bulk(
                    config,
                    oid_object_type,
                    self._NON_REPEATERS,
                    self._MAX_REPETITIONS,
                    enforce_constraints,
                    self.ignore_nonincreasing_oid,
                )
                all_binds.extend(binds)
            except (PySnmpError, CheckException) as e:
                message = '[{}] Failed to collect some metrics: {}'.format(fetch_id, e)
                if not error:
                    error = message
                self.warning(message)

        scalar_oids = []
        for result_oid, value in all_binds:
            oid = OID(result_oid)
            scalar_oids.append(oid)
            match = config.resolve_oid(oid)
            results[match.name][match.indexes] = value
        self.log.debug('[%s] Raw results: %s', fetch_id, OIDPrinter(results, with_values=False))
        # Freeze the result
        results.default_factory = None  # type: ignore
        return results, scalar_oids, error
def fetch_results ( self , config # type: InstanceConfig ) : # type: (...) -> Tuple[Dict[str, Dict[Tuple[str, ...], Any]], List[OID], Optional[str]] results = defaultdict ( dict ) # type: DefaultDict[str, Dict[Tuple[str, ...], Any]] enforce_constraints = config . enforce_constraints fetch_id = self . _get_next_fetch_id ( ) all_binds , error = self . fetch_oids ( config , config . oid_config . scalar_oids , config . oid_config . next_oids , enforce_constraints = enforce_constraints , fetch_id = fetch_id , ) for oid in config . oid_config . bulk_oids : try : oid_object_type = oid . as_object_type ( ) self . log . debug ( '[%s] Running SNMP command getBulk on OID %s' , fetch_id , OIDPrinter ( ( oid_object_type , ) , with_values = False ) , ) binds = snmp_bulk ( config , oid_object_type , self . _NON_REPEATERS , self . _MAX_REPETITIONS , enforce_constraints , self . ignore_nonincreasing_oid , ) all_binds . extend ( binds ) except ( PySnmpError , CheckException ) as e : message = '[{}] Failed to collect some metrics: {}' . format ( fetch_id , e ) if not error : error = message self . warning ( message ) scalar_oids = [ ] for result_oid , value in all_binds : oid = OID ( result_oid ) scalar_oids . append ( oid ) match = config . resolve_oid ( oid ) results [ match . name ] [ match . indexes ] = value self . log . debug ( '[%s] Raw results: %s' , fetch_id , OIDPrinter ( results , with_values = False ) ) # Freeze the result results . default_factory = None # type: ignore return results , scalar_oids , error