Google Cloud監視のサービスアカウント作成方法
        
サービスアカウントを作成し、プロジェクトの自動ディスカバリーを有効にすることで、Site24x7でGoogle Cloud Platform(GCP)を監視できます。
次の手順で関連するスコープでIAMロールを割り当てることで、すべてのプロジェクトを監視します。
GCP組織監視のためのサービスアカウント作成方法
Google Cloudサービスアカウントの作成
- Google Cloudコンソールに移動します。
 
- [IAM]→[管理]→[サービスアカウント]に移動します。
 
- [サービスアカウントの作成]をクリックします。
 
- サービスアカウント名を入力し、[作成と続行]をクリックします。
 
- 次のロールをサービスアカウントに追加します。
- Monitoring Viewer
 
- Compute Viewer
 
- Cloud Asset Viewer
 
- Browser
 
- Viewer
 
 
- [続行]をクリック後、[完了]をクリックし、サービスアカウントの作成を完了します。
ここでのアカウントメールアドレスが後の手順で必要になります。 
プロジェクト自動ディスカバリーのための他スコープへのロール割り当て
希望のスコープで次の権限が存在ことを確認します。
- プロジェクトIAM管理者(以上)
 
- フォルダー管理者
 
- 組織管理者
 
- Google Cloudコンソールで、[IAM]ページに移動します。
 
- プロジェクト、フォルダー、組織のいずれかを選択します。
 
- リソースでのロールを保持していない管理者にロールを付与するには、[アクセス付与]をクリックし、先ほど作成したサービスアカウントのメールアドレスを入力します。
 
- 次のロールを割り当てます。
- Compute Viewer
 
- Monitoring Viewer
 
- Cloud Asset Viewer
 
- Browser
 
- Viewer
 
 
- [保存]をクリックします。
 
JSONキーを作成するには、次の手順を行ってください。
- Google Cloudサービスアカウントに移動します。
 
- [IAM]→[管理]→[サービスアカウント]に移動します。
 
- 先の手順で作成したサービスアカウントを選択します。
 
- [キー]→[キーの追加]→[JSON]を選択します。
 
- Site24x7のGCP監視追加ページでJSONキーファイルをアップロードします。
 
プロジェクトに対して個別にこれらロールを割り当てられます。また組織またはフォルダーレベルでロールを割り当てることで、複数プロジェクトを監視できます。
この方法でロールを割り当てると、Site24x7が指定したスコープの全プロジェクトを自動でディスカバリーします。また、今後グループに追加されたプロジェクトもディスカバリー対象となります。
GCPプロジェクト監視のためのサービスアカウント作成方法
- Google Cloudサービスアカウントを作成します。
- Google Cloudコンソールに移動します。
 
- [IAM]→[管理]→[サービスアカウント]に移動します。
 
- [サービスアカウントの作成]をクリックします。
 
- サービスアカウントの名前を入力した後、[作成と続行]をクリックします。
 
- サービスアカウントに次のロールを追加します。
- Monitoring Viewer
 
- Compute Viewer
 
- Cloud Asset Viewer
 
- Viewer
 
 
 
- [続行]をクリックした後、[完了]をクリックしてサービスアカウントを作成します。
 
- JSONキーを作成します。
- Google Cloudサービスアカウントに移動します。
 
- [IAM]→[管理]→[サービスアカウント]に移動します。
 
- 先の手順で作成したサービスアカウントを選択します。
 
- [キー]→[キーの追加]→[JSON]を選択します。
 
- Site24x7のGCP監視追加ページでキーをアップロードします。
 
 
監視に必要な条件:各プロジェクトレベルで次のAPIを有効にします。
簡単な設定として、各プロジェクトレベルで必要なAPIを有効にするのに、次のTerraformサンプルスクリプトを使用できます。
Main.tf
provider "google" {
 project = "base project id"
 } module "project-services" {
 source = "terraform-google-modules/project-factory/google//modules/project_services"
 for_each=var.project_id_map
 project_id = "${each.value.project_id}" 
 activate_apis = [ 
 "compute.googleapis.com",
 "cloudfunctions.googleapis.com",
 "dataproc.googleapis.com",
 "redis.googleapis.com",
 "container.googleapis.com",
 "spanner.googleapis.com",
 "appengine.googleapis.com",
 "pubsub.googleapis.com",
 "composer.googleapis.com",
 "monitoring.googleapis.com",
 "compute.googleapis.com",
 "dataflow.googleapis.com",
 "run.googleapis.com",
 "file.googleapis.com", 
 "cloudkms.googleapis.com",
 "dns.googleapis.com",
 "cloudbilling.googleapis.com",
 "cloudresourcemanager.googleapis.com",
 "cloudasset.googleapis.com",
 "servicenetworking.googleapis.com",
 "appengine.googleapis.com",
 "container.googleapis.com",
 "sqladmin.googleapis.com",
 "cloudkms.googleapis.com" 
 ]
 }
variables.tf
variable "project_id_map" {
 type = map(object({
 project_id = string
 })) 
 default = {
 "Projectid_1" = {
 project_id = "project_1_id"
 }
 "Projectid_2" = {
 project_id = "project_2_id"
 }
 }
 }
- "compute.googleapis.com",
 
- "cloudfunctions.googleapis.com",
 
- "dataproc.googleapis.com",
 
- "redis.googleapis.com",
 
- "container.googleapis.com",
 
- "spanner.googleapis.com",
 
- "appengine.googleapis.com",
 
- "pubsub.googleapis.com",
 
- "composer.googleapis.com",
 
- "monitoring.googleapis.com",
 
- "compute.googleapis.com",
 
- "dataflow.googleapis.com",
 
- "run.googleapis.com",
 
- "file.googleapis.com",
 
- "cloudkms.googleapis.com",
 
- "dns.googleapis.com",
 
- "cloudbilling.googleapis.com",
 
- "cloudresourcemanager.googleapis.com",
 
- "cloudasset.googleapis.com",
 
- "servicenetworking.googleapis.com",
 
- "appengine.googleapis.com",
 
- "container.googleapis.com",
 
- "sqladmin.googleapis.com",
 
- cloudkms.googleapis.com"
 
Google Cloudリソースを作成した際に上記APIのほとんどはデフォルトで有効化されています。
関連ガイド