Return one SNMP response list for all status OIDs, and one list for all metric OIDs.
551550
def get_data(self):
        ""
        alarm_oids = [netsnmp.Varbind(status_mib[alarm_id]['oid']) for alarm_id in self.models[self.modem_type]['alarms']]
        metric_oids = [netsnmp.Varbind(metric_mib[metric_id]['oid']) for metric_id in self.models[self.modem_type]['metrics']]
        response = self.snmp_session.get(netsnmp.VarList(*alarm_oids + metric_oids))
        return (
            response[0:len(alarm_oids)],
            response[len(alarm_oids):]
        )
1286197
def get_jids():
    '''
    
    '''
    serv = _get_serv(ret=None)
    jids = _get_list(serv, 'jids')
    loads = serv.get_multi(jids)  # {jid: load, jid: load, ...}
    ret = {}
    for jid, load in six.iteritems(loads):
        ret[jid] = salt.utils.jid.format_jid_instance(jid, salt.utils.json.loads(load))
    return ret
849189
def get_threats_lists(self):
        """"""
        response = self.service.threatLists().list().execute()
        self.set_wait_duration(response.get('minimumWaitDuration'))
        return response['threatLists']
939610
def rpc_get_all_names_cumulative( self, offset, count, **con_info ):
        
        if not check_offset(offset):
            return {'error': 'invalid offset', 'http_status': 400}

        if not check_count(count, 100):
            return {'error': 'invalid count', 'http_status': 400}

        db = get_db_state(self.working_dir)
        all_names = db.get_all_names( offset=offset, count=count, include_expired=True )
        db.close()

        return self.success_response( {'names': all_names} )
535267
def service_list():
    '''
    
    '''
    r = salt.utils.http.query(DETAILS['url']+'service/list', decode_type='json', decode=True)
    return r['dict']
549104
def get_all_response(self, sort_order=None, sort_target='key',
                         keys_only=False):
        """"""
        range_request = self._build_get_range_request(
            key=b'\0',
            range_end=b'\0',
            sort_order=sort_order,
            sort_target=sort_target,
            keys_only=keys_only,
        )

        return self.kvstub.Range(
            range_request,
            self.timeout,
            credentials=self.call_credentials,
            metadata=self.metadata
        )
473156
def _view_metrics(self, queue_type, queue_id):
        """"""
        response = {
            'status': 'failure'
        }
        request_data = {}
        if queue_type:
            request_data['queue_type'] = queue_type
        if queue_id:
            request_data['queue_id'] = queue_id

        try:
            response = self.sq.metrics(**request_data)
        except Exception, e:
            response['message'] = e.message
            return jsonify(**response), 400

        return jsonify(**response)
530089
def _check(self, instance):
        '''
        
        '''

        (
            snmp_engine,
            mib_view_controller,
            ip_address,
            tags,
            metrics,
            timeout,
            retries,
            enforce_constraints,
        ) = self._load_conf(instance)

        tags += ['snmp_device:{}'.format(ip_address)]

        table_oids, raw_oids, mibs_to_load = self.parse_metrics(metrics, enforce_constraints)
        try:
            if table_oids:
                self.log.debug("Querying device %s for %s oids", ip_address, len(table_oids))
                table_results = self.check_table(
                    instance,
                    snmp_engine,
                    mib_view_controller,
                    table_oids,
                    True,
                    timeout,
                    retries,
                    enforce_constraints=enforce_constraints,
                    mibs_to_load=mibs_to_load,
                )
                self.report_table_metrics(metrics, table_results, tags)

            if raw_oids:
                self.log.debug("Querying device %s for %s oids", ip_address, len(raw_oids))
                raw_results = self.check_table(
                    instance,
                    snmp_engine,
                    mib_view_controller,
                    raw_oids,
                    False,
                    timeout,
                    retries,
                    enforce_constraints=False,
                )
                self.report_raw_metrics(metrics, raw_results, tags)
        except Exception as e:
            if "service_check_error" not in instance:
                instance["service_check_error"] = "Fail to collect metrics for {} - {}".format(instance['name'], e)
            self.warning(instance["service_check_error"])
        finally:
            # Report service checks
            if "service_check_error" in instance:
                status = Status.DOWN
                if "service_check_severity" in instance:
                    status = instance["service_check_severity"]
                return [(self.SC_STATUS, status, instance["service_check_error"])]

            return [(self.SC_STATUS, Status.UP, None)]
