Skip to content

Commit

Permalink
Added new documentation : [GCP CLB Metrics via Telegraf] (#663)
Browse files Browse the repository at this point in the history
* Added new documentation : [GCP CLB Metrics via Telegraf]

* fix description

---------

Co-authored-by: CheetoDa <[email protected]>
  • Loading branch information
sudhanshu456 and Calm-Rock authored Sep 2, 2024
1 parent 32b02b8 commit a8cdef7
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 0 deletions.
13 changes: 13 additions & 0 deletions constants/docsSideNav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,19 @@ const docsSideNav = [
}
],
},
{
type: 'category',
isExpanded: false,
label: 'Cloud Load Balancer',
route: '/docs/gcp-monitoring/gcp-clb',
items: [
{
type: 'doc',
route: '/docs/gcp-monitoring/gcp-clb/metrics',
label: 'Metrics',
}
],
},
],
},
{
Expand Down
15 changes: 15 additions & 0 deletions data/docs/gcp-monitoring/gcp-clb.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
date: 2024-08-21
id: gcp-clb
title: GCP Cloud Load Balancer
---

<DocCardContainer>

<DocCard
title="📄️ Metrics"
description="This document provides a detailed walkthrough on how to send Google Cloud Load Balancer metrics to SigNoz."
href="/docs/gcp-monitoring/gcp-clb/metrics/"
/>

</DocCardContainer>
349 changes: 349 additions & 0 deletions data/docs/gcp-monitoring/gcp-clb/metrics.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
---
date: 2024-08-14
id: metrics
title: Cloud Load Balancer Metrics
hide_table_of_contents: true
---

## Overview

This document provides a detailed walkthrough on how to send Google Cloud Load Balancer metrics to SigNoz. By the end of this guide, you will have a setup that sends your Cloud Load Balancer metrics to SigNoz.

<Tabs>
<TabItem value="cloud" label="SigNoz Cloud" default>

**Here's a quick summary of what we will be doing in this guide**

* Deploy Telegraf to fetch the metrics from Google Cloud monitoring.
* Deploy OpenTelemetry to scrape the metrics from Telegraf.
* Send and Visualize the metrics obtained by OpenTelemetry in SigNoz

## Prerequisites

* You should have a [Google Cloud account](https://console.cloud.google.com/) with administrative privileges or Cloud Load Balancer Admin privileges both should suffice.
* Cloud Load Balancer
* A [SigNoz Cloud account](https://signoz.io/teams/). You'll need the ingestion details. To obtain your Ingestion Key and URL, log in to your SigNoz Cloud account and navigate to Settings >> Ingestion Settings.
* Access to a project in Google Cloud Platform (GCP).
* The Google Cloud Load Balancer APIs must be enabled. You can follow [this](https://support.google.com/googleapi/answer/6158841?hl=en) guide to learn how to enable an API in Google Cloud.

## Setup

### Deploy Telegraf to fetch the metrics from Google Cloud Monitoring.

**Step 1:** Install [`telegraf`](https://github.com/influxdata/telegraf), which will collect metrics from Google Cloud Monitoring for Cloud Load Balancer, see the [available metrics for load balancer.](https://cloud.google.com/monitoring/api/metrics_gcp#gcp-loadbalancing) The installation process for the respective operating system can be found in official [documentation](https://docs.influxdata.com/telegraf/v1/install/).

After successful installation, the `telegraf` status should be active and running.

<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/telegraf.webp"
alt="Running telegraf"
/>
<figcaption>
<i>
Running telegraf
</i>
</figcaption>
</figure>

The configuration file for telegraf can be found here:

```sh
/etc/telegraf/telegraf.conf
```

**Step 2:** Configure the Telegraf input and output plugin by adding configurations to the `telegraf.conf` file.

### Gather timeseries from Google Cloud Platform v3 monitoring API

```sh
[[inputs.stackdriver]]

## GCP Project

project = "omni-new"

## Include timeseries that start with the given metric type.

metric_type_prefix_include = [

"loadbalancing.googleapis.com",

]

## Most metrics are updated no more than once per minute; it is recommended

## to override the agent level interval with a 1m or greater value.

interval = "1m"

# Send OpenTelemetry metrics over gRPC

[[outputs.opentelemetry]]

## Override the default (localhost:4317) OpenTelemetry gRPC service

## address:port

service_address = "localhost:4317"

```

### Deploy OpenTelemetry to scrape the metrics from Telegraf

**Step 1:** Install and configure OpenTelemetry for scraping the metrics from Telegraf. Follow [OpenTelemetry Binary Usage in Virtual Machine](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) guide for detailed instructions.

**Step 2:** After successful configuration, start the OTel Collector using the following command:

```sh
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
```

**Step 3:** Restart the Telegraf service

```sh
sudo service telegraf restart
```

**Step 4:** If the configurations are configured correctly with Telegraf we can see the output logs from OpenTelemtery as follows:

<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/otel-logs-cloud.webp"
alt="OpenTelemetry logs"
/>
<figcaption>
<i>
OpenTelemetry logs
</i>
</figcaption>
</figure>

### Send and Visualize the metrics obtained by OpenTelemetry in SigNoz

**Step 1:** Go to the SigNoz Cloud URL and head over to the dashboard.

**Step 2:** If not already created, create a new dashboard and select Time Series.


<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/new-dashboard.webp"
alt="Create dashboard in SigNoz"
/>
<figcaption>
<i>
Create dashboard in SigNoz
</i>
</figcaption>
</figure>

**Step 3:** Select the metric for the cloud load balancer.

For example `loadbalancing_googleapis_com_https_frontend_tcp_rtt_count` is one of the metrics that was collected.

<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/metrics-in-dashboard-cloud.webp"
alt="Detailed view of the selected metric"
/>
<figcaption>
<i>
Detailed view of the selected metric
</i>
</figcaption>
</figure>

## Troubleshooting

If you run into any problems while setting up monitoring for your Cloud Load Balancer metrics with SigNoz, consider these troubleshooting steps:

* **Verify Configuration**: Double-check your `config.yaml` file to ensure all settings, including the ingestion key and endpoint, are correct.
* **Review Logs**: Look at the logs of your Cloud Load Balancer and the OpenTelemetry Collector to identify any error messages or warnings that might provide insights into what’s going wrong.
* **Consult Documentation**: Review the SigNoz, OpenTelemetry, and Telegraf documentation for additional troubleshooting of the common issues.


</TabItem>
<TabItem value="self-host" label="Self-Host">

**Here's a quick summary of what we will be doing in this guide**

* Deploy Telegraf to fetch the metrics from Google Cloud monitoring.
* Deploy the self-hosted SigNoz.
* Visualize the metrics in the SigNoz dashboard.

## Prerequisites

* A [Google Cloud account](https://console.cloud.google.com/) with administrative privileges or Cloud Load Balancer Admin privileges.
* Cloud Load Balancer
* Access to a project in Google Cloud Platform (GCP).
* The Google Cloud Load Balancer APIs must be enabled. You can follow [this](https://support.google.com/googleapi/answer/6158841?hl=en) guide to learn how to enable an API in Google Cloud.
* Self-hosted SigNoz

## Setup

### Deploying a Self-Hosted SigNoz in a Docker container

**Step 1:** The deployment process of the Self-Hosted `SigNoz` can be found in official [documentation](https://signoz.io/docs/install/docker/).

**Step 2:** Ensure all the containers are running in a **Healthy** state.

<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/self-hosted-signoz.webp"
alt="Self-hosted SigNoz in Docker"
/>
<figcaption>
<i>
Self-hosted SigNoz in Docker
</i>
</figcaption>
</figure>

<Tabs>
<TabItem value="bundled-otel-collector" label="Using bundled SigNoz self-hosted OTel Collector">

The self-hosted SigNoz setup includes the OTel collector in the bundle. Docker will deploy the OTel collector beside SigNoz as a container. The same OTel collector can be used to receive any signals directly. Otherwise, if one more OTel Collector is required for a more granular collection, we can add an additional independent OTel collector, see Using additional centralized OTel collector tab.

</TabItem>
<TabItem value="additional-otel-collector" label="Using additional centralized OTel collector">

Apart from using the native OTel collector present in the docker from the previous method, we can also deploy an additional independent OTel collector, which can act as an additional collector in this setup for more granular metrics collection. Here, we consider OTel and Telegraf being set up in the same VM.

**Step 1:** [Install](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) and configure OpenTelemetry to scrape the metrics from Telegraf. Add the following code block to the OpenTelemetry configuration file. Under exporters, we should have an exporter pointing to our SigNoz self-host setup. For example, in the snippet below, the endpoint-ip would be the VM address where the SigNoz self-host setup is present.

```yaml
exporters:
otlp:
endpoint: "<endpoint-ip>:4317"
tls:
insecure: true
logging:
verbosity: normal
```

**Step 2:** After successful configuration, start the OTel service.

</TabItem>
</Tabs>

<Admonition type="note">

Please make appropriate changes to the networking connections (adding network to security groups, opening ports, etc.) on your VMs as per your setup.

</Admonition>

### Deploy Telegraf to fetch the metrics from Google Cloud Monitoring.

**Step 1: **Install [`telegraf`](https://github.com/influxdata/telegraf), which will collect metrics from Google Cloud Monitoring for Cloud Load Balancer, see the [available metrics for load balancer.](https://cloud.google.com/monitoring/api/metrics_gcp#gcp-loadbalancing) The installation process for the respective operating system can be found in official [documentation](https://docs.influxdata.com/telegraf/v1/install/).

After successful installation, the `telegraf` status should be active and running.

<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/telegraf.webp"
alt="Running telegraf"
/>
<figcaption>
<i>
Running telegraf
</i>
</figcaption>
</figure>

The configuration file for telegraf can be found here:

```sh
`/etc/telegraf/telegraf.conf`
```

**Step 2:** Configure the Telegraf input and output plugin by adding configurations to the `telegraf.conf` file.

### Gather timeseries from Google Cloud Platform v3 monitoring API

```sh
[[inputs.stackdriver]]
## GCP Project
project = "omni-new"
## Include timeseries that start with the given metric type.
metric_type_prefix_include = [
"loadbalancing.googleapis.com",
]

## Most metrics are updated no more than once per minute; it is recommended

## to override the agent level interval with a value of 1m or greater.

interval = "1m"

# Send OpenTelemetry metrics over gRPC

[[outputs.opentelemetry]]

## Override the default (localhost:4317) OpenTelemetry gRPC service

## address:port

service_address = "localhost:4317"

```

**Step 3:** Restart the [telegraf](https://github.com/influxdata/telegraf) service.

```sh
sudo service telegraf restart
```


### Visualize the metrics in Self-Hosted SigNoz

**Step 1:** Go to your Self-Hosted SigNoz UI and navigate to the Self-Hosted SigNoz dashboard. Click on the **Dashboards** section to view the metrics. Create a new dashboard (If not already present )

<Admonition type="note">

The default Self-Hosted SigNoz dashboard endpoint would be `http://<Self-Hosted SigNoz-host-ip>:3301`. However, the URL can be different based on how you have set up the infrastructure.

</Admonition>

**Step 2:** If not already created, create a new dashboard and select Time Series.


<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/new-dashboard.webp"
alt="Create dashboard in SigNoz"
/>
<figcaption>
<i>
Create dashboard in SigNoz
</i>
</figcaption>
</figure>

**Step 3:** Select the metric for the cloud load balancer

For example, `loadbalancing_googleapis_com_https_backend_response_bytes_count` is one of the metrics that is collected.

<figure data-zoomable align="center">
<img
src="/img/docs/gcp-monitoring/clb-metrics/metrics-in-dashboard-self-hosted.webp"
alt="Detailed view of the selected metric"
/>
<figcaption>
<i>
Detailed view of the selected metric
</i>
</figcaption>
</figure>

## Troubleshooting

If you run into any problems while setting up monitoring for your Cloud Load Balancer metrics with SigNoz, consider these troubleshooting steps:

* **Verify Configuration**: Double-check your `config.yaml` file to ensure all settings, including endpoint, are correct.
* **Verify Docker container logs:** Check if all the containers are running properly and do not unexpectedly crash.
* **Review Logs**: Look at the logs of both your Cloud Load balancer and the OpenTelemetry Collector to identify any error messages or warnings that might provide insights into what’s going wrong.
* **Consult Documentation**: Review the SigNoz, OpenTelemetry, and Telegraf documentation for any additional troubleshooting of the common issues.

</TabItem>
</Tabs>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit a8cdef7

Please sign in to comment.