[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-28。"],[],[],null,["# Use the Recommender CLI and API\n\nNetwork Analyzer uses [Recommender](/recommender/docs)\ncommands. Recommender is a Google Cloud service that\nprovides usage recommendations for Google Cloud products and services.\nFor a complete list of Recommender insight types, see the\nRecommender [insight types](/recommender/docs/insights/insight-types).\n\nRequest insights\n----------------\n\n### gcloud\n\nTo list insights for a Google Cloud project, run the following command: \n\n```\ngcloud recommender insights list \\\n --project=PROJECT_ID \\\n --location=LOCATION \\\n --insight-type=INSIGHT_TYPE \\\n --filter=EXPRESSION \\\n --limit=LIMIT \\\n --page-size=PAGE_SIZE \\\n --sort-by=SORT_BY \\\n --format=json\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID that you want to list insights for. You can also list all insights for a folder, organization, or a billing account.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location to list insights for, such as `global`, `europe`, `asia-east1`, or `us-central1-a`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: the Network Analyzer insight\n type to request, such as `google.networkanalyzer.vpcnetwork.connectivityInsight`.\n\n For a complete list of insight types, see [Insight groups and types](#insight-types).\n\nThe following fields are optional:\n\n- \u003cvar translate=\"no\"\u003eEXPRESSION\u003c/var\u003e: apply this Boolean filter to each\n resource that you want to list.\n\n If the expression evaluates as `True`,\n that item is listed. For more details and examples of filter expressions,\n run `$ gcloud topic filters` or see the\n [`gcloud topic filters` documentation](/sdk/gcloud/reference/topic/filters).\n- \u003cvar translate=\"no\"\u003eLIMIT\u003c/var\u003e: the maximum number of resources to list;\n the default number of resources listed is unlimited.\n\n- \u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e: the maximum number of resources to\n list per page.\n\n The default page size is determined by the service;\n otherwise, there is no paging. Paging might be applied before or after\n \u003cvar translate=\"no\"\u003eFILTER\u003c/var\u003e and \u003cvar translate=\"no\"\u003eLIMIT\u003c/var\u003e.\n- \u003cvar translate=\"no\"\u003eSORT_BY\u003c/var\u003e: a list of comma-separated\n field key names to sort by for a resource.\n\n The default order is ascending.\n To specify a descending order, prefix a field with `~` (a tilde).\n\n### API\n\nTo get insights for a Google Cloud project, make a `GET` request to the\n[`projects.locations.insightTypes.insights` method](/recommender/docs/reference/rest/v1/projects.locations.insightTypes.insights/get): \n\n```\nhttps://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/INSIGHT_TYPE/insights\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location to list insights for, such as `global`, `europe`, `asia-east1`, or `us-central1-a`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: the Network Analyzer insight\n type to list, such as google.networkanalyzer.vpcnetwork.connectivityInsight.\n\n For a complete list of insight types, see [Insight groups and types](#insight-types).\n\nThe following example shows a sample response for this command: \n\n```\n{\n \"name\": \"projects/{project_number}/locations/{location}/insightTypes/google.networkanalyzer.hybridconnectivity.dynamicRouteInsight/insights/{insight_id}\",\n \"description\": \"Dynamic route is fully shadowed by a peering subnet route\",\n \"content\": {\n \"networkUri\": \"//compute.googleapis.com/projects/{project_id}/global/networks/{network_name}\",\n \"region\": \"{location}\",\n \"ipRange\": \"{ip_range}\",\n \"priority\": 100,\n \"nextHopUri\": \"//compute.googleapis.com/projects/{project_id}/regions/{location}/vpnTunnels/{tunnel_name}\",\n \"cloudRouterUri\": \"//compute.googleapis.com/projects/{project_id}/regions/{location}/routers/{router_name}\",\n \"shadowingRouteUris\": [\n \"//compute.googleapis.com/projects/{project_id}/global/routes/{route_name}\"\n ],\n \"shadowingRouteType\": \"PEERING_SUBNET\"\n },\n \"lastRefreshTime\": \"2022-09-15T21:10:57.187942979Z\",\n \"observationPeriod\": \"611870.625920374s\",\n \"stateInfo\": {\n \"state\": \"ACTIVE\"\n },\n \"category\": \"PERFORMANCE\",\n \"targetResources\": [\n \"//compute.googleapis.com/projects/{project_id}/regions/{location}/vpnTunnels/{tunnel_name}\"\n ],\n \"insightSubtype\": \"DYNAMIC_ROUTE_FULLY_SHADOWED\",\n \"severity\": \"MEDIUM\"\n}\n```\n\nDescribe insight details\n------------------------\n\n### gcloud\n\nTo list details of a particular insight, run the following command: \n\n```\ngcloud recommender insights describe INSIGHT_ID \\\n --project=PROJECT_ID \\\n --location=LOCATION \\\n --insight-type=INSIGHT_TYPE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSIGHT_ID\u003c/var\u003e: the ID of the insight to describe.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project containing the insight.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location to list insights for.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: the Network Analyzer insight\n type of the insight, such as\n `google.networkanalyzer.vpcnetwork.connectivityInsight`.\n\n For a complete list of insight types, see [Insight groups and types](#insight-types).\n\n### API\n\nTo get details for an insight, make a `GET` request to the\n[`projects.locations.insightTypes.insights` method](/recommender/docs/reference/rest/v1/projects.locations.insightTypes.insights/get): \n\n```\nhttps://recommender.googleapis.com/v1/projects/PROJECT/locations/LOCATION/insightTypes/INSIGHT_TYPE/insights/INSIGHT_ID\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location of the insight.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: the Network Analyzer insight\n type of the insight, such as\n `google.networkanalyzer.vpcnetwork.connectivityInsight`.\n\n For a complete list of insight types, see [Insight groups and types](#insight-types).\n- \u003cvar translate=\"no\"\u003eINSIGHT_ID\u003c/var\u003e: the insight ID for the insight.\n\nInsight groups and types\n------------------------\n\nFor more information about Network Analyzer insights, see\n[Insight groups and types](/network-intelligence-center/docs/network-analyzer/insight-groups-types)."]]