SNMP simple request (list of OID).

        One request per OID list.

        * oid: oid list
        > Return a dict
506505
def get_by_oid(self, *oid):
        
        if self.version == '3':
            errorIndication, errorStatus, errorIndex, varBinds = self.cmdGen.getCmd(
                cmdgen.UsmUserData(self.user, self.auth),
                cmdgen.UdpTransportTarget((self.host, self.port)),
                *oid
            )
        else:
            errorIndication, errorStatus, errorIndex, varBinds = self.cmdGen.getCmd(
                cmdgen.CommunityData(self.community),
                cmdgen.UdpTransportTarget((self.host, self.port)),
                *oid
            )
        return self.__get_result__(errorIndication, errorStatus, errorIndex, varBinds)
34122
def get_snmp_value(sess, helper, oid):
        
        snmp_result = sess.get_oids(oid)[0]
        if snmp_result is None:
            helper.exit(summary="No response from device for oid " + oid, exit_code=unknown, perfdata='')

        else:
            return snmp_result
1320971
def collect_snmp(self, device, host, port, community):
        
        self.log.debug(
            'Collecting raw SNMP statistics from device \'{}\''.format(device))

        dev_config = self.config['devices'][device]
        if 'oids' in dev_config:
            for oid, metricName in dev_config['oids'].items():

                if (device, oid) in self.skip_list:
                    self.log.debug(
                        'Skipping OID \'{}\' ({}) on device \'{}\''.format(
                            oid, metricName, device))
                    continue

                timestamp = time.time()
                value = self._get_value(device, oid, host, port, community)
                if value is None:
                    continue

                self.log.debug(
                    '\'{}\' ({}) on device \'{}\' - value=[{}]'.format(
                        oid, metricName, device, value))

                path = '.'.join([self.config['path_prefix'], device,
                                 self.config['path_suffix'], metricName])
                metric = Metric(path=path, value=value, timestamp=timestamp,
                                precision=self._precision(value),
                                metric_type='GAUGE')
                self.publish_metric(metric)
815212
def list_requests(status=None):
    '''
    
    '''
    if status:
        url = '{0}/request?status={1}'.format(_base_url(), status)
    else:
        url = '{0}/request'.format(_base_url())

    reqs = _paginate(url,
                     "requests",
                     method='GET',
                     decode=True,
                     decode_type='json',
                     raise_error=False,
                     header_dict={
                         'X-DC-DEVKEY': _api_key(),
                         'Content-Type': 'application/json',
                     }
    )

    ret = {'requests': reqs}
    return ret
464188
def get_request(self):
        
        if self.hostname_entry:
            self.entries.append(self.hostname_entry)
        request = {}
        for entry in self.entries:
            sans = sorted(list(set(entry['addresses'])))
            request[entry['cn']] = {'sans': sans}
        if self.json_encode:
            return {'cert_requests': json.dumps(request, sort_keys=True)}
        else:
            return {'cert_requests': request}
154450
def get_stats_snmp(self, bulk=False, snmp_oid=None):
        
        snmp_oid = snmp_oid or {}

        from glances.snmp import GlancesSNMPClient

        # Init the SNMP request
        clientsnmp = GlancesSNMPClient(host=self.args.client,
                                       port=self.args.snmp_port,
                                       version=self.args.snmp_version,
                                       community=self.args.snmp_community)

        # Process the SNMP request
        ret = {}
        if bulk:
            # Bulk request
            snmpresult = clientsnmp.getbulk_by_oid(0, 10, itervalues(*snmp_oid))

            if len(snmp_oid) == 1:
                # Bulk command for only one OID
                # Note: key is the item indexed but the OID result
                for item in snmpresult:
                    if iterkeys(item)[0].startswith(itervalues(snmp_oid)[0]):
                        ret[iterkeys(snmp_oid)[0] + iterkeys(item)
                            [0].split(itervalues(snmp_oid)[0])[1]] = itervalues(item)[0]
            else:
                # Build the internal dict with the SNMP result
                # Note: key is the first item in the snmp_oid
                index = 1
                for item in snmpresult:
                    item_stats = {}
                    item_key = None
                    for key in iterkeys(snmp_oid):
                        oid = snmp_oid[key] + '.' + str(index)
                        if oid in item:
                            if item_key is None:
                                item_key = item[oid]
                            else:
                                item_stats[key] = item[oid]
                    if item_stats:
                        ret[item_key] = item_stats
                    index += 1
        else:
            # Simple get request
            snmpresult = clientsnmp.get_by_oid(itervalues(*snmp_oid))

            # Build the internal dict with the SNMP result
            for key in iterkeys(snmp_oid):
                ret[key] = snmpresult[snmp_oid[key]]

        return ret
