# Google Cloud Memorystore Redis

> Monitor Google Cloud Memorystore for Redis metrics using OpenTelemetry collector with Last9

Source: https://last9.io/docs/integrations/databases/google-cloud-memorystore-redis/

Use OpenTelemetry to collect Google Cloud Memorystore Redis metrics and send telemetry data to Last9.

## Prerequisites

Before setting up Google Cloud Memorystore Redis monitoring, ensure you have:

- Google Cloud account with administrative privileges or Cloud Redis Admin privileges
- Access to a project in Google Cloud Platform (GCP)
- Google Cloud Redis APIs enabled - follow [this guide](https://cloud.google.com/endpoints/docs/openapi/enable-api) to enable APIs
- Virtual Machine where you can run OpenTelemetry Collector to collect data from Google Cloud Memorystore Redis and send to Last9

1.  **Install OpenTelemetry Collector**

    You can install either `rpm` or `deb` package depending on flavor of operating system you are using.

    > Note: systemd is required for automatic service configuration.

**RPM Package**

    Installing rpm package:

    ```bash
    wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.118.0/otelcol-contrib_0.118.0_linux_amd64.rpm
    sudo rpm -ivh otelcol-contrib_0.118.0_linux_amd64.rpm
    ```

**DEB Package**

    Installing deb package:

    ```bash
    wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.118.0/otelcol-contrib_0.118.0_linux_amd64.deb
    sudo dpkg -i otelcol-contrib_0.118.0_linux_amd64.deb
    ```

    More installation options can be found [here](https://opentelemetry.io/docs/collector/installation/#linux).

2.  **Configure Collector**

    Use the following configuration for Otel Collector:

    ```yaml
    receivers:
      googlecloudmonitoring:
        collection_interval: 60s
        project_id: gcp-project-id
        metrics_list:
          # Filter for specific metrics such cloudredis
          - metric_descriptor_filter: 'metric.type = starts_with("redis.googleapis.com")'

    processors:
      batch:
        timeout: 60s
        send_batch_size: 100000
        send_batch_max_size: 100000
      resourcedetection/gcp:
        detectors: ["gcp"]

    exporters:
      otlp/last9:
        endpoint: "{{ .Logs.WriteURL }}"
        headers:
          "Authorization": "{{ .Logs.AuthValue }}"
      debug:
        verbosity: detailed

    service:
      pipelines:
        metrics:
          receivers: [googlecloudmonitoring]
          processors: [batch, resourcedetection/gcp]
          exporters: [otlp/last9]
    ```

    **Note**: Replace `gcp-project-id` with your actual Google Cloud project ID.

    The complete list of supported metrics can be found [here](https://cloud.google.com/memorystore/docs/cluster/supported-monitoring-metrics?hl=en).

    Read more about the Google Cloud monitoring receiver configuration options [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/googlecloudmonitoringreceiver#configuration).

3.  **Start Collector**

    Run the otel collector using `systemctl` command:

    ```bash
    sudo systemctl start otelcol-contrib
    sudo systemctl status otelcol-contrib
    sudo systemctl restart otelcol-contrib
    ```

4.  **Check Collector Logs**

    Monitor the collector logs to ensure it's working correctly:

    ```bash
    sudo journalctl -u otelcol-contrib -f
    ```

## Verification

To verify the setup is working:

1. Check that the collector service is running
2. Review the collector logs for any errors
3. Log into your Last9 account to confirm Redis metrics are being received

## Need Help?

If you encounter any issues or have questions:

- Join our [Discord community](https://discord.com/channels/652153247672729619/652153247672729621) for real-time support
- Contact our support team at [support@last9.io](mailto:support@last9.io)
