{
"actions" : {
"email_notification" : {
"email" : {
"subject" : {
"inline" : "{{color}} alert",
"params" : {
"color" : "red"
}
}
}
}
}
}
Hey,
I'm sorry, but just pasting a snippet without any context whatsoever will not get you any help.
Please supply the full watch, the output of the execute watch API, a full description what you are trying to achieve and what you think is not working as expected.
Please take a moment to read our help guidelines
Thanks.
--Alex
{
"trigger": {
"schedule": {
"interval": "60m"
}
},
"input": {
"chain": {
"inputs": [
{
"today": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"newstart-ad_info-cookingjoy-*"
],
"types": [],
"body": {
"size": 0,
"query": {
"range": {
"json._serverDate": {
"gte": "now-60m/m",
"lt": "now/m"
}
}
}
}
}
}
}
},
{
"yesterday": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"newstart-ad_info-cookingjoy-*"
],
"types": [],
"body": {
"size": 0,
"query": {
"range": {
"json._serverDate": {
"gte": "now-1500m/m",
"lt": "now-1440m/m"
}
}
}
}
}
}
}
}
]
}
},
"condition": {
"script": {
"source": "return (ctx.payload.yesterday.hits.total > 0 && (ctx.payload.today.hits.total*100.00 / (ctx.payload.yesterday.hits.total*100.00) < 0.8 || ctx.payload.today.hits.total*100.00 / (ctx.payload.yesterday.hits.total*100.00) > 1.5))",
"lang": "painless"
}
},
"actions": {
"email_admin": {
"email": {
"profile": "standard",
"attachments": {
"yesterday_log_count-today_log_count": {
"data": {
"format": "json"
}
}
},
"priority": "high",
"to": [
"feng.mi@zenjoy.net",
"yue.liu@zenjoy.net"
],
"subject":{
"inline":"{{color}} cookingjoyad_infoalarm! current ratio is less than 0.8 or over 1.5",
"params" : {
"color" : "red"
}
},
"body": {
"text": "current ({{ctx.trigger.scheduled_time}}) 60min ad_info value {{ctx.payload.today.hits.total}} \nYesterday 60min ad_info value {{ctx.payload.yesterday.hits.total}}, ratio is less than 0.8 or over 1.5"
}
}
}
}
}
* List item
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.