Today's environments often present the challenge of collecting data from various sources, such as multi-cloud, hybrid on-premises/cloud, or both. Each cloud provider has its own tools that send data to their respective telemetry platforms. OpenTelemetry can monitor cloud VMs, on-premises VMs, and bare metal systems and send all data to a unified monitoring platform. This applies across multiple operating systems and vendors.
In this post, I'll walk you through installing and configuring the OpenTelemetry Collector and gathering and shipping host metrics to Google Cloud Operations from a Windows and Linux host.
Pre-reqs:
A Linux or Windows host running on GCE. I'm using Debian and a Windows Server 2022 image in this example.
A backend ready to ship and analyze your telemetry data. For this example, I’m using Google Cloud Operations. If you choose Google Cloud Operations, you’ll need:
Remember to set up a service account (and corresponding JSON key) in your project and assign the following roles to the service account
Logs Writer
Monitoring Admin
To access the service accounts, obtain the corresponding JSON key file.
Set the path to your JSON key file in the GOOGLE_APPLICATION_CREDENTIALS environment variable on your MySQL host. You can do this using the following command: GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-file.json"
Depending on how your system is set up, other authentication methods may be available.
Step 1: Install the collector
On Linux:
Download and install the package:
Once complete, otelcol-contrib will be added and managed by config.yaml, and the collector will start automatically.
You’ll find the collector configuration file here:
/etc/otelcol-contrib/config.yaml
On Windows:
On your Windows host, you can download the latest Windows executable from the open telemetry-collector-releases repo on your host.
Once downloaded, open the command prompt as an Administrator, and untar the executable using the following command:
After extracting the executable, download or copy the config.yaml to the collector's root directory:
For reference, here's the default config:
Related Content: Rapid telemetry for Windows with OpenTelemetry and BindPlane OP
Step 2: Configure the collector
Next, update the config.yaml with the one I’ve provided below to use the collector components below for Windows and Linux.
Then restart the collector:
On Linux:
On Windows:
Related Content: How to Install and Configure an OpenTelemetry Collector
Step 3: viewing the metrics in Google Cloud Operations
You should now be able to view the host metrics in the Metrics Explorer in Google Cloud.
Metrics collected
Conclusion
And that’s it - you've successfully configured OpenTelemetry to send host metrics from both Windows and Linux VMs in Google Cloud.
We've walked through the process of installing and setting up the OpenTelemetry Collector, as well as collecting and transmitting host metrics to Google Cloud Operations from Windows and Linux hosts.
Start leveraging OpenTelemetry now to get valuable insights into your system's performance and health for optimal operation.
Top comments (0)