GoogleCloudPlatform / GoogleCloudPlatform/monitoring-dashboard-samples
Meejoo18
- Dominant language
- TypeScript
- Stars
- 558
- Forks
- 353
- Avg merge
- 20h 55m
- Merged PRs (30d)
- 4
Description
#!/usr/bin/env bash
set -eE
ACTION=${1:?"action [import | export ] is required as argument \$1"}
alerting_export () {
# action is $1
alert_id=${2:?"alert id is required as argument \$2"}
project_id=${3:?"project id is required as argument \$3"}
output_file=${4:?"output file name is requred as argument \$4"}
project_number=$(gcloud projects describe "${project_id}" --format="value(projectNumber)")
echo "Exporting alerting \"$alert_id\" from project \"$project_id\" to file \"${output_file}\""
gcloud alpha monitoring policies describe \
"projects/${project_number}/alertPolicies/${alert_id}" --format=json \
| jq 'del(.name, .creationRecord, .mutationRecord, .notificationChannels)' \
| jq 'del(.conditions[].name)' \
> "${output_file}"
echo "Export finished"
}
alerting_import () {
# action is $1
project_id=${2:?"project id is required as argument \$2"}
input_file=${3:?"input file is requred as argument \$3"}
gcloud alpha monitoring policies
Contributor guide
Assessment
This issue has not been assessed yet.