ELK + Sentinl 日志实时监控报警 钉钉、邮件

1、docker安装elk

镜像:sebp/elk

挂出的端口:5044,5601,9200,9300

2、进入容器,安装sentinl插件

进入kibana安装目录:/etc/kibana/bin ,执行:

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

安装完成后重启elk容器

3、获取钉钉报警机器人的webhook链接


在sentinl里面加一个watcher:

Input填入:

{
  "search": {
    "request": {
      "index": [
        "*"
      ],
      "body": {
        "query": {
          "bool": {
            "must": [
              {
                "query_string": {
                  "analyze_wildcard": true,
                  "query": "\"error\""
                }
              },
              {
                "range": {
                  "@timestamp": {
                    "gte": "now-10m",
                    "lte": "now",
                    "format": "epoch_millis"
                  }
                }
              }
            ],
            "must_not": []
          }
        }
      }
    }
  }
}
condition填入:
{
  "script": {
    "script": "payload.hits.total > 1"
  }
}

添加一个webhook的action:



以上所有配置根据自己需要修改,附上钉钉的demo地址:

https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.karFPe&treeId=257&articleId=105735&docType=1#s0


成功报警。


感谢观看,有问题有建议有意见请留言,谢谢!

  • 2
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 23
    评论
以下是ELK+filebeat+sentinl的源码安装步骤: 1. 安装Java ELK需要Java运行环境,所以首先需要安装Java。可以在Oracle官网上下载适合自己系统的Java安装包,然后按照提示进行安装。 2. 安装Elasticsearch 在Elasticsearch官网上下载对应系统的安装包,解压后进入bin目录,执行以下命令启动Elasticsearch: ``` ./elasticsearch ``` 3. 安装Kibana 在Kibana官网上下载对应系统的安装包,解压后进入bin目录,执行以下命令启动Kibana: ``` ./kibana ``` 4. 安装Logstash 在Logstash官网上下载对应系统的安装包,解压后进入bin目录,执行以下命令启动Logstash: ``` ./logstash -f logstash.conf ``` 其中,logstash.conf是Logstash的配置文件。 5. 安装Filebeat 在Filebeat官网上下载对应系统的安装包,解压后进入bin目录,编辑filebeat.yml配置文件,配置日志收集的路径和输出到Logstash的地址,然后执行以下命令启动Filebeat: ``` ./filebeat -e -c filebeat.yml ``` 6. 安装Sentinl Sentinl是一个基于Kibana的插件,用于实现告警功能。首先需要安装Kibana插件管理工具elasticsearch-plugin,执行以下命令进行安装: ``` ./kibana-plugin install elasticsearch-plugin ``` 然后再安装Sentinl插件,执行以下命令进行安装: ``` ./kibana-plugin install https://github.com/sirensolutions/sentinl/releases/download/tag-6.4.2-0/sentinl-v6.4.2.zip ``` 7. 配置Sentinl 编辑Kibana的配置文件kibana.yml,修改以下配置: ``` sentinl:admin_email: admin@example.com ``` 其中,admin@example.com是管理员邮箱。 8. 启动ELK+filebeat+sentinl 依次启动Elasticsearch、Kibana、Logstash和Filebeat。然后在Kibana中打开Sentinl插件,配置告警规则即可。
评论 23
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值