Sentinl插件安装及使用

Sentinl插件安装及使用

简介

  • sentinl是一个免费的kibana监控预警与报告插件,与付费软件X-Pack功能类似。 可以实现监控并发报警邮件

下载地址

  • https://github.com/sirensolutions/sentinl/releases(注意下载的版本一定要和kibana版本一致

sentinl安装

cd /usr/local/elk

上传sentinl-v6.2.1.zip

cd kibana-6.2.1-linux-x86_64/bin/

./kibana-plugin  install file:///usr/local/elksentinl-v6.2.1.zip

[root@localhost bin]# ./kibana-plugin install file:///usr/local/elk/sentinl-v6.2.1.zip 
Attempting to transfer from file:///usr/local/elk/sentinl-v6.2.1.zip
Transferring 7735848 bytes....................
Transfer complete
Retrieving metadata from plugin archive
Extracting plugin archive
Extraction complete
Optimizing and caching browser bundles...
Plugin installation complete


如果出现如下警告:

[warning][Sentinl][scheduler] index missing: .kibana

不要慌,es收集到数据后会自动创建.kibana索引的(可以理解为kibana和es第一次交互时创建.kibana索引)

我当时只部署了es和kibana就去启动,发现一直有警告,还以为部署出问题了

使用

  • 在kibana界面上配置sentinl,点击右上角new创建watchers
  • 点击 +watcher创建新的Watcher
  • 填写General页面内容, title是watcher的名称,Schedule是执行周期
  • 填写input页面内容, body 里面填写ES查询语句,可根据具体业务编写相应的查询语句
input示例:

{
  "search": {
    "request": {
      "index": [
        "index1"
      ],
      "body": {
        "query": {
          "match": {
            "message": "YIKANG"
          }
        }
      }
    }
  }
}

收集的日志匹配: "message": "YIKANG",即查询命中
  • 填写Condition页面内容, payload.hits.total > 1 (当查询结果数大于1时,触发Actions),可以自己制定条件。
condition示例:

{
  "script": {
    "script": "payload.hits.total > 1"
  }
}
  • Transform 可对input查询的结果做一些处理,此处没有使用,可以不填写
  • 填写Actions页面内容,Actions包括webhook(使用webhook发rest请求,可以选择 get或post两种方式。),email,email html,report,slack,console
  • 填好对应数据之后,点击右上角的Save按钮。
  • 可以点击单次执行按钮进行测试。

具体使用参考:https://www.cnblogs.com/kellyJAVA/p/8953928.html

你可能感兴趣的:(日志,ELK,sentinl,ELK)