1218407
def get_snmp_from_host1(self):
        
        response = self.snmp1.get_oids(ps1_oid, ps2_oid, fan1_oid, fan2_oid, bat_oid, temp_oid, activity_oid, logfill_oid)
        self.ps1_value = states[int(response[0])]
        self.ps2_value = states[int(response[1])]
        self.fan1_value = states[int(response[2])]
        self.fan2_value = states[int(response[3])]
        self.bat_value = states[int(response[4])]
        self.temp_value = states[int(response[5])]
        self.activity_value1 = activity[int(response[6])]
        self.logfill_value = str(response[7])
348307
def list_nodes(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called with -f or --function.'
        )

    nodes = list_nodes_full()
    ret = {}
    for instanceId in nodes:
        node = nodes[instanceId]
        ret[node['name']] = {
            'id': node['id'],
            'name': node['name'],
            'public_ips': node['public_ips'],
            'private_ips': node['private_ips'],
            'size': node['size'],
            'state': six.text_type(node['state']),
        }
    return ret
127515
def servers(self):
        """"""
        self.__init()
        items = []
        for k,v in self._json_dict.items():
            if k == "servers":
                for s in v:
                    if 'id' in s:
                        url = "%s/%s" % (self.root, s['id'])
                        items.append(
                            self.Server(url=url,
                                        securityHandler=self._securityHandler,
                                        proxy_url=self._proxy_url,
                                        proxy_port=self._proxy_port))
            del k,v
        return items
69860
def process_states(self, helper, session, check):
        """"""
        snmp_result_status = helper.walk_snmp_values(session, helper,
                                                     DEVICE_STATES_OIDS["oid_" + check],
                                                     check)

        snmp_result_names = helper.walk_snmp_values(session, helper,
                                                    DEVICE_NAMES_OIDS["oid_" + check],
                                                    check)

        for i, _result in enumerate(snmp_result_status):
            if check == "power_unit":
                helper.update_status(
                    helper,
                    normal_check(snmp_result_names[i], snmp_result_status[i], "Power unit"))
            elif check == "drive":
                helper.update_status(
                    helper,
                    self.check_drives(snmp_result_names[i], snmp_result_status[i]))
            elif check == "power_unit_redundancy":
                helper.update_status(
                    helper,
                    self.check_power_unit_redundancy(snmp_result_names[i], snmp_result_status[i]))
            elif check == "chassis_intrusion":
                helper.update_status(
                    helper,
                    normal_check(snmp_result_names[i], snmp_result_status[i],
                                 "Chassis intrusion sensor"))
            elif check == "cooling_unit":
                helper.update_status(
                    helper,
                    normal_check(snmp_result_names[i], snmp_result_status[i], "Cooling unit"))
539758
def rpc_get_all_subdomains( self, offset, count, **conf_info):
        
        if not check_offset(offset):
            return {'error': 'invalid offset', 'http_status': 400}

        if not check_count(count, 100):
            return {'error': 'invalid count', 'http_status': 400}

        all_subdomains = get_all_subdomains(offset = offset,
                                            count = count)

        return self.success_response( {'names': all_subdomains} )
1188503
public static snmpmanager[] get(nitro_service service) throws Exception{
		snmpmanager obj = new snmpmanager();
		snmpmanager[] response = (snmpmanager[])obj.get_resources(service);
		return response;
	}
560782
def list(self, limit=None, offset=None):
        """"""
        return self._manager.list(limit=limit, offset=offset)
893198
def available_metrics(self):
        
        req = self.request(self.mist_client.uri+"/clouds/"+self.cloud.id+"/machines/"+self.id+"/metrics")
        metrics = req.get().json()
        return metrics
652518
def _list(self, uri, obj_class=None, list_all=False):
        
        resp, resp_body = self._retry_get(uri)
        if obj_class is None:
            obj_class = self.resource_class

        data = resp_body[self.plural_response_key]
        ret = [obj_class(self, res, loaded=False)
                for res in data if res]
        self._reset_paging("domain", resp_body)
        if list_all:
            dom_paging = self._paging.get("domain", {})
            while dom_paging.get("next_uri"):
                next_uri = dom_paging.get("next_uri")
                ret.extend(self._list(uri=next_uri, obj_class=obj_class,
                        list_all=False))
        return ret