configuring-monitoring.asciidoc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. [role="xpack"]
  2. [testenv="gold"]
  3. [[configuring-monitoring]]
  4. == Configuring monitoring in {es}
  5. ++++
  6. <titleabbrev>Configuring monitoring</titleabbrev>
  7. ++++
  8. If you enable the collection of monitoring data in your cluster, you can
  9. optionally collect metrics about {es}. By default, {monitoring} is enabled but
  10. data collection is disabled.
  11. The following method involves sending the metrics to the monitoring cluster by
  12. using exporters. For an alternative method, see <<configuring-metricbeat>>.
  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
  17. {stack-ov}/xpack-monitoring.html[Monitoring the {stack}].
  18. . To collect monitoring data about your {es} cluster:
  19. .. Verify that the `xpack.monitoring.enabled`,
  20. `xpack.monitoring.collection.enabled`, and
  21. `xpack.monitoring.elasticsearch.collection.enabled` settings are `true` on each
  22. node in the cluster. By default `xpack.monitoring.collection.enabled` is disabled
  23. (`false`), and that overrides `xpack.monitoring.elasticsearch.collection.enabled`,
  24. which defaults to being enabled (`true`). Both settings can be set dynamically
  25. at runtime. For more information, see <<monitoring-settings>>.
  26. .. Optional: Specify which indices you want to monitor.
  27. +
  28. --
  29. By default, the monitoring agent collects data from all {es} indices.
  30. To collect data from particular indices, configure the
  31. `xpack.monitoring.collection.indices` setting. You can specify multiple indices
  32. as a comma-separated list or use an index pattern to match multiple indices. For
  33. example:
  34. [source,yaml]
  35. ----------------------------------
  36. xpack.monitoring.collection.indices: logstash-*, index1, test2
  37. ----------------------------------
  38. You can prepend `+` or `-` to explicitly include or exclude index names or
  39. patterns. For example, to include all indices that start with `test` except
  40. `test3`, you could specify `+test*,-test3`.
  41. --
  42. .. Optional: Specify how often to collect monitoring data. The default value for
  43. the `xpack.monitoring.collection.interval` setting 10 seconds. See
  44. <<monitoring-settings>>.
  45. . Optional: Configure your cluster to route monitoring data from sources such
  46. as {kib}, Beats, and Logstash to a monitoring cluster:
  47. .. Verify that `xpack.monitoring.collection.enabled` settings are `true` on each
  48. node in the cluster.
  49. .. {stack-ov}/xpack-monitoring.html[Configure {monitoring} across the Elastic Stack].
  50. . Identify where to store monitoring data.
  51. +
  52. --
  53. By default, {monitoring} uses a `local` exporter that indexes monitoring data
  54. on the same cluster. See <<es-monitoring-default-exporter>> and <<local-exporter>>.
  55. Alternatively, you can use an `http` exporter to send data to a separate
  56. monitoring cluster. See <<http-exporter>>.
  57. For more information about typical monitoring architectures,
  58. see {stack-ov}/how-monitoring-works.html[How Monitoring Works].
  59. --
  60. . If {security} is enabled and you are using an `http` exporter to send data to
  61. a dedicated monitoring cluster:
  62. .. Create a user on the monitoring cluster that has the
  63. {stack-ov}/built-in-roles.html#built-in-roles-remote-monitoring-agent[`remote_monitoring_agent` built-in role].
  64. For example, the following request creates a `remote_monitor` user that has the
  65. `remote_monitoring_agent` role:
  66. +
  67. --
  68. [source, sh]
  69. ---------------------------------------------------------------
  70. POST /_xpack/security/user/remote_monitor
  71. {
  72. "password" : "changeme",
  73. "roles" : [ "remote_monitoring_agent"],
  74. "full_name" : "Internal Agent For Remote Monitoring"
  75. }
  76. ---------------------------------------------------------------
  77. // CONSOLE
  78. // TEST[skip:needs-gold+-license]
  79. --
  80. .. On each node in the cluster that is being monitored, configure the `http`
  81. exporter to use the appropriate credentials when data is shipped to the
  82. monitoring cluster.
  83. +
  84. --
  85. If SSL/TLS is enabled on the monitoring cluster, you must use the HTTPS protocol
  86. in the `host` setting. You must also include the CA certificate in each node's
  87. trusted certificates in order to verify the identities of the nodes in the
  88. monitoring cluster.
  89. The following example specifies the location of the PEM encoded certificate with
  90. the `certificate_authorities` setting:
  91. [source,yaml]
  92. --------------------------------------------------
  93. xpack.monitoring.exporters:
  94. id1:
  95. type: http
  96. host: ["https://es-mon1:9200", "https://es-mon2:9200"]
  97. auth:
  98. username: remote_monitor <1>
  99. password: changeme
  100. ssl:
  101. certificate_authorities: [ "/path/to/ca.crt" ]
  102. id2:
  103. type: local
  104. --------------------------------------------------
  105. <1> The `username` and `password` parameters provide the user credentials.
  106. Alternatively, you can configure trusted certificates using a truststore
  107. (a Java Keystore file that contains the certificates):
  108. [source,yaml]
  109. --------------------------------------------------
  110. xpack.monitoring.exporters:
  111. id1:
  112. type: http
  113. host: ["https://es-mon1:9200", "https://es-mon2:9200"]
  114. auth:
  115. username: remote_monitor
  116. password: changeme
  117. ssl:
  118. truststore.path: /path/to/file
  119. truststore.password: password
  120. id2:
  121. type: local
  122. --------------------------------------------------
  123. --
  124. . If {security} is enabled and you want to visualize monitoring data in {kib},
  125. you must create users that have access to the {kib} indices and permission to
  126. read from the monitoring indices.
  127. +
  128. --
  129. You set up {monitoring} UI users on the cluster where the monitoring data is
  130. stored, that is to say the monitoring cluster. To grant all of the necessary permissions, assign users the
  131. `monitoring_user` and `kibana_user` roles. For more information, see
  132. {stack-ov}/mapping-roles.html[Mapping users and groups to roles].
  133. --
  134. . Optional:
  135. <<config-monitoring-indices,Configure the indices that store the monitoring data>>.
  136. . {kibana-ref}/monitoring-data.html[View the monitoring data in {kib}].
  137. include::configuring-metricbeat.asciidoc[]
  138. include::indices.asciidoc[]
  139. include::{es-repo-dir}/settings/monitoring-settings.asciidoc[]