整个监控过程可以简单理解为heartbeat 根据配置的策略,定时进行监控访问,并将监控结果发送到elasticsearch,通过kibana将监控结果以方便的方式展示出来。
1. 下载heartbeat并解压到本地目录参考地址如下,这里以windows平台为例。
https://www.elastic.co/cn/downloads/past-releases/heartbeat-7-5-12. 配置监控
在解压后的主目录下,找到配置文件heartbeat.yml,关注其中的监控配置和输出配置。这里将监控配置设置为监控本地部署的elasticsearch,每10秒执行一次。
输出到本地的elasticsearch。
heartbeat.monitors: - type: http # List or urls to query urls: ["http://localhost:9200"] # Configure task schedule schedule: '@every 10s' # Total test connection and data exchange timeout #timeout: 16s output.elasticsearch: # Array of hosts to connect to. hosts: ["localhost:9200"] # Optional protocol and basic auth credentials. #protocol: "https" #username: "elastic" #password: "changeme"3. 执行初始化
heartbeat.exe setup
通过该初始化,将在es中创建uptime配置。
4. 启动监控heartbeat.exe
带调试输出的启动。
heartbeat.exe -e5. 从kibana中查看Uptime监控
可以看到监控处于运行状态。
6. 点击监控名称进一步查看可以看出每次执行监控的响应时间。
可以看到每次执行监控时的信息记录。
heartbeat提供了http,tcp,icmp等进行监控。



