1

I have stackdriver alerts setup that notify whenever the CPU utilisation for a compute engine instance falls below or rises above some thresholds.

I would like to restart the instance whenever this alert is fired.

How do I achieve this without having to write & maintain another vm or cloud function?

Does stackdriver or any other monitoring option on GCP let me reset instances based on an alert condition?

vsr
  • 111
  • 3

1 Answers1

1

I think that A Stackdriver Alerting Policy won't be able to run any commands to stop or start a GCE VM by itself.

Indeed you could use a Cloud Function with Cloud Scheduler for this or a cron on other GCE VM, as we can read here on this other question [1]. Cloud Scheduler gives you 3 free jobs per month [2] and Cloud Functions has the following pricing [3].

[1] https://stackoverflow.com/questions/47817919/automatic-script-to-turn-off-and-on

[2] https://cloud.google.com/scheduler/pricing

[3] https://cloud.google.com/functions/pricing

Carlo C.
  • 107
  • 1
  • 8