{"id":12897,"date":"2022-08-16T10:11:08","date_gmt":"2022-08-16T16:11:08","guid":{"rendered":"https:\/\/www.supportpro.com\/blog\/?p=12897"},"modified":"2026-03-26T04:48:25","modified_gmt":"2026-03-26T10:48:25","slug":"what-is-gcpdiag-google-cloud-platform-project","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/what-is-gcpdiag-google-cloud-platform-project\/","title":{"rendered":"What is gcpdiag? Google Cloud Platform Project"},"content":{"rendered":"\n<p>A command-line diagnostics tool for GCP users is called gcpdiag. It identifies and assists in resolving frequent problems in Google Cloud Platform projects. Based on the Google Cloud Support team&#8217;s troubleshooting expertise, it is used to test applications against a variety of best practices and common errors.<br><br>Contributions are welcome for gcpdiag, an open-source programm! Please be aware that this is a community effort rather than a Google product that is officially supported. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are the Pre-requisites<a href=\"https:\/\/gcpdiag.dev\/docs\/running\/#pre-requisites\">&nbsp;<\/a>for gcpdiag?<\/h2>\n\n\n\n<p>The following are necessary for gcpdiag to function properly:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><br>1. Permissions<\/h3>\n\n\n\n<p>The following roles (both of them) must be granted at the very least to the credentials you use with gcpdiag:<\/p>\n\n\n\n<p>Viewer of the project being inspected Service Usage Consumer on the project being used for billing\/quota enforcement, which can be explicitly configured using the \u2014billing-project option but is often the project being inspected. <\/p>\n\n\n\n<p>The Editor and Owner roles already come with all the necessary permissions, however, if you utilise service account authentication (\u2014auth-key), we advise that you only provide that service account access to the Viewer+Service Usage Consumer role.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Required APIs<\/h3>\n\n\n\n<p>The following APIs must be enabled in order for gcpdiag to properly inspect resources:<gwmw style=\"display:none;\"><gwmw style=\"display:none;\"><\/gwmw><\/gwmw><\/p>\n\n\n\n<ul class=\"wp-block-list has-normal-font-size\">\n<li>cloudresourcemanager.googleapis.com (API for Cloud Resource Manager)<\/li>\n\n\n\n<li>iam.googleapis.com (Identity and Access Management API)<\/li>\n\n\n\n<li>serviceusage.googleapis.com API for Service Usage<\/li>\n<\/ul>\n\n\n\n<p>These APIs can be enabled through Cloud Console or the command line:<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image.png\" data-rel=\"penci-gallery-image-content\" ><img fetchpriority=\"high\" decoding=\"async\" width=\"654\" height=\"193\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image.png\" alt=\"\" class=\"wp-image-12900\" style=\"width:346px;height:102px\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image.png 654w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-300x89.png 300w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-585x173.png 585w\" sizes=\"(max-width: 654px) 100vw, 654px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">gcpdiag Installation<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation.jpg\" data-rel=\"penci-gallery-image-content\" ><img decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation-1024x576.jpg\" alt=\"gcpdiag code\" class=\"wp-image-12908\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation-1024x576.jpg 1024w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation-300x169.jpg 300w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation-768x432.jpg 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation-1536x864.jpg 1536w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation-1170x658.jpg 1170w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation-585x329.jpg 585w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/gcpdiag-installation.jpg 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>A shell wrapper that launches gcpdiag in a Docker container can be used to execute gcpdiag. Any computer with Docker or Podman installed, including Cloud Shell, should be able to use this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl https:\/\/gcpdiag.dev\/gcpdiag.sh &gt;gcpdiag\nchmod +x gcpdiag\n.\/gcpdiag lint --project=MYPROJECT<gwmw style=\"display:none;\"><\/gwmw><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">gcpdiag Usage<\/h2>\n\n\n\n<p>The primary subcommand that gcpdiag currently provides is lint, which is used to perform diagnostics on one or more GCP project.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>usage: gcpdiag lint --project P &#91;OPTIONS]\nRun diagnostics in GCP projects.\noptional arguments:\n-h shows the help window\n\n\u2014- auth -adc - Authenticate, Application Default Credentials (default)\n\n--auth-key FILE -  authenticate using file\n\n--project P - project id of the project to inspect\n \n--hide-ok - hide rules with result ok\n\n--exclude EXCLUDE  -Exclude rule pattern\n--include-extended  - Include extended rules\n-v, --verbose - Increase logs verbosely\n\n-output FORMATTER - Format output as jason or anything\n--logging-fetch-max-entries E - Configure maximum entries\n--within-days D - How far to check logs\n--show-skipped - Show skipped rules\n<gwmw style=\"display:none;\"><\/gwmw><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">gcpdiag <strong>Authentication<\/strong><\/h2>\n\n\n\n<p>Multiple ways for authentication are supported by gcpdiag:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. OAuth user consent flow<\/h3>\n\n\n\n<p>Like gcloud, gcpdiag automatically uses the OAuth user authentication flow. It will print a URL that you must visit in a browser and prompt you to enter the token you are given once you have successfully authenticated there.<\/p>\n\n\n\n<p>You can continue using it for a further hour because the credentials will be cached on disc. The $HOME\/.cache\/gcpdiag directory can be deleted to get rid of cached authentication information.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Application default credentials<\/h3>\n\n\n\n<p>The Cloud SDK&#8217;s Application Default Credentials are usable with gcpdiag. To refresh the cached credentials, you might need to first run gcloud auth login \u2014update-adc. Because ADC credentials are provisioned automatically in that environment, this is the default in Cloud Shell.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Service account key<\/h3>\n\n\n\n<p>The \u2014auth-key parameter also allows you to supply a service account&#8217;s private key.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Test Products, Classes, and IDs<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/google-cloud-platform.jpg\" data-rel=\"penci-gallery-image-content\" ><img decoding=\"async\" width=\"850\" height=\"350\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/google-cloud-platform.jpg\" alt=\"\" class=\"wp-image-12899\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/google-cloud-platform.jpg 850w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/google-cloud-platform-300x124.jpg 300w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/google-cloud-platform-768x316.jpg 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/google-cloud-platform-585x241.jpg 585w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/a><figcaption class=\"wp-element-caption\"><br><gwmw style=\"display:none;\"><\/gwmw><\/figcaption><\/figure>\n\n\n\n<p>Products, classes, and ID are used to classify tests.<\/p>\n\n\n\n<p>The GCP service under test is the final product. GKE or GCE, for instance.<\/p>\n\n\n\n<p>The type of test it is based on the class, and we now have:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-1.png\" data-rel=\"penci-gallery-image-content\" ><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"217\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-1.png\" alt=\"\" class=\"wp-image-12901\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-1.png 789w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-1-300x83.png 300w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-1-768x211.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/08\/image-1-585x161.png 585w\" sizes=\"(max-width: 789px) 100vw, 789px\" \/><\/a><\/figure>\n\n\n\n<p>The ID is currently represented as YYYY NNN, where NNN is a counter and YYYY is the year the test was created. Per product\/class combination, the ID must be distinct.<\/p>\n\n\n\n<p>A short description and a long description are also included for each test. The brief description is a claim about the positive state that is being confirmed to be true (i.e., we test for compliance rather than for errors, i.e., for the absence of a problem).<\/p>\n\n\n\n<p>In a conclusion the above the gcpdiag is a useful tool for google cloud users and supports most of the authentication, methods.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<p>In case of any doubt, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\" title=\"\">contact SupportPro<\/a><\/p>\n\n\n\n<p><gwmw style=\"display:none;\"><gwmw style=\"display:none;\"><\/gwmw><\/gwmw><\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Facing issues? <\/p>\n\n\n\n<p class=\"has-large-font-size\">Our technical support<br>engineers can solve it. <\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n\n\n\n<p><gwmw style=\"display:none;\"><\/gwmw><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A command-line diagnostics tool for GCP users is called gcpdiag. It identifies and assists in resolving frequent problems in Google Cloud Platform projects. Based on the Google Cloud Support team&#8217;s&hellip;<\/p>\n","protected":false},"author":4,"featured_media":12909,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[72],"tags":[41,108],"class_list":["post-12897","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","tag-cloud-computing","tag-google-cloud"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/12897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=12897"}],"version-history":[{"count":3,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/12897\/revisions"}],"predecessor-version":[{"id":16669,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/12897\/revisions\/16669"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/12909"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=12897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=12897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=12897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}