{"id":20541033,"url":"https://github.com/netways/check_cloud_gcp","last_synced_at":"2025-04-14T08:39:02.693Z","repository":{"id":37976111,"uuid":"352659222","full_name":"NETWAYS/check_cloud_gcp","owner":"NETWAYS","description":"Monitoring plugin (icinga/Nagios compatible) to check resource status inside the Google Cloud Platform (GCP) and Engine (GCE)","archived":false,"fork":false,"pushed_at":"2025-04-03T07:22:37.000Z","size":485,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-03T08:26:24.121Z","etag":null,"topics":["gcp","icinga","monitoring"],"latest_commit_sha":null,"homepage":"https://www.netways.de/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NETWAYS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-29T13:46:48.000Z","updated_at":"2025-04-03T07:22:38.000Z","dependencies_parsed_at":"2024-02-08T09:23:00.060Z","dependency_job_id":"69c28c6e-ca1f-4000-8e9b-52d98b0d5bc7","html_url":"https://github.com/NETWAYS/check_cloud_gcp","commit_stats":{"total_commits":41,"total_committers":5,"mean_commits":8.2,"dds":"0.31707317073170727","last_synced_commit":"44f2bcdbeb333de14410866a152f3bf1e0ea09ea"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fcheck_cloud_gcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fcheck_cloud_gcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fcheck_cloud_gcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fcheck_cloud_gcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NETWAYS","download_url":"https://codeload.github.com/NETWAYS/check_cloud_gcp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248847977,"owners_count":21171274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gcp","icinga","monitoring"],"created_at":"2024-11-16T01:18:57.042Z","updated_at":"2025-04-14T08:39:02.668Z","avatar_url":"https://github.com/NETWAYS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# check_cloud_gcp\n\nIcinga check plugin to check Google Cloud Platform (GCP) resources. At the moment the check only supports the\nCompute Engine (GCE) context.\n\n## Usage\n\n### Computing - Instances\n\nWhen one of the states is non-ok, or a instance is STOPPED, the check will alert.\n\n#### compute instances\n\nChecks all GCP Instances over all zones or multiple GCP Instances in a defined GCP zone.\n\n```\nUsage:\n  check_cloud_google compute instances [flags]\n\nFlags:\n  -f, --filter string        Filter expression that filters resources e.g. '(cpuPlatform = \"Intel Broadwell\") AND (name != \"instance1\")'\n  -h, --help                 help for instances\n      --ignore-api-warning   Disables warning when querying without a zone filter (please do not do that)\n  -z, --zone string          GCP Zone name, can include wildcards (e.g. \"europe-*\")\n\nGlobal Flags:\n  -j, --json-file string   GCP service account key file\n```\n\n```\n## Zone: europe-west3-c\n\n$ check_cloud_gcp compute instances -z europe-west3-c -j $GOOGLE_APPLICATION_CREDENTIALS\nCRITICAL - 2 Instances found - 1 RUNNING - 1 TERMINATED\n\n[OK] \"instance1\" powerstate=RUNNING size=e2-micro\n[CRITICAL] \"instance2\" powerstate=TERMINATED size=e2-medium\n\n\n## Zone: all Zones\n\n$ check_cloud_gcp compute instances --filter 'name != \"instance-1\"' -j $GOOGLE_APPLICATION_CREDENTIALS\nCRITICAL - 3 Instances found - 2 RUNNING - 1 TERMINATED\n\n## us-central1-a\n\n[OK] \"instance-3\" powerstate=RUNNING size=e2-micro\n\n## europe-west3-c\n\n[CRITICAL] \"instance-2\" powerstate=TERMINATED size=e2-medium\n```\n\nMore information on [filters](https://pkg.go.dev/google.golang.org/api@v0.43.0/compute/v1#ZoneOperationsListCall.Filter)\n\n#### compute instance\n\nChecks a single GCP Instance\n\n```\ncheck_cloud_gcp compute instance -z europe-west3-c -j $GOOGLE_APPLICATION_CREDENTIALS -n instance1\nOK - \"instance1\" powerstate=RUNNING size=e2-micro\n```\n\n## Setting up Access\n\nIn order to work correctly you need the correct permissions and configuration within GCP, to grant the plugin proper\nread-only access to the resources.\n\nThe following step-by-step instructions will help you to setup this configuration.\n\n### Creating a service account\n\nYou should create a new service account within the cloud project, and add the proper permissions to it,\nname it e.g. \"check_cloud_gcp\".\n\n* In the Cloud Console, go to the Service accounts page.\n* Go to the Service accounts page\n* Select a project.\n* Click Create service account.\n* Enter a service account name to display in the Cloud Console e.g. `check_cloud_gcp`\n* Optional: Enter a description of the service account e.g. `monitoring purposes`\n* Choose a IAM role to grant the service account the correct permissions on the project `Basic -\u003e Viewer`\n* When you are done adding roles, click Continue.\n* Optional: In the Service account users role field, add members that can impersonate the service account.\n* Optional: In the Service account admins role field, add members that can manage the service account.\n* Click Done to finish creating the service account.\n\n### Creating a Service account key\n\nThe check itself needs a service account key file which will parse the credentials of the service account:\n\n* In the Cloud Console, go to the Service Accounts page.\n* Select a project.\n* Click the email address of the service account that you want to create a key for.\n* Click the Keys tab.\n* Click the Add key drop-down menu, then select Create new key.\n* Select JSON as the Key type and click Create.\n\n**Important:** The key can be downloaded only after creation. Also restrict the permissions of the credential file\non disk, so only Icinga can read it.\n\nThen either set environment `GOOGLE_APPLICATION_CREDENTIALS` or pass `--json-file` with the file path.\n\nFor more information about authentication see: [Getting started with authentication](https://cloud.google.com/docs/authentication/getting-started)\n\nThe full documentation can be found at [Google Cloud Documentation](https://cloud.google.com/docs/)\n\n## License\n\nCopyright (C) 2021 [NETWAYS GmbH](mailto:info@netways.de)\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetways%2Fcheck_cloud_gcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetways%2Fcheck_cloud_gcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetways%2Fcheck_cloud_gcp/lists"}