From 608cb26db0002c7e34e0859c37580c30041440e1 Mon Sep 17 00:00:00 2001 From: Aaron Crickenberger Date: Wed, 26 May 2021 15:32:48 -0400 Subject: [PATCH] audit: add support for monitoring service --- audit/audit-gcp.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/audit/audit-gcp.sh b/audit/audit-gcp.sh index a29e624227e9..433ba454a33f 100755 --- a/audit/audit-gcp.sh +++ b/audit/audit-gcp.sh @@ -309,7 +309,19 @@ function audit_gcp_project_service() { > "${service_dir}/sinks.json" ;; monitoring) - echo "TODO: ${service} needs serviceusage.services.use" + # TODO: does this actually need serviceusage.services.use? + local dashboards_dir="${service_dir}/dashboards" + ensure_clean_dir "${dashboards_dir}" + gcloud monitoring dashboards list \ + --project="${project}" \ + --format=json | format_gcloud_json \ + | jq -r 'map("\(.displayName) \(.)")[]' \ + | while read -r name json; do \ + echo "dashboard: ${name}" + echo "${json}" \ + > "${dashboards_dir}/${name}.json" + done + # TODO: ensure gcloud beta and gcloud alpha are available #### gcloud alpha monitoring policies list > "projects/${project}/services/monitoring.policies.json" #### gcloud alpha monitoring channels list > "projects/${project}/services/monitoring.channels.json" #### gcloud alpha monitoring channel-descriptors list > "projects/${project}/services/monitoring.channel-descriptors.json"