环境:CentOS
实验效果
Metricbeat介绍
Metricbeat可以定期收集操作系统和服务器的运行指标(CPU,内存,硬盘,IO,读写速度,进程等等),Metricbeat可以将收集到的指标和数据发送到你指定的输出,比如:elasticsearch,最终达成监视服务器的目标。
官网介绍:https://www.elastic.co/guide/en/beats/metricbeat/6.3/metricbeat-module-system.html
使用rpm方式安装:
#curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-6.3.1-x86_64.rpm
#sudo rpm -vi metricbeat-6.3.1-x86_64.rpm
修改配置文件:
#vim /etc/metricbeat/metricbeat.yml
metricbeat.modules:
– module: system #使用系统模块
metricsets:
– cpu
– filesystem
– memory
– network
– process
– uptime
– diskio
– core
– load
enabled: true
period: 10s
processes: [‘.*’]
cpu_ticks: false
output.elasticsearch:
hosts: [“http://10.1.xxx:9200”] #默认创建名为metricbeat-6.3.1-yyyy.MM.dd
username: “elastic” #es地址 安装x-pack指定用户
password: “xxx”
setup.kibana.host: “10.1.xxx.190:5601”
setup.dashboards.enabled: true #使用kibana模板
启动:
service metricbeat start
查看日志:
[root@elk ~]# tail -f /var/log/metricbeat/metricbeat
2018-07-18T17:12:09.636+0800 INFO [monitoring] log/log.go:124 Non-zero metrics in the last 30s {“monitoring”: {“metrics”: {“beat”:{“cpu”:{“system”:{“ticks”:5300,”time”:{“ms”:119}},”total”:{“ticks”:17880,”time”:{“ms”:375},”value”:17880},”user”:{“ticks”:12580,”time”:{“ms”:256}}},”info”:{“ephemeral_id”:”b0517620-a96c-4463-a555-e751a4489a21″,”uptime”:{“ms”:1440142}},”memstats”:{“gc_next”:6576400,”memory_alloc”:4334040,”memory_total”:2393714640,”rss”:-4096}},”libbeat”:{“config”:{“module”:{“running”:0}},”output”:{“events”:{“acked”:612,”batches”:24,”total”:612},”read”:{“bytes”:11881},”write”:{“bytes”:381374}},”pipeline”:{“clients”:1,”events”:{“active”:0,”published”:612,”total”:612},”queue”:{“acked”:612}}},”metricbeat”:{“system”:{“core”:{“events”:12,”success”:12},”cpu”:{“events”:3,”success”:3},”diskio”:{“events”:33,”success”:33},”filesystem”:{“events”:21,”success”:21},”load”:{“events”:3,”success”:3},”memory”:{“events”:3,”success”:3},”network”:{“events”:12,”success”:12},”process”:{“events”:522,”success”:522},”uptime”:{“events”:3,”success”:3}}},”system”:{“load”:{“1″:3.98,”15″:4.43,”5″:4.25,”norm”:{“1″:0.995,”15″:1.1075,”5”:1.0625}}}}}}
查看索引是否创建
在kibana添加索引
查看可视化图表
参考链接 :
http://www.unmin.club/?p=145