Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i send an email alert if my Google Cloud Scheduler job failed?

I have schedule a HTTP call type job using Google Cloud Scheduler. How do I send out email alert if the job failed?

I have read the Cloud Scheduler documentation, and google around but the answer is not obvious. I had also attempted the stackdriver alert policy but can't find the corresponding metrics for the failed log entry.

I expect an email notification can be configured to send out if the scheduled job failed.

like image 603
Chee Kin Chan Avatar asked Apr 02 '19 10:04

Chee Kin Chan


People also ask

What is alerting in GCP?

In this alerting policy, the condition is monitoring the HTTP response latency. If this latency is higher than two seconds continuously for five minutes, then the condition is met and an incident is created. A transient spike in latency doesn't cause the condition to be met or an incident to be created.

How does Google Cloud Scheduler work?

Cloud Scheduler is a fully managed enterprise-grade cron job scheduler. It allows you to schedule virtually any job, including batch, big data jobs, cloud infrastructure operations, and more. You can automate everything, including retries in case of failure to reduce manual toil and intervention.


1 Answers

One way to handle this is to create a new Log-Based Metric with this filter:

resource.type="cloud_scheduler_job" severity != INFO.

Then you can create an alert based on this new metric.

like image 182
RayB Avatar answered Sep 22 '22 02:09

RayB