Elastic Stack 7 : Install Heartbeat2021/06/22 |
Install Heartbeat that can monitor services for their availability with active probing.
|
|
[1] | Install Heartbeat. Configure Elasticsearch repository before it. |
[root@dlp ~]# dnf -y install heartbeat-elastic
|
[2] | Configure basic settings and start Heartbeat. |
[root@dlp ~]#
vi /etc/heartbeat/heartbeat.yml # line 23 : set items # by default, monitored the URL http://localhost:9200 like follows
heartbeat.monitors:
- type: http
# Set enabled to true (or delete the following line) to enable this example moo
nitor
enabled: true
# ID used to uniquely identify this monitor in elasticsearch even if the confii
g changes
id: my-monitor
# Human readable display name for this service in Uptime UI and elsewhere
name: My Monitor
# List or urls to query
urls: ["http://localhost:9200"]
# Configure task schedule
schedule: '@every 10s'
# Total test connection and data exchange timeout
#timeout: 16s
.....
.....
# line 73 : if use Kibana, uncomment and specify output host # if SSL is enabled on Kibana, hostname should be the same with the hostname in certs
setup.kibana:
.....
host: "https://dlp.srv.world:5601"
# line 100 : specify output host # the default is localhost's Elasticsearch # if output to Logstash, comment out Elasticsearch and uncomment logstash lines output.elasticsearch: # Array of hosts to connect to.l hosts: ["localhost:9200"] ..... ..... #output.logstash: # The Logstash hosts #hosts: ["localhost:5044"]
[root@dlp ~]#
vi /etc/heartbeat/heartbeat.reference.yml # line 24 : bt default, monitored localhost with ICMP every 5 min heartbeat.monitors: - type: icmp # monitor type `icmp` (requires root) uses ICMP Echo Request to pinn g # configured hosts # ID used to uniquely identify this monitor in elasticsearch even if the confii g changes id: my-monitor # Human readable display name for this service in Uptime UI and elsewhere name: my-icmp-monitor # Name of corresponding APM service, if Elastic APM is in use for the monitoree d service. # service.name: my-apm-service-name # Enable/Disable monitor #enabled: true # Configure task schedule using cron-like syntax schedule: '*/5 * * * * * *' # exactly every 5 seconds like 10:00:00, 10:00:05,, # List of hosts to ping hosts: ["localhost"] ..... ..... # line 104 : TCP monitoring section - type: tcp # monitor type `tcp`. Connect via TCP and optionally verify endpoint # by sending/receiving a custom payload # ID used to uniquely identify this monitor in elasticsearch even if the confii g changes id: my-monitor # Human readable display name for this service in Uptime UI and elsewhere name: my-tcp-monitor # Enable/Disable monitor #enabled: true # Configure task schedule schedule: '@every 5s' # every 5 seconds from start of beat ..... ..... hosts: ["localhost:9200"] ..... .....[root@dlp ~]# systemctl enable --now heartbeat-elastic
|
[3] | Verify status the data has been collected normally. |
# index list [root@dlp ~]# curl localhost:9200/_cat/indices?v health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open .kibana_7.13.2_001 zA_r0rrjT7OMUMVSGmRVfg 1 0 4541 388 3.5mb 3.5mb green open .apm-custom-link d1-9Pkn-RXOu_qhMOanvVA 1 0 0 0 208b 208b yellow open filebeat-7.13.2-2021.06.22-000001 c18zEwqAQVeNecW7d6EAQg 1 1 11757 0 1.7mb 1.7mb green open .kibana-event-log-7.13.2-000001 Y-rCmM6yTBKa9W5H1LeJ1g 1 0 1 0 5.6kb 5.6kb green open .apm-agent-configuration y3hQme2SQpGMtb64NLsNdA 1 0 0 0 208b 208b green open .async-search WRLoMwCITRKD3C_BrFJ9bw 1 0 49 239 157kb 157kb green open .kibana_task_manager_7.13.2_001 x6V232xKQLinqRedJRAbgw 1 0 10 4310 499.5kb 499.5kb yellow open packetbeat-7.13.2-2021.06.22-000001 nYN59YPRQwGmDrMRXijZxA 1 1 29267 0 8.7mb 8.7mb yellow open test_index Vh0HutpLRciaMWX3pFo7Zg 1 1 1 0 5.5kb 5.5kb yellow open heartbeat-7.13.2-2021.06.22-000001 LHK787g7S92UFiUXDDrwpQ 1 1 3 0 42.5kb 42.5kb yellow open sshd_fail-2021.06 HiOI2ac-RzK2BiwQ_gb-VQ 1 1 43 0 68.7kb 68.7kb yellow open metricbeat-7.13.2-2021.06.22-000001 aVbbCHScQBujmT8JMRdRBw 1 1 14678 0 8.8mb 8.8mb # document list on the index [root@dlp ~]# curl localhost:9200/heartbeat-7.13.2-2021.06.22-000001/_search?pretty { { "took" : 1, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 5, "relation" : "eq" }, "max_score" : 1.0, "hits" : [ { "_index" : "heartbeat-7.13.2-2021.06.22-000001", "_type" : "_doc", "_id" : "IKImMnoB8xzJeutJLVGI", "_score" : 1.0, "_source" : { "@timestamp" : "2021-06-22T05:16:38.294Z", "observer" : { "ip" : [ "10.0.0.30", "fe80::e38e:e34:9b82:29a2" ], "mac" : [ "52:54:00:76:3b:03" ], "hostname" : "dlp.srv.world" }, "monitor" : { "type" : "http", "timespan" : { "gte" : "2021-06-22T05:16:38.300Z", "lt" : "2021-06-22T05:16:48.300Z" }, "status" : "up", "duration" : { "us" : 6699 }, ..... ..... |
Sponsored Link |