zoukankan      html  css  js  c++  java
  • kibana-sentinl插件监控报警

    kibana-sentinl插件监控报警

    到github下载对应的版本的sentinl https://github.com/sirensolutions/sentinl/releases/

    插件安装,通过远程安装,或者下载到本地都行,下面两种方式二选一

      ./bin/kibana-plugin install https://github.com/sirensolutions/sentinl/releases/download/tag-6.2.3-3/sentinl-v6.0.1.zip
      
      ./bin/kibana-plugin install file:./sentinl-v6.0.1.zip
    

      

    配置邮箱账户 vim /etc/kibana/kibana.yml 将下面内容追加到配置文件

    sentinl:
      settings:
        email:
          active: true
          user: xxx@163.com
          password: mima
          host: smtp.163.com
          ssl: true   #根据实际情况添加
        report:
          active: true
    

      

    打开kibana会发现多一个菜单sentinl,然后点开 一次点击new watcher 直接改Raw的文件,解析如下

    {  
      "_index": "watcher",  
      "_type": "watch",  
      "_id": "new_watcher_bzd9kgjzi",  
      "_score": 1,  
      "_source": {  
        "title": "Alerm",  
        "disable": false,  
        "uuid": "new_watcher_bzd9kgjzi",  
        "trigger": {  
          "schedule": {  
            "later": "every 1 hours"  //执行时间为1小时  
          }  
        },  
        "input": {  
          "search": {  
            "request": {  
              "body": {  
                "query": {  
                  "bool": {  
                    "must": [  
                      {  
                        "query_string": {  
                          "fields": [  
                            "body^5",  
                            "_all"  
                          ],  
                          "query": "ERROR~",  //限制报警源为出错ERROR的日志  
                          "use_dis_max": true  
                        }  
                      },  
                      {  
                        "range": {  
                          "@timestamp": {  
                            "gte": "now-1h",  //对进1小时的日志进行检测  
                            "lte": "now",  
                            "format": "epoch_millis"  
                          }  
                        }  
                      }  
                    ],  
                    "must_not": []  
                  }  
                }  
              }  
            }  
          }  
        },  
        "condition": {  
          "script": {  
            "script": "payload.hits.total>=1"  //当报警条件为ERROR出现的次数大于1  
          }  
        },  
        "transform": {  
          "script": {  
            "script": ""  
          }  
        },  
        "actions": {  
          "AlermNeon": {  
            "throttle_period": "1h0m0s",  
            "email": {  
              "to": "yyyg@163.com",  //接收报警的邮箱  
              "from": "xxxx@163.com",//发送报警的邮箱(与kibana.yml配置中一致)  
              "subject": "Sentinl Alarm",  
              "priority": "high",  
              "body": "Alerm of neon: {{payload.hits.total}} !"  //邮件内容  
            }  
          }  
        }  
      }  
    }  
    

      

  • 相关阅读:
    Maven打jar包(有依赖)
    java使用ffmpeg进行多个视频合并
    ffmpeg视频精准剪切
    windows下java调用海康sdk,Unable to load library 'HCNetSDK'
    java使用JNA框架调用dll动态库
    排序和反转
    118. 杨辉三角
    1394. 找出数组中的幸运数
    1491. 去掉最低工资和最高工资后的工资平均值
    1332. 删除回文子序列
  • 原文地址:https://www.cnblogs.com/libinblogs/p/9285877.html
Copyright © 2011-2022 走看看