configuring-monitoring.asciidoc 5.5 KB

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