Heartbeat - kamialie/knowledge_corner GitHub Wiki

Configuration file at /etc/heartbeat/heartbeat.yml.

To use Elasticsearch as output set the following value:

output.elasticsearch:
  hosts: ["es_host:port"]

It is better to have monitors defined separately, so enable automatic reload and comment out inline configuration (whole heartbeat.monitors section).

heartbeat.config.monitors:
  reload.enabled: true

Simple monitor:

- id: elastic-tcp-monitor
  type: tcp
  hosts: ["localhost"]
  ports: [9200, 5601]
  schedule: "@every 10s"
  • id - unique id in heartbeat instance
  • name (optional) - human readable name
  • type - one of tcp, udp, http
  • schedule - can use keywords like every or cron expression

Elasticsearch health example:

- id: es-health
  type: http
  urls: ["http://localhost:9200/_cluster/health"]
  schedule: "@every 10s"
  check.request:
    method: GET
  check.response:
    status: 200
	json:
	  - description: check status
	    condition:
		  equals:
		    status: green