Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated list of enabled APIs for network dashboard #929

Merged
merged 23 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
561e113
added services to monitoring project
maunope Oct 28, 2022
5b32621
Merge branch 'maunope/static_routes' of https://github.com/maunope/cl…
maunope Oct 28, 2022
5841c11
Merge branch 'master' into maunope/static_routes
aurelienlegrand Oct 28, 2022
fe29b93
fixed proj creation and readme
maunope Oct 28, 2022
06c2ae3
Merge branch 'maunope/static_routes' of https://github.com/maunope/cl…
maunope Oct 28, 2022
9a6b6fd
Merge branch 'master' into maunope/static_routes
juliocc Nov 2, 2022
2bc60e6
readme updates, removed default prefix, completed vpc-sc compatibility
maunope Nov 10, 2022
55d544b
Merge branch 'master' of https://github.com/GoogleCloudPlatform/cloud…
maunope Nov 10, 2022
da0c05c
updated tfdoc
maunope Nov 10, 2022
c2da049
Merge branch 'maunope/static_routes' into vpc-sc
maunope Nov 10, 2022
8b07f1b
Merge pull request #3 from maunope/vpc-sc
maunope Nov 10, 2022
9eb63df
merge
maunope Nov 10, 2022
bb072af
addressed #599 comments
maunope Nov 10, 2022
d65f9ac
Merge branch 'vpc-sc' into maunope/static_routes
maunope Nov 10, 2022
f3002e9
#599 comments
maunope Nov 10, 2022
6a6e326
Merge branch 'maunope/static_routes' of https://github.com/maunope/cl…
maunope Nov 10, 2022
13238be
Merge branch 'master' into maunope/static_routes
maunope Nov 11, 2022
2ffc1c9
Merge branch 'master' into maunope/static_routes
maunope Nov 11, 2022
b39c277
Merge branch 'master' into maunope/static_routes
maunope Nov 14, 2022
ce624f2
moving metrics project conf to next PR
maunope Nov 15, 2022
9815403
removed vpc connector var
maunope Nov 15, 2022
9b84e15
Merge branch 'master' into maunope/static_routes
aurelienlegrand Nov 15, 2022
bf3e623
Merge branch 'master' into maunope/static_routes
maunope Nov 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions blueprints/cloud-operations/network-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@ Three metric descriptors are created for each monitored resource: usage, limit a
Clone this repository, then go through the following steps to create resources:
- Create a terraform.tfvars file with the following content:
```tfvars
organization_id = "<YOUR-ORG-ID>"
billing_account = "<YOUR-BILLING-ACCOUNT>"
monitoring_project_id = "project-0" # Monitoring project where the dashboard will be created and the solution deployed
monitored_projects_list = ["project-1", "project2"] # Projects to be monitored by the solution
monitored_folders_list = ["folder_id"] # Folders to be monitored by the solution
v2 = false # Set to true to use V2 Cloud Functions environment
```
organization_id = "<YOUR-ORG-ID>"
billing_account = "<YOUR-BILLING-ACCOUNT>"
monitoring_project_id = "<YOUR-MONITORING-PROJECT>"
# Monitoring project where the dashboard will be created and the solution deployed, a project named "mon-network-dahshboard" will be created if left blank
monitored_projects_list = ["project-1", "project2"]
# Projects to be monitored by the solution
monitored_folders_list = ["folder_id"]
# Folders to be monitored by the solution
prefix = "<YOUR-PREFIX>"
# Monitoring project name prefix, monitoring project name is <YOUR-PREFIX>-network-dashboard, ignored if monitoring_project_id variable is provided
v2 = true|false # Set to true to use V2 Cloud Functions environment
maunope marked this conversation as resolved.
Show resolved Hide resolved
```
maunope marked this conversation as resolved.
Show resolved Hide resolved
- `terraform init`
- `terraform apply`

Note: Org level viewing permission is required for some metrics such as firewall policies.

Once the resources are deployed, go to the following page to see the dashboard: https://console.cloud.google.com/monitoring/dashboards?project=<YOUR-MONITORING-PROJECT>.
Once the resources are deployed, go to the following page to see the dashboard: https://console.cloud.google.com/monitoring/dashboards?project=<YOUR-MONITORING-PROJECT> (or <YOUR-METRICS-PROJECT> if populated)
maunope marked this conversation as resolved.
Show resolved Hide resolved
A dashboard called "quotas-utilization" should be created.

The Cloud Function runs every 10 minutes by default so you should start getting some data points after a few minutes.
You can use the metric explorer to view the data points for the different custom metrics created: https://console.cloud.google.com/monitoring/metrics-explorer?project=<YOUR-MONITORING-PROJECT>.
You can use the metric explorer to view the data points for the different custom metrics created: https://console.cloud.google.com/monitoring/metrics-explorer?project=<YOUR-MONITORING-PROJECT> (or <YOUR-METRICS-PROJECT> if populated).
maunope marked this conversation as resolved.
Show resolved Hide resolved
You can change this frequency by modifying the "schedule_cron" variable in variables.tf.

Note that some charts in the dashboard align values over 1h so you might need to wait 1h to see charts on the dashboard views.
Expand Down Expand Up @@ -69,7 +74,6 @@ Note that metrics are created in the cloud-function/metrics.yaml file. You can a
- The CF assumes custom routes importing/exporting is ON, this impacts static and dynamic routes usage calculation
- The CF assumes all networks in peering groups have the same global routing and custom routes sharing configuration


## Next steps and ideas
In a future release, we could support:
- Google managed VPCs that are peered with PSA (such as Cloud SQL or Memorystore)
Expand All @@ -87,13 +91,13 @@ If you are interested in this and/or would like to contribute, please contact le
|---|---|:---:|:---:|:---:|
| [billing_account](variables.tf#L17) | The ID of the billing account to associate this project with | <code></code> | ✓ | |
| [monitored_projects_list](variables.tf#L36) | ID of the projects to be monitored (where limits and quotas data will be pulled) | <code>list&#40;string&#41;</code> | ✓ | |
| [organization_id](variables.tf#L47) | The organization id for the associated services | <code></code> | ✓ | |
| [prefix](variables.tf#L51) | Customer name to use as prefix for monitoring project | <code></code> | ✓ | |
| [organization_id](variables.tf#L46) | The organization id for the associated services | <code></code> | ✓ | |
| [prefix](variables.tf#L50) | Customer name to use as prefix for monitoring project | <code></code> | ✓ | |
| [cf_version](variables.tf#L21) | Cloud Function version 2nd Gen or 1st Gen. Possible options: 'V1' or 'V2'.Use CFv2 if your Cloud Function timeouts after 9 minutes. By default it is using CFv1. | <code></code> | | <code>V1</code> |
| [monitored_folders_list](variables.tf#L30) | ID of the projects to be monitored (where limits and quotas data will be pulled) | <code>list&#40;string&#41;</code> | | <code>&#91;&#93;</code> |
| [monitoring_project_id](variables.tf#L41) | Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string | <code></code> | | |
| [project_monitoring_services](variables.tf#L55) | Service APIs enabled in the monitoring project if it will be created. | <code></code> | | <code title="&#91;&#10; &#34;artifactregistry.googleapis.com&#34;,&#10; &#34;cloudasset.googleapis.com&#34;,&#10; &#34;cloudbilling.googleapis.com&#34;,&#10; &#34;cloudbuild.googleapis.com&#34;,&#10; &#34;cloudresourcemanager.googleapis.com&#34;,&#10; &#34;cloudscheduler.googleapis.com&#34;,&#10; &#34;compute.googleapis.com&#34;,&#10; &#34;cloudfunctions.googleapis.com&#34;,&#10; &#34;iam.googleapis.com&#34;,&#10; &#34;iamcredentials.googleapis.com&#34;,&#10; &#34;logging.googleapis.com&#34;,&#10; &#34;monitoring.googleapis.com&#34;,&#10; &#34;run.googleapis.com&#34;,&#10; &#34;serviceusage.googleapis.com&#34;&#10;&#93;">&#91;&#8230;&#93;</code> |
| [region](variables.tf#L75) | Region used to deploy the cloud functions and scheduler | <code></code> | | <code>europe-west1</code> |
| [schedule_cron](variables.tf#L80) | Cron format schedule to run the Cloud Function. Default is every 10 minutes. | <code></code> | | <code>&#42;&#47;10 &#42; &#42; &#42; &#42;</code> |
| [monitoring_project_id](variables.tf#L41) | Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string, if metrics_project_id is provided, metrics and dashboard will be deployed there | <code></code> | | |
maunope marked this conversation as resolved.
Show resolved Hide resolved
| [project_monitoring_services](variables.tf#L54) | Service APIs enabled in the monitoring project if it will be created. | <code></code> | | <code title="&#91;&#10; &#34;artifactregistry.googleapis.com&#34;,&#10; &#34;cloudasset.googleapis.com&#34;,&#10; &#34;cloudbilling.googleapis.com&#34;,&#10; &#34;cloudbuild.googleapis.com&#34;,&#10; &#34;cloudfunctions.googleapis.com&#34;,&#10; &#34;cloudresourcemanager.googleapis.com&#34;,&#10; &#34;cloudscheduler.googleapis.com&#34;,&#10; &#34;compute.googleapis.com&#34;,&#10; &#34;iam.googleapis.com&#34;,&#10; &#34;iamcredentials.googleapis.com&#34;,&#10; &#34;logging.googleapis.com&#34;,&#10; &#34;monitoring.googleapis.com&#34;,&#10; &#34;pubsub.googleapis.com&#34;,&#10; &#34;run.googleapis.com&#34;,&#10; &#34;servicenetworking.googleapis.com&#34;,&#10; &#34;serviceusage.googleapis.com&#34;,&#10; &#34;storage-component.googleapis.com&#34;&#10;&#93;">&#91;&#8230;&#93;</code> |
| [region](variables.tf#L76) | Region used to deploy the cloud functions and scheduler | <code></code> | | <code>europe-west1</code> |
| [schedule_cron](variables.tf#L81) | Cron format schedule to run the Cloud Function. Default is every 10 minutes. | <code></code> | | <code>&#42;&#47;10 &#42; &#42; &#42; &#42;</code> |

<!-- END TFDOC -->
12 changes: 10 additions & 2 deletions blueprints/cloud-operations/network-dashboard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ locals {
folder_ids = toset(var.monitored_folders_list)
folders = join(",", local.folder_ids)
monitoring_project = var.monitoring_project_id == "" ? module.project-monitoring[0].project_id : var.monitoring_project_id
metrics_project = var.metrics_project_id == "" ? (var.monitoring_project_id == "" ? module.project-monitoring[0].project_id : var.monitoring_project_id) : var.metrics_project_id
maunope marked this conversation as resolved.
Show resolved Hide resolved
}

################################################
Expand All @@ -30,7 +31,7 @@ locals {
module "project-monitoring" {
count = var.monitoring_project_id == "" ? 1 : 0
source = "../../../modules/project"
name = "monitoring"
name = "network-dashboards"
parent = "organizations/${var.organization_id}"
prefix = var.prefix
billing_account = var.billing_account
Expand Down Expand Up @@ -141,6 +142,13 @@ module "cloud-function" {
lifecycle_delete_age = null
}
region = var.region
vpc_connector = (var.vpc_connector_name != "" ?
{
create = false
name = var.vpc_connector_name
egress_settings = "ALL_TRAFFIC"
} : null)


bundle_config = {
source_dir = "cloud-function"
Expand Down Expand Up @@ -182,5 +190,5 @@ module "cloud-function" {

resource "google_monitoring_dashboard" "dashboard" {
dashboard_json = file("${path.module}/dashboards/quotas-utilization.json")
project = local.monitoring_project
project = local.metrics_project
maunope marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ variable "project_vm_services" {
"servicenetworking.googleapis.com",
]
}

variable "region" {
description = "Region used to deploy subnets"
default = "europe-west1"
Expand All @@ -45,4 +44,4 @@ variable "region" {
variable "zone" {
description = "Zone used to deploy vms"
default = "europe-west1-b"
}
}
11 changes: 6 additions & 5 deletions blueprints/cloud-operations/network-dashboard/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ variable "monitored_projects_list" {
}

variable "monitoring_project_id" {
description = "Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string"
description = "Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string, if metrics_project_id is provided, metrics and dashboard will be deployed there "
default = ""
}


variable "organization_id" {
description = "The organization id for the associated services"
}
Expand All @@ -59,19 +58,21 @@ variable "project_monitoring_services" {
"cloudasset.googleapis.com",
"cloudbilling.googleapis.com",
"cloudbuild.googleapis.com",
"cloudfunctions.googleapis.com",
"cloudresourcemanager.googleapis.com",
"cloudscheduler.googleapis.com",
"compute.googleapis.com",
"cloudfunctions.googleapis.com",
"iam.googleapis.com",
"iamcredentials.googleapis.com",
"logging.googleapis.com",
"monitoring.googleapis.com",
"pubsub.googleapis.com",
"run.googleapis.com",
"serviceusage.googleapis.com"
"servicenetworking.googleapis.com",
"serviceusage.googleapis.com",
"storage-component.googleapis.com"
]
}

variable "region" {
description = "Region used to deploy the cloud functions and scheduler"
default = "europe-west1"
Expand Down