Collecting Kibana monitoring data with Metricbeat

edit

Collecting Kibana monitoring data with Metricbeat

edit

In 6.4 and later, you can use Metricbeat to collect data about Kibana and ship it to the monitoring cluster, rather than routing it through the production cluster as described in Collecting monitoring data.

Example monitoring architecture

To learn about monitoring in general, see Monitor a cluster.

  1. Disable the default collection of Kibana monitoring metrics.

    Add the following setting in the Kibana configuration file (kibana.yml):

    xpack.monitoring.kibana.collection.enabled: false

    Leave the xpack.monitoring.enabled set to its default value (true).

    For more information, see Monitoring settings in Kibana.

  2. Start Kibana.
  3. Set the xpack.monitoring.collection.enabled setting to true on each node in the production cluster. By default, it is disabled (false).

    You can specify this setting in either the elasticsearch.yml on each node or across the cluster as a dynamic cluster setting. If Elasticsearch security features are enabled, you must have monitor cluster privileges to view the cluster settings and manage cluster privileges to change them.

    • In Kibana:

      1. Open Kibana in your web browser.

        If you are running Kibana locally, go to http://localhost:5601/.

        If the Elastic security features are enabled, log in.

      2. In the side navigation, click Monitoring. If data collection is disabled, you are prompted to turn it on.
    • From the Console or command line, set xpack.monitoring.collection.enabled to true on the production cluster.

      For example, you can use the following APIs to review and change this setting:

      GET _cluster/settings
      
      PUT _cluster/settings
      {
        "persistent": {
          "xpack.monitoring.collection.enabled": true
        }
      }

      For more information, see Monitoring settings in Elasticsearch and Cluster update settings.

  4. Install Metricbeat on the same server as Kibana.
  5. Enable the Kibana module in Metricbeat.

    For example, to enable the default configuration in the modules.d directory, run the following command:

    metricbeat modules enable kibana

    For more information, see Specify which modules to run and Kibana module.

  6. Configure the Kibana module in Metricbeat.

    For example, specify the following settings in the modules.d/kibana.yml file:

    - module: kibana
      metricsets:
        - stats
      period: 10s
      hosts: ["http://localhost:5601"]
      xpack.enabled: true
      #username: "user"
      #password: "secret"

    By default, the module collects Kibana monitoring metrics from localhost:5601. If the host and port number are not correct, you must update the hosts setting. . If you configured Kibana to use encrypted communications, you must access it via HTTPS. For example, use a hosts setting like https://localhost:5601.

    If the Elastic security features are enabled, you must also provide a user ID and password so that Metricbeat can collect metrics successfully.

    1. Create a user on the production cluster that has the remote_monitoring_collector built-in role. Alternatively, use the remote_monitoring_user built-in user.
    2. Add the username and password settings to the Kibana module configuration file.
  7. Optional: Disable the system module in Metricbeat.

    By default, the system module is enabled. The information it collects, however, is not shown on the Monitoring page in Kibana. Unless you want to use that information for other purposes, run the following command:

    metricbeat modules disable system
  8. Identify where to send the monitoring data.

    In production environments, we strongly recommend using a separate cluster (referred to as the monitoring cluster) to store the data. Using a separate monitoring cluster prevents production cluster outages from impacting your ability to access your monitoring data. It also prevents monitoring activities from impacting the performance of your production cluster.

    For example, specify the Elasticsearch output information in the Metricbeat configuration file (metricbeat.yml):

    output.elasticsearch:
      # Array of hosts to connect to.
      hosts: ["http://es-mon-1:9200", "http://es-mon2:9200"] 
    
      # Optional protocol and basic auth credentials.
      #protocol: "https"
      #username: "elastic"
      #password: "changeme"

    In this example, the data is stored on a monitoring cluster with nodes es-mon-1 and es-mon-2.

    If you configured the monitoring cluster to use encrypted communications, you must access it via HTTPS. For example, use a hosts setting like https://es-mon-1:9200.

    The Elasticsearch monitoring features use ingest pipelines, therefore the cluster that stores the monitoring data must have at least one ingest node.

    If the Elasticsearch security features are enabled on the monitoring cluster, you must provide a valid user ID and password so that Metricbeat can send metrics successfully.

    1. Create a user on the monitoring cluster that has the remote_monitoring_agent built-in role. Alternatively, use the remote_monitoring_user built-in user.
    2. Add the username and password settings to the Elasticsearch output information in the Metricbeat configuration file.

    For more information about these configuration options, see Configure the Elasticsearch output.

  9. Start Metricbeat.
  10. View the monitoring data in Kibana.