1

One particular use case applying to this question is that we have some resources in AWS EC2 and Google Cloud Compute with a cron job to do a nightly disk snapshot.

Is there a way to use Stackdriver to monitor the snapshot is invoked and send an alert if it doesn't?

Basically this would operate like a heartbeat, but it's only sent every 24 hours.

I think one method is to use something like "metric absence" but I don't think CloudWatch nor Stackdriver can do something like a window greater than 24 hours.

Other use cases would be any other cron job we want to monitor that are application specific, like import jobs or batch jobs.

I know there's other services that can handle this like Cronitor or OpsGenie's Heartbeats but I'm looking for a method within the same environment without additional costs.

Rob Olmos
  • 2,220
  • 1
  • 15
  • 25

1 Answers1

2

There is currently no pre-configured metric in Stackdriver to check for snapshots.

The workaround is the one you mentioned. Every snapshot that you create on GCP generates two entries in the logging console. You can create a Stackdriver log based metric and then use it in an Alerting Policy to notify you when it is absent.

Similarly, for non-GCP resources or applications, you could still write records in Stackdriver logging, create the metric and then set the alerting over it.

The absent metric will let you set a timeframe of up to 25 hours.

Carlos
  • 1,385
  • 8
  • 15