json配置

    1. {
    2. "trigger": {
    3. "schedule": {
    4. "interval": "1m"
    5. }
    6. },
    7. "input": {
    8. "search": {
    9. "request": {
    10. "search_type": "query_then_fetch",
    11. "indices": [
    12. "*"
    13. ],
    14. "rest_total_hits_as_int": true,
    15. "body": {
    16. "size": 0,
    17. "query": {
    18. "match_all": {}
    19. }
    20. }
    21. }
    22. }
    23. },
    24. "condition": {
    25. "compare": {
    26. "ctx.payload.hits.total": {
    27. "gte": 10
    28. }
    29. }
    30. },
    31. "actions": {
    32. "my-webhook": {
    33. "webhook": {
    34. "scheme": "https",
    35. "host": "oapi.dingtalk.com",
    36. "port": 443,
    37. "method": "post",
    38. "path": "/robot/send",
    39. "params": {
    40. "access_token": "替换成真实的token"
    41. },
    42. "headers": {
    43. "Content-Type": "application/json"
    44. },
    45. "body": "{\"msgtype\": \"text\",\"text\": {\"content\": \"监控告警我就是我, 是不一样的烟火\"}}"
    46. }
    47. }
    48. }
    49. }

    xpack收费功能,需要黄金会员,详见:https://www.elastic.co/cn/subscriptions
    image.png