521864
def to_dict(self):
        

        rv = {
            'id': self.id,
            'type': self.type,
            'priority': self.priority
        }
        if self.recip_keys:
            rv['routingKeys'] = [canon_ref(k.did, k.id, '#') for k in  self.recip_keys]
        if self.routing_keys:
            rv['routingKeys'] = [canon_ref(k.did, k.id, '#') for k in self.routing_keys]
        rv['serviceEndpoint'] = self.endpoint

        return rv
1344611
def get_next(self, oid):
        
        try:
            results = self.cmd_gen.nextCmd(self._get_auth(),
                                           self._get_transport(),
                                           oid)
        except snmp_error.PySnmpError as e:
            raise SNMPFailure(SNMP_FAILURE_MSG % ("GET_NEXT", e))

        error_indication, error_status, error_index, var_binds = results

        if error_indication:
            # SNMP engine-level error.
            raise SNMPFailure(
                SNMP_FAILURE_MSG % ("GET_NEXT", error_indication))

        if error_status:
            # SNMP PDU error.
            raise SNMPFailure(
                "SNMP operation '%(operation)s' failed: %(error)s at"
                " %(index)s" %
                {'operation': "GET_NEXT", 'error': error_status.prettyPrint(),
                 'index':
                     error_index and var_binds[int(error_index) - 1]
                     or '?'})

        return [val for row in var_binds for name, val in row]
426467
def oid2name(self, oid):
        ""
        if not self._oid_lookup:
            for name, data in self._parameters.items():
                self._oid_lookup[data['OID']] = data['Name']
        return self._oid_lookup[oid]
108934
def list(gandi, resource):
    """"""
    keys = gandi.dnssec.list(resource)
    gandi.pretty_echo(keys)

    return keys
1039188
def resource_list(cls):
        
        items = cls.list({'items_per_page': 500})
        ret = [vm['hostname'] for vm in items]
        ret.extend([str(vm['id']) for vm in items])
        return ret
1188503
public static snmpmanager[] get(nitro_service service) throws Exception{
		snmpmanager obj = new snmpmanager();
		snmpmanager[] response = (snmpmanager[])obj.get_resources(service);
		return response;
	}
63652
def virtual_interface_list(self, name):
        '''
        
        '''
        nt_ks = self.compute_conn
        nets = nt_ks.virtual_interfaces.list(self._server_uuid_from_name(name))
        return [network.__dict__ for network in nets]
471194
def request(self, type, command_list):
        '''
        
        '''
        req = self._build_request(type, command_list)
        if self.nxargs['connect_over_uds']:
            self.connection.request('POST', req['url'], req['payload'], req['headers'])
            response = self.connection.getresponse()
        else:
            response = self.connection(req['url'],
                                       method='POST',
                                       opts=req['opts'],
                                       data=req['payload'],
                                       header_dict=req['headers'],
                                       decode=True,
                                       decode_type='json',
                                       **self.nxargs)

        return self.parse_response(response, command_list)
935697
def list(self, id=None):
        
        args = {'id': id}
        self._job_chk.check(args)
        return self._client.json('job.list', args)
1346908
def read_list(self, request):
        
        pipeline = crud_pipeline_factory.read_list_pipeline(
            configuration=self.configuration)
        return pipeline(request=request)
788268
def resource_list(cls):
        
        items = cls.list({'items_per_page': 500})
        ret = [str(ip['id']) for ip in items]
        ret.extend([ip['ip'] for ip in items])
        return ret