简体   繁体   中英

GCP Monitoring: Is it possible to set up the monitor with a time range specifically

I want to set up a monitor just at night as its when we really need the alert monitoring, is it possible?

I think you want to enable|disable or snooze Alerting during specific periods.

Snoozing alerts appears (?.) to be currently only possible through Cloud Console which may be restrictive and don't appear to support recurring (everyday) schedules.

I think another alternative, is to disable alerts during the day and re-enable them overnight. You can use the API's projects.alertPolicies.Patch method or gcloud alpha monitoring policies update

# During the day
gcloud alpha monitoring policies update ${POLICY} \
--no-enabled \
--project=${PROJECT}

# During the night
gcloud alpha monitoring policies update ${POLICY} \
--enabled \
--project=${PROJECT}

Rather than remembering to do this, you could use cron or eg Cloud Scheduler to schedule the switch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM