To configure Heartbeat, you edit the configuration file. The default
configuration file is called
heartbeat.yml. The location of the file
varies by platform. To locate the file, see Directory layout.
There’s also a full example configuration file called
that shows all non-deprecated options.
See the Config File Format section of the Beats Platform Reference for more about the structure of the config file.
Heartbeat provides monitors to check the status of hosts at set intervals.
You configure each monitor individually. Heartbeat currently provides monitors
for ICMP, TCP, and HTTP (see Overview for more about these
monitors). Here is an example that configures Heartbeat to use an
heartbeat.monitors: - type: icmp schedule: '*/5 * * * * * *' hosts: ["myhost"] output.elasticsearch: hosts: ["myEShost:9200"]
To configure Heartbeat:
Specify the list of monitors that you want to enable. Each item in the list begins with a dash (-). The following example configures Heartbeat to use two monitors, an
icmpmonitor and a
icmpmonitor is scheduled to run exactly every 5 seconds (10:00:00, 10:00:05, and so on). The
scheduleoption uses a cron-like syntax based on this
tcpmonitor is set to run every 5 seconds from the time when Heartbeat was started. Heartbeat adds the
@everykeyword to the syntax provided by the
modespecifies whether to ping one IP (
any) or all resolvable IPs (
See Configure for a full description of each configuration option.
Configure the output. Heartbeat supports a variety of outputs, but typically you’ll either send events directly to Elasticsearch, or to Logstash for additional processing.
To send output directly to Elasticsearch (without using Logstash), set the location of the Elasticsearch installation:
If you’re running Elasticsearch on your own hardware, set the host and port where Heartbeat can find the Elasticsearch installation. For example:
output.elasticsearch: hosts: ["myEShost:9200"]
If you plan to use the sample Kibana dashboards provided with Heartbeat, configure the Kibana endpoint. You can skip this step if Kibana is running on the same host as Elasticsearch.
If Elasticsearch and Kibana are secured, set credentials in the
heartbeat.ymlconfig file before you run the commands that set up and start Heartbeat.
If you’re running Elasticsearch on your own hardware, specify your Elasticsearch and Kibana credentials:
This examples shows a hard-coded password, but you should store sensitive values in the secrets keystore.
passwordsettings for Kibana are optional. If you don’t specify credentials for Kibana, Heartbeat uses the
passwordspecified for the Elasticsearch output.
To use the pre-built Kibana dashboards, this user must have the
kibana_userbuilt-in role or equivalent privileges.
For more information, see Secure.
To test your configuration file, change to the directory where the
Heartbeat binary is installed, and run Heartbeat in the foreground with
the following options specified:
./heartbeat test config -e. Make sure your
config files are in the path expected by Heartbeat (see Directory layout),
or use the
-c flag to specify the path to the config file.
For more information about configuring Heartbeat, see Configure.