collecting-monitoring-data.asciidoc 7.6 KB

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