configuring-monitoring.asciidoc 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. [role="xpack"]
  2. [testenv="gold"]
  3. [[configuring-monitoring]]
  4. == Configuring monitoring in {es}
  5. ++++
  6. <titleabbrev>Configuring monitoring</titleabbrev>
  7. ++++
  8. If you enable the Elastic {monitor-features} in your cluster, you can
  9. optionally collect metrics about {es}. By default, monitoring is enabled but
  10. data collection is disabled.
  11. The following method involves sending the metrics to the monitoring cluster by
  12. using exporters. For an alternative method, see <<configuring-metricbeat>>.
  13. Advanced monitoring settings enable you to control how frequently data is
  14. collected, configure timeouts, and set the retention period for locally-stored
  15. monitoring indices. You can also adjust how monitoring data is displayed.
  16. To learn about monitoring in general, see
  17. {stack-ov}/xpack-monitoring.html[Monitoring the {stack}].
  18. . Configure your cluster to collect monitoring data:
  19. .. Verify that the `xpack.monitoring.enabled` setting is `true`, which is its
  20. default value, on each node in the cluster. For more information, see
  21. <<monitoring-settings>>.
  22. .. Verify that the `xpack.monitoring.elasticsearch.collection.enabled` setting
  23. is `true`, which is its default value, on each node in the cluster.
  24. +
  25. --
  26. NOTE: You can specify this setting in either the `elasticsearch.yml` on each
  27. node or across the cluster as a dynamic cluster setting. If {es}
  28. {security-features} are enabled, you must have `monitor` cluster privileges to
  29. view the cluster settings and `manage` cluster privileges to change them.
  30. For more information, see <<monitoring-settings>> and <<cluster-update-settings>>.
  31. --
  32. .. Set the `xpack.monitoring.collection.enabled` setting to `true` on each
  33. node in the cluster. By default, it is is disabled (`false`).
  34. +
  35. --
  36. NOTE: You can specify this setting in either the `elasticsearch.yml` on each
  37. node or across the cluster as a dynamic cluster setting. If {es}
  38. {security-features} are enabled, you must have `monitor` cluster privileges to
  39. view the cluster settings and `manage` cluster privileges to change them.
  40. For example, use the following APIs to review and change this setting:
  41. [source,js]
  42. ----------------------------------
  43. GET _cluster/settings
  44. PUT _cluster/settings
  45. {
  46. "persistent": {
  47. "xpack.monitoring.collection.enabled": true
  48. }
  49. }
  50. ----------------------------------
  51. // CONSOLE
  52. For more
  53. information, see <<monitoring-settings>> and <<cluster-update-settings>>.
  54. --
  55. .. Optional: Specify which indices you want to monitor.
  56. +
  57. --
  58. By default, the monitoring agent collects data from all {es} indices.
  59. To collect data from particular indices, configure the
  60. `xpack.monitoring.collection.indices` setting. You can specify multiple indices
  61. as a comma-separated list or use an index pattern to match multiple indices. For
  62. example:
  63. [source,yaml]
  64. ----------------------------------
  65. xpack.monitoring.collection.indices: logstash-*, index1, test2
  66. ----------------------------------
  67. You can prepend `+` or `-` to explicitly include or exclude index names or
  68. patterns. For example, to include all indices that start with `test` except
  69. `test3`, you could specify `+test*,-test3`.
  70. --
  71. .. Optional: Specify how often to collect monitoring data. The default value for
  72. the `xpack.monitoring.collection.interval` setting 10 seconds. See
  73. <<monitoring-settings>>.
  74. . Identify where to store monitoring data.
  75. +
  76. --
  77. By default, the data is stored on the same cluster by using a
  78. <<local-exporter,`local` exporter>>.
  79. Alternatively, you can use an <<http-exporter,`http` exporter>> to send data to
  80. a separate _monitoring cluster_.
  81. For more information about typical monitoring architectures,
  82. see {stack-ov}/how-monitoring-works.html[How Monitoring Works].
  83. --
  84. . If you choose to use an `http` exporter:
  85. .. On the cluster that you want to monitor (often called the _production cluster_),
  86. configure each node to send metrics to your monitoring cluster. Configure an
  87. HTTP exporter in the `xpack.monitoring.exporters` settings in the
  88. `elasticsearch.yml` file. For example:
  89. +
  90. --
  91. [source,yaml]
  92. --------------------------------------------------
  93. xpack.monitoring.exporters:
  94. id1:
  95. type: http
  96. host: ["http://es-mon-1:9200", "http://es-mon2:9200"]
  97. --------------------------------------------------
  98. --
  99. .. If the Elastic {security-features} are enabled on the monitoring cluster, you
  100. must provide appropriate credentials when data is shipped to the monitoring cluster:
  101. ... Create a user on the monitoring cluster that has the
  102. {stack-ov}/built-in-roles.html[`remote_monitoring_agent` built-in role].
  103. Alternatively, use the
  104. {stack-ov}/built-in-users.html[`remote_monitoring_user` built-in user].
  105. ... Add the user ID and password settings to the HTTP exporter settings in the
  106. `elasticsearch.yml` file on each node. +
  107. +
  108. --
  109. For example:
  110. [source,yaml]
  111. --------------------------------------------------
  112. xpack.monitoring.exporters:
  113. id1:
  114. type: http
  115. host: ["http://es-mon-1:9200", "http://es-mon2:9200"]
  116. auth.username: remote_monitoring_user
  117. auth.password: YOUR_PASSWORD
  118. --------------------------------------------------
  119. --
  120. .. If you configured the monitoring cluster to use
  121. <<configuring-tls,encrypted communications>>, you must use the HTTPS protocol in
  122. the `host` setting. You must also specify the trusted CA certificates that will
  123. be used to verify the identity of the nodes in the monitoring cluster.
  124. *** To add a CA certificate to an {es} node's trusted certificates, you can
  125. specify the location of the PEM encoded certificate with the
  126. `certificate_authorities` setting. For example:
  127. +
  128. --
  129. [source,yaml]
  130. --------------------------------------------------
  131. xpack.monitoring.exporters:
  132. id1:
  133. type: http
  134. host: ["https://es-mon1:9200", "https://es-mon2:9200"]
  135. auth:
  136. username: remote_monitoring_user
  137. password: YOUR_PASSWORD
  138. ssl:
  139. certificate_authorities: [ "/path/to/ca.crt" ]
  140. --------------------------------------------------
  141. --
  142. *** Alternatively, you can configure trusted certificates using a truststore
  143. (a Java Keystore file that contains the certificates). For example:
  144. +
  145. --
  146. [source,yaml]
  147. --------------------------------------------------
  148. xpack.monitoring.exporters:
  149. id1:
  150. type: http
  151. host: ["https://es-mon1:9200", "https://es-mon2:9200"]
  152. auth:
  153. username: remote_monitoring_user
  154. password: YOUR_PASSWORD
  155. ssl:
  156. truststore.path: /path/to/file
  157. truststore.password: password
  158. --------------------------------------------------
  159. --
  160. . Configure your cluster to route monitoring data from sources such as {kib},
  161. Beats, and {ls} to the monitoring cluster. The
  162. `xpack.monitoring.collection.enabled` setting must be `true` on each node in the
  163. cluster. For information about configuring each product to collect and send
  164. monitoring data, see {stack-ov}/xpack-monitoring.html[Monitoring the {stack}].
  165. . If you updated settings in the `elasticsearch.yml` files on your production
  166. cluster, restart {es}. See <<stopping-elasticsearch>> and <<starting-elasticsearch>>.
  167. +
  168. --
  169. TIP: You may want to temporarily {ref}/modules-cluster.html[disable shard
  170. allocation] before you restart your nodes to avoid unnecessary shard
  171. reallocation during the install process.
  172. --
  173. . Optional:
  174. <<config-monitoring-indices,Configure the indices that store the monitoring data>>.
  175. . {kibana-ref}/monitoring-data.html[View the monitoring data in {kib}].
  176. include::configuring-metricbeat.asciidoc[]
  177. include::indices.asciidoc[]
  178. include::{es-repo-dir}/settings/monitoring-settings.asciidoc[]