collecting-monitoring-data.asciidoc 7.4 KB

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