Linux-Metricbeat 系统监控

Linux-Metricbeat 系统监控官网:https://www.elastic.co/cn/beats/metricbeat一、安装Metricbeatcurl-L-Ohttps://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.5.0-amd64.debsudodpkg-imetricbeat-7.5.0-amd64….

官网:https://www.elastic.co/cn/beats/metricbeat

 

一、安装Metricbeat 

curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.5.0-amd64.deb
sudo dpkg -i metricbeat-7.5.0-amd64.deb

deb用于Debian/Ubuntu

 

二、修改Metricbeat配置文件

sudo vim /etc/metricbeat/metricbeat.yml
#==========================  Modules configuration ============================
metricbeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: true

  # Period on which files under path should be checked for changes
  #reload.period: 20s

#自定义ES的索引需要把ilm设置为false
setup.ilm.enabled: false
setup.template.name: "meng"
setup.template.pattern: "meng-*"

#============================== Dashboards =====================================
# These settings control loading the sample dashboards to the Kibana index. Loading
# the dashboards is disabled by default and can be enabled either by setting the
# options here or by using the `setup` command.
setup.dashboards.enabled: true
setup.dashboards.index: "meng-*"

#============================== Kibana =====================================
# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:
  host: "IP:5601"

#================================ Outputs =====================================
# Configure what output to use when sending the data collected by the beat.
#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["IP:9200"]
  index: "meng-%{[agent.version]}-%{+yyyy.MM.dd}"

 

三、启用 system 模块

sudo metricbeat modules enable system

 

四、相关命令

#启动
sudo systemctl start metricbeat
#重启
sudo systemctl restart metricbeat
#停止
sudo systemctl stop metricbeat

#开机自启
sudo systemctl enable metricbeat

 

五、开启或关闭mysql模块

metricbeat  modules enable mysql
metricbeat modules disable mysql
vim /etc/metricbeat/modules.d/mysql.yml
# Module: mysql
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.5/metricbeat-module-mysql.html

- module: mysql
  metricsets:
    - status
  #  - galera_status
  period: 10s

  # Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
  # or "unix(/var/lib/mysql/mysql.sock)/",
  # or another DSN format supported by <https://github.com/Go-SQL-Driver/MySQL/>.
  # The username and password can either be set in the DSN or using the username
  # and password config options. Those specified in the DSN take precedence.
  hosts: ["数据库用户名:数据库密码@tcp(IP:3306)/"]

  # Username of hosts. Empty by default.
  #username: root

  # Password of hosts. Empty by default.
  #password: secret

 

六、访问 Kibana

服务器:

Linux-Metricbeat 系统监控

 

Mysql:

Linux-Metricbeat 系统监控

今天的文章Linux-Metricbeat 系统监控分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/25206.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注