Menu
Grafana Cloud

Couchbase integration for Grafana Cloud

Couchbase is a distributed NoSQL database which provides high availability, scalability, and performance for large sets of data. This integration for Grafana Cloud allows users to collect metrics and logs from the cluster, node, and bucket levels of a Couchbase clustered deployment.

This integration supports Couchbase 7.0+

This integration includes 4 useful alerts and 3 pre-built dashboards to help monitor and visualize Couchbase metrics and logs.

Before you begin

Couchbase exposes a Prometheus metrics endpoint that is enabled by default.

In order to access this endpoint, configure basic authentication with the credentials of a user with an admin role. For more information on roles in Couchbase, see these docs

Install Couchbase integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find Couchbase and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Couchbase metrics and logs to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your Couchbase setup.

Post-install configuration for the Couchbase integration

You should instruct Grafana Agent to scrape your Couchbase nodes. Couchbase exposes a /metrics endpoint. To scrape it, add the provided config snippet to your agent configuration file. Make sure to change targets in the snippet according to your environment.

If you want to show logs and metrics signals correlated in your dashboards, as a single pane of glass, ensure the following:

  • job, instance, and couchbase_cluster label values must match for metrics and logs scrape config in your agent configuration file.
  • job label must be set to integrations/couchbase (already configured in the snippets).
  • instance label must be set to a value that uniquely identifies your Couchbase node. Please replace the default hostname value according to your environment - it must be set manually.
  • couchbase_cluster label must be set to a value that identifies your Couchbase cluster.

Configuration snippets for Grafana Agent

Below metrics.configs.scrape_configs, insert the following lines and change the URLs according to your environment:

yaml
    - job_name: integrations/couchbase
      basic_auth:
        username: '<cb-cluster-username>'
        password: '<cb-cluster-password>'
      metrics_path: "/metrics"
      relabel_configs:
        - replacement: '<your-instance-name>'
          target_label: instance
        - replacement: '<your-cluster-name>'
          target_label: couchbase_cluster
      static_configs:
        - targets: [<node-hostname>:8091]

Below logs.configs.scrape_configs, insert the following lines according to your environment.

yaml
    - job_name: integrations/couchbase
      static_configs:
        - targets: [localhost]
          labels:
            job: integrations/couchbase
            instance: '<your-instance-name>'
            couchbase_cluster: '<your-cluster-name>'
            __path__: /opt/couchbase/var/lib/couchbase/*.log
      pipeline_stages:
        - drop:
            expression: '---'
        - multiline:
            firstline: '\[(ns_server|couchdb):(error|info),.*\]'

Full example configuration for Grafana Agent

Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the Couchbase integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.

yaml
integrations:
  prometheus_remote_write:
  - basic_auth:
      password: <your_prom_pass>
      username: <your_prom_user>
    url: <your_prom_url>
  agent:
    enabled: true
    relabel_configs:
    - action: replace
      source_labels:
      - agent_hostname
      target_label: instance
    - action: replace
      target_label: job
      replacement: "integrations/agent-check"
    metric_relabel_configs:
    - action: keep
      regex: (prometheus_target_.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
      source_labels:
      - __name__
  # Add here any snippet that belongs to the `integrations` section.
  # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
logs:
  configs:
  - clients:
    - basic_auth:
        password: <your_loki_pass>
        username: <your_loki_user>
      url: <your_loki_url>
    name: integrations
    positions:
      filename: /tmp/positions.yaml
    scrape_configs:
      # Add here any snippet that belongs to the `logs.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
    - job_name: integrations/couchbase
      static_configs:
        - targets: [localhost]
          labels:
            job: integrations/couchbase
            instance: '<your-instance-name>'
            couchbase_cluster: '<your-cluster-name>'
            __path__: /opt/couchbase/var/lib/couchbase/*.log
      pipeline_stages:
        - drop:
            expression: '---'
        - multiline:
            firstline: '\[(ns_server|couchdb):(error|info),.*\]'
metrics:
  configs:
  - name: integrations
    remote_write:
    - basic_auth:
        password: <your_prom_pass>
        username: <your_prom_user>
      url: <your_prom_url>
    scrape_configs:
      # Add here any snippet that belongs to the `metrics.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
    - job_name: integrations/couchbase
      basic_auth:
        username: '<cb-cluster-username>'
        password: '<cb-cluster-password>'
      metrics_path: "/metrics"
      relabel_configs:
        - replacement: '<your-instance-name>'
          target_label: instance
        - replacement: '<your-cluster-name>'
          target_label: couchbase_cluster
      static_configs:
        - targets: [<node-hostname>:8091]
  global:
    scrape_interval: 60s
  wal_directory: /tmp/grafana-agent-wal

Dashboards

The Couchbase integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • Couchbase bucket overview
  • Couchbase cluster overview
  • Couchbase node overview

Couchbase cluster overview (top nodes)

image

Couchbase node overview (memory)

image

Couchbase bucket overview (storage)

image

Alerts

The Couchbase integration includes the following useful alerts:

AlertDescription
CouchbaseHighCPUUsageCritical: The node CPU usage has exceeded the critical threshold.
CouchbaseHighMemoryUsageCritical: There is a limited amount of memory available for a node.
CouchbaseMemoryEvictionRateWarning: There is a spike in evictions in a bucket, which indicates high memory pressure.
CouchbaseInvalidRequestVolumeWarning: There is a high volume of incoming invalid requests, which may indicate a DOS or injection attack.

Metrics

The most important metrics provided by the Couchbase integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

  • backup_data_size
  • cbas_direct_memory_used_bytes
  • cm_http_requests_total
  • couch_docs_actual_disk_size
  • index_avg_scan_latency
  • index_cache_hits
  • index_cache_misses
  • index_memory_used_total
  • index_num_requests
  • kv_curr_connections
  • kv_curr_items
  • kv_ep_num_value_ejects
  • kv_mem_used_bytes
  • kv_num_high_pri_requests
  • kv_num_vbuckets
  • kv_ops
  • kv_ops_failed
  • kv_vb_queue_memory_bytes
  • n1ql_errors
  • n1ql_invalid_requests
  • n1ql_requests
  • n1ql_requests_1000ms
  • n1ql_requests_250ms
  • n1ql_requests_5000ms
  • n1ql_requests_500ms
  • sys_cpu_utilization_rate
  • sys_mem_actual_free
  • sys_mem_actual_used
  • xdcr_data_replicated_bytes
  • xdcr_docs_received_from_dcp_total

Changelog

md
# 0.0.3 - September 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.2 - August 2023

* Add regex filter for logs datasource

# 0.0.1 - July 2023

- Initial release

Cost

By connecting your Couchbase instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.