collecting-monitoring-data.asciidoc 7.6 KB

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