collecting-monitoring-data.asciidoc 8.0 KB

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