ELK 使用 metricbeat监控数据

|-----------------|------------|--------|
| IP | 功能 | 版本 |
| 192.168.140.153 | elk-1 | 8.13.4 |
| 192.168.140.153 | metricbeat | 8.13.4 |
| 192.168.140.156 | elk-2 | 8.13.4 |
| 192.168.140.156 | metricbeat | 8.13.4 |
| 192.168.140.159 | logstash | 8.13.4 |
| 192.168.140.159 | kibana | 8.13.4 |

一、安装ELK

参考文档:

https://download.csdn.net/download/weixin_44295677/89374143?spm=1001.2014.3001.5503https://download.csdn.net/download/weixin_44295677/89374143?spm=1001.2014.3001.5503

二、安装metricbeat(elastic所在服务器都需要执行)

1、下载metricbeat

可以跟据自己需要选择安装方式(该文档使用tar包安装)

2、解压
bash 复制代码
tar -zxvf metricbeat-8.13.4-linux-x86_64.tar.gz
mv metricbeat-8.13.4 /opt/metricbeat
3、开启elasticsearch-xpack模块
bash 复制代码
cd /opt/metricbeat
ln -s /opt/metricbeat/metricbeat /usr/bin/metricbeat
metricbeat modules enable elasticsearch-xpack
4、修改配置文件
bash 复制代码
vi /opt/metricbeat/modules.d/elasticsearch-xpack.yml
# 修改如下
- module: elasticsearch
  xpack.enabled: true
  period: 10s
  hosts: ["https://192.168.140.153:9200"]
  username: "elastic"
  password: "password"
  ssl.enabled: true
  ssl.certificate_authorities: ["/opt/es/config/certs/http_ca.crt"]


vi /opt/metricbeat/metricbeat.yml
# =================================== Kibana ===================================
setup.kibana:
  host: "192.168.140.153:5601"
  protocol: "https"
  ssl.certificate_authorities: ["/opt/metricbeat/certs/kibana-server.crt"]
  ssl.verification_mode: "none"
  ssl.certificate: "/opt/metricbeat/certs/kibana-server.crt"
  ssl.key: "/opt/metricbeat/certs/kibana-server.key"

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  hosts: ["192.168.140.153:9200"]
  preset: balanced
  protocol: "https"
  username: "elastic"
  password: "introcks"
  ssl.enabled: true
  ssl.certificate_authorities: ["/opt/es/config/certs/http_ca.crt"]
5、检测配置文件格式
bash 复制代码
[root@localhost metricbeat]# metricbeat test config
Config OK
[root@localhost metricbeat]# metricbeat test output
elasticsearch: https://192.168.140.153:9200...
  parse url... OK
  connection...
    parse host... OK
    dns lookup... OK
    addresses: 192.168.140.153
    dial up... OK
  TLS...
    security: server's certificate chain verification is enabled
    handshake... OK
    TLS version: TLSv1.3
    dial up... OK
  talk to server... OK
  version: 8.13.4
6、编写启动脚本
bash 复制代码
[root@localhost metricbeat]# vi /etc/systemd/system/metricbeat.service
[Unit]
Description=Metricbeat service
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/metricbeat/metricbeat -c /opt/metricbeat/metricbeat.yml
Restart=always
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
7、启动服务
bash 复制代码
systemctl daemon-reload
systemctl start metricbeat.service
systemctl enable metricbeat.service

8、测试

相关推荐
格调UI成品2 小时前
预警系统安全体系构建:数据加密、权限分级与误报过滤方案
大数据·运维·网络·数据库·安全·预警
xuanzdhc5 小时前
Linux 基础IO
linux·运维·服务器
愚润求学5 小时前
【Linux】网络基础
linux·运维·网络
小和尚同志6 小时前
29.4k!使用 1Panel 来管理你的服务器吧
linux·运维
小米里的大麦9 天前
014 Linux 2.6内核进程调度队列(了解)
linux·运维·驱动开发
程序员的世界你不懂9 天前
Appium+python自动化(三十)yaml配置数据隔离
运维·appium·自动化
算法练习生9 天前
Linux文件元信息完全指南:权限、链接与时间属性
linux·运维·服务器
浩浩测试一下9 天前
渗透测试指南(CS&&MSF):Windows 与 Linux 系统中的日志与文件痕迹清理
linux·运维·windows·安全·web安全·网络安全·系统安全
小生云木9 天前
Linux离线编译安装nginx
linux·运维·nginx
19899 天前
【Dify精讲】第19章:开源贡献指南
运维·人工智能·python·架构·flask·开源·devops