Listar endereços IP do servidor de verificação de tempo de atividade
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Neste documento, mostramos como receber uma lista de endereços IP usados pelos servidores de verificação de tempo de atividade e como identificar o tráfego desses servidores nos seus registros.
Listar endereços IP
Se o serviço em verificação está protegido por um firewall, é possível configurar esse firewall para aceitar tráfego proveniente do conjunto atual de endereços IP utilizado na verificação de tempo de atividade. Para conseguir esses endereços IP, siga estas instruções:
Console
No console Google Cloud , acesse a página Verificações de tempo de atividade:
Se você usar a barra de pesquisa para encontrar essa página, selecione o resultado com o subtítulo
Monitoring.
Na barra de ferramentas do console Google Cloud ,
selecione seu projeto Google Cloud . Para configurações do App Hub, selecione o projeto host do App Hub ou o projeto de gerenciamento da pasta com app ativado.
No menu Verificações de tempo de atividade, clique em get_appFazer o download.
Um arquivo uptime-source-ips.txt é salvo e contém os endereços IP.
// listIPs is an example of listing uptime check IPs.funclistIPs(wio.Writer)error{ctx:=context.Background()client,err:=monitoring.NewUptimeCheckClient(ctx)iferr!=nil{returnfmt.Errorf("NewUptimeCheckClient: %w",err)}deferclient.Close()req:=&monitoringpb.ListUptimeCheckIpsRequest{}it:=client.ListUptimeCheckIps(ctx,req)for{config,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{returnfmt.Errorf("ListUptimeCheckIps: %w",err)}fmt.Fprintln(w,config)}fmt.Fprintln(w,"Done listing uptime check IPs")returnnil}
// Imports the Google Cloud client libraryconstmonitoring=require('@google-cloud/monitoring');// Creates a clientconstclient=newmonitoring.UptimeCheckServiceClient();// List uptime check IPsconst[uptimeCheckIps]=awaitclient.listUptimeCheckIps();uptimeCheckIps.forEach(uptimeCheckIp=>{console.log(uptimeCheckIp.region,uptimeCheckIp.location,uptimeCheckIp.ipAddress);});
deflist_uptime_check_ips()-> pagers.ListUptimeCheckIpsPager:"""Gets all locations and IP addresses used by uptime check servers Returns: A list of locations and IP addresses of uptime check servers. Iterating over this object will yield results and resolve additional pages automatically. """client=monitoring_v3.UptimeCheckServiceClient()ips=client.list_uptime_check_ips(request={})print(tabulate.tabulate([(ip.region,ip.location,ip.ip_address)foripinips],("region","location","ip_address"),))returnips
gem"google-cloud-monitoring"require"google/cloud/monitoring"deflist_ipsclient=Google::Cloud::Monitoring.uptime_check_service# Iterate over all results.client.list_uptime_check_ips({}).eachdo|element|puts"#{element.location}#{element.ip_address}"endend
As verificações de tempo de atividade podem vir de qualquer um dos endereços IP, mas apenas um endereço de cada localização geográfica é usado para cada período. As localizações geográficas são listadas no painel de verificações de tempo de atividade, como mostrado na seção anterior. Também é possível usar serviços gratuitos baseados na Web para identificar as localizações registradas dos endereços IP recebidos por download.
Identificar o tráfego da verificação de tempo de atividade nos registros
É possível identificar solicitações dos servidores de verificação de tempo de atividade de acordo com as informações contidas nos registros de solicitações do serviço:
ip: o campo ip contém um dos endereços usados pelos servidores de verificação de tempo de atividade. Para informações sobre como listar todos os endereços IP, consulte Listar endereços IP.
User-Agent: o valor do cabeçalho User-Agent é sempre o seguinte:
A especificação de um cabeçalho personalizado User-Agent resulta em um erro de validação de formulário e impede que a configuração de verificação seja salva.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-28 UTC."],[],[],null,["This document shows you how to get a list of IP addresses used by uptime-check\nservers, and how you can identify traffic from the uptime-check servers in\nyour logs.\n\nList IP addresses\n\nWhen you're checking a service that is behind a firewall, you can configure your\nservice's firewall to accept traffic from the current set of IP addresses used\nfor uptime checking. To get these IP addresses, use the following instructions: \n\nConsole\n\n1. In the Google Cloud console, go to the **Uptime checks** page:\n\n [Go to **Uptime checks**](https://console.cloud.google.com/monitoring/uptime)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. In the toolbar of the Google Cloud console, select your Google Cloud project. For [App Hub](/app-hub/docs/overview) configurations, select the App Hub host project or the app-enabled folder's management project.\n3. In the **Uptime checks** menu, click *get_app* **Download** . A file `uptime-source-ips.txt` is downloaded and contains the IP addresses.\n\ngcloud\n\nRun the [`gcloud monitoring uptime list-ips`](/sdk/gcloud/reference/monitoring/uptime/list-ips) command: \n\n gcloud monitoring uptime list-ips\n\nThe method returns the following information for each IP address:\n\n- The IP address, not a range, in IPv4 or IPv6 format.\n- The region: `USA`, `EUROPE`, `SOUTH_AMERICA`, or `ASIA_PACIFIC`.\n- The location within the region.\n\nAPI\n\nCall the\n[`uptimeCheckIps.list`](/monitoring/api/ref_v3/rest/v3/uptimeCheckIps/list)\nmethod of the Monitoring API.\n\nThe method returns the following information for each IP address:\n\n- The region: `USA`, `EUROPE`, `SOUTH_AMERICA`, or `ASIA_PACIFIC`.\n- A more specific location within the region.\n- The IP address, not a range, in IPv4 or IPv6 format.\n\nC#\n\n\nTo authenticate to Monitoring, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n public static object ListUptimeCheckIps()\n {\n var client = UptimeCheckServiceClient.Create();\n var ips = client.ListUptimeCheckIps(new ListUptimeCheckIpsRequest());\n foreach (UptimeCheckIp ip in ips)\n {\n Console.WriteLine(\"{0,20} {1}\", ip.IpAddress, ip.Location);\n }\n return 0;\n }\n\nJava\n\n\nTo authenticate to Monitoring, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n private static void listUptimeCheckIps() throws IOException {\n try (UptimeCheckServiceClient client = UptimeCheckServiceClient.create()) {\n ListUptimeCheckIpsPagedResponse response =\n client.listUptimeCheckIps(ListUptimeCheckIpsRequest.newBuilder().build());\n for (UptimeCheckIp config : response.iterateAll()) {\n System.out.println(config.getRegion() + \" - \" + config.getIpAddress());\n }\n } catch (Exception e) {\n usage(\"Exception listing uptime IPs: \" + e.toString());\n throw e;\n }\n }\n\nGo\n\n\nTo authenticate to Monitoring, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n // listIPs is an example of listing uptime check IPs.\n func listIPs(w io.Writer) error {\n \tctx := context.Background()\n \tclient, err := monitoring.NewUptimeCheckClient(ctx)\n \tif err != nil {\n \t\treturn fmt.Errorf(\"NewUptimeCheckClient: %w\", err)\n \t}\n \tdefer client.Close()\n \treq := &monitoringpb.ListUptimeCheckIpsRequest{}\n \tit := client.ListUptimeCheckIps(ctx, req)\n \tfor {\n \t\tconfig, err := it.Next()\n \t\tif err == iterator.Done {\n \t\t\tbreak\n \t\t}\n \t\tif err != nil {\n \t\t\treturn fmt.Errorf(\"ListUptimeCheckIps: %w\", err)\n \t\t}\n \t\tfmt.Fprintln(w, config)\n \t}\n \tfmt.Fprintln(w, \"Done listing uptime check IPs\")\n \treturn nil\n }\n\nNode.js\n\n\nTo authenticate to Monitoring, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n // Imports the Google Cloud client library\n const monitoring = require('https://cloud.google.com/nodejs/docs/reference/monitoring/latest/overview.html');\n\n // Creates a client\n const client = new monitoring.https://cloud.google.com/nodejs/docs/reference/monitoring/latest/overview.html();\n\n // List uptime check IPs\n const [uptimeCheckIps] = await client.listUptimeCheckIps();\n uptimeCheckIps.forEach(uptimeCheckIp =\u003e {\n console.log(\n uptimeCheckIp.region,\n uptimeCheckIp.location,\n uptimeCheckIp.ipAddress\n );\n });\n\nPHP\n\n\nTo authenticate to Monitoring, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n use Google\\Cloud\\Monitoring\\V3\\Client\\UptimeCheckServiceClient;\n use Google\\Cloud\\Monitoring\\V3\\ListUptimeCheckIpsRequest;\n\n /**\n * Example:\n * ```\n * list_uptime_check_ips($projectId);\n * ```\n */\n function list_uptime_check_ips(string $projectId): void\n {\n $uptimeCheckClient = new UptimeCheckServiceClient([\n 'projectId' =\u003e $projectId,\n ]);\n $listUptimeCheckIpsRequest = new ListUptimeCheckIpsRequest();\n\n $pages = $uptimeCheckClient-\u003elistUptimeCheckIps($listUptimeCheckIpsRequest);\n\n foreach ($pages-\u003eiteratePages() as $page) {\n $ips = $page-\u003egetResponseObject()-\u003egetUptimeCheckIps();\n foreach ($ips as $ip) {\n printf(\n 'ip address: %s, region: %s, location: %s' . PHP_EOL,\n $ip-\u003egetIpAddress(),\n $ip-\u003egetRegion(),\n $ip-\u003egetLocation()\n );\n }\n }\n }\n\nPython\n\n\nTo authenticate to Monitoring, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n def list_uptime_check_ips() -\u003e pagers.ListUptimeCheckIpsPager:\n \"\"\"Gets all locations and IP addresses used by uptime check servers\n\n Returns:\n A list of locations and IP addresses of uptime check servers.\n Iterating over this object will yield results and resolve additional pages automatically.\n \"\"\"\n client = monitoring_v3.UptimeCheckServiceClient()\n ips = client.list_uptime_check_ips(request={})\n print(\n tabulate.tabulate(\n [(ip.region, ip.location, ip.ip_address) for ip in ips],\n (\"region\", \"location\", \"ip_address\"),\n )\n )\n return ips\n\nRuby\n\n\nTo authenticate to Monitoring, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n gem \"google-cloud-monitoring\"\n require \"google/cloud/monitoring\"\n\n def list_ips\n client = Google::Cloud::https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-dashboard-v1/latest/Google-Cloud-Monitoring.html.https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring/latest/Google-Cloud-Monitoring.html\n\n # Iterate over all results.\n client.list_uptime_check_ips({}).each do |element|\n puts \"#{element.location} #{element.https://cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-UptimeCheckIp.html}\"\n end\n end\n\n\u003cbr /\u003e\n\nUptime checks can come from any of the IP addresses, but only one address from\neach geographic location is used for each time interval. The geographic\nlocations are listed in the uptime checks dashboard, as shown in the previous\nsection. You can also use free, web-based services to identify the registered\nlocations of the IP addresses you downloaded.\n\nIdentify uptime-check traffic in logs\n\nYou can identify requests from the uptime-check servers by the following\ninformation in your service's [request logs](/logging/docs/view/logs-explorer-interface):\n\n- **ip** : The `ip` field contains one of the addresses used by the uptime-check servers. For information about how to list all IP addresses, see [List IP addresses](#get-ips).\n- **User-Agent** : The `User-Agent` header value is always the following:\n\n GoogleStackdriverMonitoring-UptimeChecks(https://cloud.google.com/monitoring)\n\n Specifying a `User-Agent` custom header results in a form validation error\n and prevents the check configuration from being saved.\n\nWhat's next\n\n- [Manage uptime checks](/monitoring/uptime-checks/manage)\n- [Create alerting policies for uptime checks](/monitoring/uptime-checks/uptime-alerting-policies)\n- [Chart uptime-check metrics](/monitoring/charts/uptime-charts)"]]