업타임 체크 나열
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
업타임 체크 구성을 나열하는 방법을 설명합니다.
더 살펴보기
이 코드 샘플이 포함된 자세한 문서는 다음을 참조하세요.
코드 샘플
C#
Monitoring에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Go
Monitoring에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Java
Monitoring에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Node.js
Monitoring에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
PHP
Monitoring에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Python
Monitoring에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
Ruby
Monitoring에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],[],[],[],null,["Demonstrates how to list uptime check configs.\n\nExplore further\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Manage uptime checks](/monitoring/uptime-checks/manage)\n\nCode sample \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 ListUptimeCheckConfigs(string projectId)\n {\n var client = UptimeCheckServiceClient.Create();\n var configs = client.ListUptimeCheckConfigs(new ProjectName(projectId));\n foreach (UptimeCheckConfig config in configs)\n {\n Console.WriteLine(config.Name);\n }\n return 0;\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 // list is an example of listing the uptime checks in projectID.\n func list(w io.Writer, projectID string) 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.ListUptimeCheckConfigsRequest{\n \t\tParent: \"projects/\" + projectID,\n \t}\n \tit := client.ListUptimeCheckConfigs(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(\"ListUptimeCheckConfigs: %w\", err)\n \t\t}\n \t\tfmt.Fprintln(w, config)\n \t}\n \tfmt.Fprintln(w, \"Done listing uptime checks\")\n \treturn nil\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 listUptimeChecks(String projectId) throws IOException {\n ListUptimeCheckConfigsRequest request =\n ListUptimeCheckConfigsRequest.newBuilder().setParent(ProjectName.format(projectId)).build();\n try (UptimeCheckServiceClient client = UptimeCheckServiceClient.create()) {\n ListUptimeCheckConfigsPagedResponse response = client.listUptimeCheckConfigs(request);\n for (UptimeCheckConfig config : response.iterateAll()) {\n System.out.println(config.getDisplayName());\n }\n } catch (Exception e) {\n usage(\"Exception listing uptime checks: \" + e.toString());\n throw e;\n }\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 /**\n * TODO(developer): Uncomment and edit the following lines of code.\n */\n // const projectId = 'YOUR_PROJECT_ID';\n\n const request = {\n parent: client.projectPath(projectId),\n };\n\n // Retrieves an uptime check config\n const [uptimeCheckConfigs] = await client.listUptimeCheckConfigs(request);\n\n uptimeCheckConfigs.forEach(uptimeCheckConfig =\u003e {\n console.log(`ID: ${uptimeCheckConfig.name}`);\n console.log(` Display Name: ${uptimeCheckConfig.displayName}`);\n console.log(' Resource: %j', uptimeCheckConfig.monitoredResource);\n console.log(' Period: %j', uptimeCheckConfig.period);\n console.log(' Timeout: %j', uptimeCheckConfig.timeout);\n console.log(` Check type: ${uptimeCheckConfig.check_request_type}`);\n console.log(\n ' Check: %j',\n uptimeCheckConfig.httpCheck || uptimeCheckConfig.tcpCheck\n );\n console.log(\n ` Content matchers: ${uptimeCheckConfig.contentMatchers\n .map(matcher =\u003e matcher.content)\n .join(', ')}`\n );\n console.log(` Regions: ${uptimeCheckConfig.selectedRegions.join(', ')}`);\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\\ListUptimeCheckConfigsRequest;\n\n /**\n * Example:\n * ```\n * list_uptime_checks($projectId);\n * ```\n */\n function list_uptime_checks(string $projectId): void\n {\n $projectName = 'projects/' . $projectId;\n $uptimeCheckClient = new UptimeCheckServiceClient([\n 'projectId' =\u003e $projectId,\n ]);\n $listUptimeCheckConfigsRequest = (new ListUptimeCheckConfigsRequest())\n -\u003esetParent($projectName);\n\n $pages = $uptimeCheckClient-\u003elistUptimeCheckConfigs($listUptimeCheckConfigsRequest);\n\n foreach ($pages-\u003eiteratePages() as $page) {\n foreach ($page as $uptimeCheck) {\n print($uptimeCheck-\u003egetName() . PHP_EOL);\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_configs(project_id: str) -\u003e pagers.ListUptimeCheckConfigsPager:\n \"\"\"Gets all uptime checks defined in the Google Cloud project\n\n Args:\n project_id: Google Cloud project id\n\n Returns:\n A list of configurations.\n Iterating over this object will yield results and resolve additional pages automatically.\n \"\"\"\n client = monitoring_v3.UptimeCheckServiceClient()\n configs = client.list_uptime_check_configs(request={\"parent\": project_id})\n\n for config in configs:\n pprint.pprint(config)\n return configs\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_uptime_check_configs project_id\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 project_name = client.project_path project: project_id\n configs = client.list_uptime_check_configs parent: project_name\n\n configs.each { |config| puts config.name }\n end\n\nWhat's next\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=monitoring)."]]