collecting-monitoring-data.asciidoc 7.8 KB

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