windows环境
Heartbeat Doc: https://www.elastic.co/guide/en/beats/heartbeat/current/heartbeat-installation.html
1.安装并配置Heartbeat运行环境
下载windows版本的Heartbeat
解压Heartbeat zip包
移动到Heartbeat目录
管理员权限运行PowerShell
执行install脚本: .\install-service-heartbeat.ps1
执行策略出错时更改执行策略:set-executionpolicy remotesigned
脚本执行结果:
2.配置Heartbeat.yml
监听的端口 数据传输类型 请求间隔
############################# Heartbeat ######################################
# Configure monitors
heartbeat.monitors:
- type: http# List or urls to query
urls: ["http://*.*.*.*:9200"]# Configure task schedule
schedule: '@every 10s'
- type: tcp
urls: ["http://*.*.*.*:5044"]
schedule: '@every 10s'# Total test connection and data exchange timeout
#timeout: 16s
配置Kibana
#============================== Kibana =====================================
# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:# Kibana Host
# Scheme and port can be left out and will be set to the default (http and 5601)
# In case you specify and additional path, the scheme is required: http://localhost:5601/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
host: "*.*.*.*:5601"
配置Message的输出
#================================ 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: ["*.*.*.*:9200"]# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
#password: "changeme"#----------------------------- Logstash output --------------------------------
output.logstash:
# The Logstash hosts
hosts: ["*.*.*.*:5044"]# Optional SSL. By default is off.
# List of root certificates for HTTPS server verifications
#ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]# Certificate for SSL client authentication
#ssl.certificate: "/etc/pki/client/cert.pem"# Client Certificate Key
#ssl.key: "/etc/pki/client/cert.key"
3.运行Heartbeat
.\heartbeat.exe
作为windows服务启动: Start-Service packetbeat