Reputation: 434
I have an application that I'm setting up logs-based monitoring for. The application will log whenever it completes a certain task. I want to ensure that the application completes this at least once every 6 hours.
I have tried to replicate this rule by configuring monitoring to fire an alert when the metric stays below 1 for the given amount of time.
Unfortunately, when the logs-based metric doesn't receive any logs, it appears to act that there is "no data" instead of a value of 0.
Is it possible to treat segments when no logs are received as a 0 so that the alert will fire?
Screenshot of my metric graph:
Screenshot of alert definition: You can see that we receive a log for one time frame, but right afterwards the line disappears and an alert isn't triggered.
Upvotes: 3
Views: 2074
Reputation: 21487
Try using absent_for
and MQL based Alert.
The
absent_for
table operation generates a table with two value columns, active and signal. The active column istrue
when there is data missing from the table input andfalse
otherwise. This is useful for creating a condition query to be used to alert on the absence of inputs.
Example:
fetch gce_instance :: compute.googleapis.com/instance/cpu/usage_time
| absent_for 8h
Upvotes: 1