configuring-monitoring.asciidoc 5.3 KB

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