Hello, I would like to use an alert to notify me of a snapshot failure. However, I quickly find myself limited because I am unable to define the type of monitor (Per query or per cluster metrics monitor).
I need to retrieve the last 4 snapshots, and if any of them are not in the SUCCESS state, I should receive an email notification.
Here is my configuration:
name: "daily_backup",
type: "monitor",
enabled: true,
schedule: {
period: {
interval: 1,
unit: "MINUTES"
}
},
inputs: [{
search: {
indices: ["test-logs-*"],
query: {
size: 0,
aggregations: {},
query: {
snapshot.status: 'FAILED'
}
}
}
}],
triggers: [
{
name : "[Trigger for 'daily_backup' snapshot failure]",
severity : "1",
condition : {
script : {
source : "ctx.results[0].hits.total.value > 0",
lang : "painless"
}
},
actions : [
{
name : "Email",
destination_id : "mail-to-team",
message_template : {
source : "The creation of snapshot 'daily_backup' failed.",
},
throttle_enabled : true,
throttle : {
value : 30,
unit : "MINUTES"
}
subject_template : {
source : "[SNAPSHOT-FAILURE]",
}
}
]
}
]
}```
Thanks for your answer
Best,