Scenario:
Setup Heartbeat for ELK on Docker to ping the given sites to check if they are up.
Solution:
- Create a folder called heartbeat.Inside it add below dockerfile
ARG ELK_VERSION
FROM docker.elastic.co/beats/heartbeat:${ELK_VERSION}
WORKDIR "/usr/share/heartbeat"
# Auto-Create Kibana Heartbeat Dashboard Tables
RUN ./heartbeat setup --dashboards
| |
- Create file heartbeat.yml with following content
heartbeat.monitors:
- type: http
schedule: '@every 60s'
urls:
- http://localsite
- http://google.com
check.request:
method: GET
headers:
'Content-Type': 'application/json'
check.response:
status: 200
output.elasticsearch:
hosts: 'elasticsearch:9200'
setup.kibana:
host: "elasticsearch:5601"
- In docker-compose.yml add below
.....
heartbeat:
build:
context: ./heartbeat
args:
ELK_VERSION: $ELK_VERSION
volumes:
- type: bind
source: ./heartbeat/config/heartbeat.yml
target: /usr/share/heartbeat/heartbeat.yml
read_only: true
environment:
- output.elasticsearch.hosts=["elasticsearch:9200"]
networks:
- elk
depends_on:
- elasticsearch
restart: always
- Please note X-Pack has security which on by default and so by default ES is not accesible with out creds. So to skip that still using trial license disable security by adding to elasticsearch.yml below:
- xpack.security.enabled: false
- Powershell -> docker-compose up -d --force-recreate --no-deps
- Navigate to Kibana -> Uptime to see the metrics.
No comments:
Post a Comment