2018-11-28 15:36:29 -05:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="gold"]
|
|
|
|
[[collecting-monitoring-data]]
|
2020-06-11 13:16:53 -04:00
|
|
|
== Collecting monitoring data using legacy collectors
|
|
|
|
++++
|
|
|
|
<titleabbrev>Legacy collection methods</titleabbrev>
|
|
|
|
++++
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
[IMPORTANT]
|
|
|
|
=========================
|
|
|
|
{metricbeat} is the recommended method for collecting and shipping monitoring
|
|
|
|
data to a monitoring cluster.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2020-06-11 13:16:53 -04:00
|
|
|
If you have previously configured legacy collection methods, you should migrate
|
|
|
|
to using {metricbeat} collection methods. Use either {metricbeat} collection or
|
|
|
|
legacy collection methods; do not use both.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
Learn more about <<configuring-metricbeat>>.
|
|
|
|
=========================
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2020-08-31 16:14:33 -04:00
|
|
|
This method for collecting metrics about {es} involves sending the metrics to
|
|
|
|
the monitoring cluster by using exporters. For the recommended method, see <<configuring-metricbeat>>.
|
2019-12-02 16:31:47 -05:00
|
|
|
|
|
|
|
Advanced monitoring settings enable you to control how frequently data is
|
|
|
|
collected, configure timeouts, and set the retention period for locally-stored
|
|
|
|
monitoring indices. You can also adjust how monitoring data is displayed.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
To learn about monitoring in general, see <<monitor-elasticsearch-cluster>>.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
|
|
|
. Configure your cluster to collect monitoring data:
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
.. Verify that the `xpack.monitoring.elasticsearch.collection.enabled` setting
|
|
|
|
is `true`, which is its default value, on each node in the cluster.
|
2018-11-28 15:36:29 -05:00
|
|
|
+
|
|
|
|
--
|
2019-12-02 16:31:47 -05:00
|
|
|
NOTE: You can specify this setting in either the `elasticsearch.yml` on each
|
|
|
|
node or across the cluster as a dynamic cluster setting. If {es}
|
|
|
|
{security-features} are enabled, you must have `monitor` cluster privileges to
|
2018-11-28 15:36:29 -05:00
|
|
|
view the cluster settings and `manage` cluster privileges to change them.
|
|
|
|
|
|
|
|
For more information, see <<monitoring-settings>> and <<cluster-update-settings>>.
|
|
|
|
--
|
|
|
|
|
|
|
|
.. Set the `xpack.monitoring.collection.enabled` setting to `true` on each
|
2019-12-02 16:31:47 -05:00
|
|
|
node in the cluster. By default, it is is disabled (`false`).
|
|
|
|
+
|
2018-11-28 15:36:29 -05:00
|
|
|
--
|
2019-12-02 16:31:47 -05:00
|
|
|
NOTE: You can specify this setting in either the `elasticsearch.yml` on each
|
|
|
|
node or across the cluster as a dynamic cluster setting. If {es}
|
|
|
|
{security-features} are enabled, you must have `monitor` cluster privileges to
|
2018-11-28 15:36:29 -05:00
|
|
|
view the cluster settings and `manage` cluster privileges to change them.
|
|
|
|
|
|
|
|
For example, use the following APIs to review and change this setting:
|
|
|
|
|
2019-09-09 12:35:50 -04:00
|
|
|
[source,console]
|
2018-11-28 15:36:29 -05:00
|
|
|
----------------------------------
|
|
|
|
GET _cluster/settings
|
|
|
|
|
|
|
|
PUT _cluster/settings
|
|
|
|
{
|
|
|
|
"persistent": {
|
|
|
|
"xpack.monitoring.collection.enabled": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
----------------------------------
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
Alternatively, you can enable this setting in {kib}. In the side navigation,
|
|
|
|
click *Monitoring*. If data collection is disabled, you are prompted to turn it
|
|
|
|
on.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
For more
|
2018-11-28 15:36:29 -05:00
|
|
|
information, see <<monitoring-settings>> and <<cluster-update-settings>>.
|
|
|
|
--
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
.. Optional: Specify which indices you want to monitor.
|
2018-11-28 15:36:29 -05:00
|
|
|
+
|
|
|
|
--
|
|
|
|
By default, the monitoring agent collects data from all {es} indices.
|
|
|
|
To collect data from particular indices, configure the
|
2019-12-02 16:31:47 -05:00
|
|
|
`xpack.monitoring.collection.indices` setting. You can specify multiple indices
|
|
|
|
as a comma-separated list or use an index pattern to match multiple indices. For
|
2018-11-28 15:36:29 -05:00
|
|
|
example:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
----------------------------------
|
|
|
|
xpack.monitoring.collection.indices: logstash-*, index1, test2
|
|
|
|
----------------------------------
|
|
|
|
|
2019-01-10 18:06:44 -05:00
|
|
|
You can prepend `-` to explicitly exclude index names or
|
2019-12-02 16:31:47 -05:00
|
|
|
patterns. For example, to include all indices that start with `test` except
|
2019-01-10 18:06:44 -05:00
|
|
|
`test3`, you could specify `test*,-test3`. To include system indices such as
|
|
|
|
.security and .kibana, add `.*` to the list of included names.
|
|
|
|
For example `.*,test*,-test3`
|
2018-11-28 15:36:29 -05:00
|
|
|
--
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
.. Optional: Specify how often to collect monitoring data. The default value for
|
|
|
|
the `xpack.monitoring.collection.interval` setting 10 seconds. See
|
2018-11-28 15:36:29 -05:00
|
|
|
<<monitoring-settings>>.
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
. Identify where to store monitoring data.
|
2018-11-28 15:36:29 -05:00
|
|
|
+
|
|
|
|
--
|
2019-12-02 16:31:47 -05:00
|
|
|
By default, the data is stored on the same cluster by using a
|
|
|
|
<<local-exporter,`local` exporter>>. Alternatively, you can use an <<http-exporter,`http` exporter>> to send data to
|
|
|
|
a separate _monitoring cluster_.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2018-12-17 11:18:11 -05:00
|
|
|
IMPORTANT: The {es} {monitor-features} use ingest pipelines, therefore the
|
2019-12-02 16:31:47 -05:00
|
|
|
cluster that stores the monitoring data must have at least one
|
|
|
|
<<ingest,ingest node>>.
|
2018-12-17 11:18:11 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
For more information about typical monitoring architectures,
|
2019-09-27 17:58:10 -04:00
|
|
|
see <<how-monitoring-works>>.
|
2018-11-28 15:36:29 -05:00
|
|
|
--
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
. If you choose to use an `http` exporter:
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
.. On the cluster that you want to monitor (often called the _production cluster_),
|
|
|
|
configure each node to send metrics to your monitoring cluster. Configure an
|
|
|
|
HTTP exporter in the `xpack.monitoring.exporters` settings in the
|
2018-11-28 15:36:29 -05:00
|
|
|
`elasticsearch.yml` file. For example:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.exporters:
|
|
|
|
id1:
|
|
|
|
type: http
|
2019-12-02 16:31:47 -05:00
|
|
|
host: ["http://es-mon-1:9200", "http://es-mon2:9200"]
|
2018-11-28 15:36:29 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
--
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
.. If the Elastic {security-features} are enabled on the monitoring cluster, you
|
2018-11-28 15:36:29 -05:00
|
|
|
must provide appropriate credentials when data is shipped to the monitoring cluster:
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
... Create a user on the monitoring cluster that has the
|
|
|
|
<<built-in-roles,`remote_monitoring_agent` built-in role>>.
|
|
|
|
Alternatively, use the
|
2019-10-07 18:23:19 -04:00
|
|
|
<<built-in-users,`remote_monitoring_user` built-in user>>.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
... Add the user ID and password settings to the HTTP exporter settings in the
|
2018-11-28 15:36:29 -05:00
|
|
|
`elasticsearch.yml` file on each node. +
|
|
|
|
+
|
|
|
|
--
|
|
|
|
For example:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.exporters:
|
|
|
|
id1:
|
|
|
|
type: http
|
2019-12-02 16:31:47 -05:00
|
|
|
host: ["http://es-mon-1:9200", "http://es-mon2:9200"]
|
|
|
|
auth.username: remote_monitoring_user
|
2018-11-28 15:36:29 -05:00
|
|
|
auth.password: YOUR_PASSWORD
|
|
|
|
--------------------------------------------------
|
|
|
|
--
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
.. If you configured the monitoring cluster to use
|
|
|
|
<<configuring-tls,encrypted communications>>, you must use the HTTPS protocol in
|
|
|
|
the `host` setting. You must also specify the trusted CA certificates that will
|
|
|
|
be used to verify the identity of the nodes in the monitoring cluster.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
*** To add a CA certificate to an {es} node's trusted certificates, you can
|
|
|
|
specify the location of the PEM encoded certificate with the
|
2018-11-28 15:36:29 -05:00
|
|
|
`certificate_authorities` setting. For example:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.exporters:
|
|
|
|
id1:
|
|
|
|
type: http
|
2019-12-02 16:31:47 -05:00
|
|
|
host: ["https://es-mon1:9200", "https://es-mon2:9200"]
|
2018-11-28 15:36:29 -05:00
|
|
|
auth:
|
|
|
|
username: remote_monitoring_user
|
|
|
|
password: YOUR_PASSWORD
|
|
|
|
ssl:
|
|
|
|
certificate_authorities: [ "/path/to/ca.crt" ]
|
|
|
|
--------------------------------------------------
|
|
|
|
--
|
|
|
|
|
|
|
|
*** Alternatively, you can configure trusted certificates using a truststore
|
|
|
|
(a Java Keystore file that contains the certificates). For example:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.exporters:
|
|
|
|
id1:
|
|
|
|
type: http
|
|
|
|
host: ["https://es-mon1:9200", "https://es-mon2:9200"]
|
|
|
|
auth:
|
|
|
|
username: remote_monitoring_user
|
|
|
|
password: YOUR_PASSWORD
|
|
|
|
ssl:
|
|
|
|
truststore.path: /path/to/file
|
|
|
|
truststore.password: password
|
|
|
|
--------------------------------------------------
|
|
|
|
--
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
. Configure your cluster to route monitoring data from sources such as {kib},
|
2018-11-28 15:36:29 -05:00
|
|
|
Beats, and {ls} to the monitoring cluster. For information about configuring
|
2019-10-07 18:23:19 -04:00
|
|
|
each product to collect and send monitoring data, see <<monitor-elasticsearch-cluster>>.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
. If you updated settings in the `elasticsearch.yml` files on your production
|
|
|
|
cluster, restart {es}. See <<stopping-elasticsearch>> and <<starting-elasticsearch>>.
|
2018-11-28 15:36:29 -05:00
|
|
|
+
|
|
|
|
--
|
|
|
|
TIP: You may want to temporarily {ref}/modules-cluster.html[disable shard
|
|
|
|
allocation] before you restart your nodes to avoid unnecessary shard
|
|
|
|
reallocation during the install process.
|
|
|
|
|
|
|
|
--
|
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
. Optional:
|
|
|
|
<<config-monitoring-indices,Configure the indices that store the monitoring data>>.
|
2018-11-28 15:36:29 -05:00
|
|
|
|
2019-12-02 16:31:47 -05:00
|
|
|
. {kibana-ref}/monitoring-data.html[View the monitoring data in {kib}].
|