collecting-monitoring-data.asciidoc 7.9 KB

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