The Observability Blog

  • Metrics
  • OpenTelemetry

How to Monitor Host Metrics with OpenTelemtry

by Austin Senkowski on
May 11, 2022

OpenTelemetry is at the core of standardizing telemetry solutions. At observIQ, we’re focused on building the very best in open source telemetry software. Our relationship with OpenTelemetry began in 2021, with observIQ, contributing our logging agent, Stanza, to the OpenTelemetry community. Now, we are shifting our focus to simplifying OpenTelemetry solutions to its large base of users. On that note, we launched a collector that combines the best of both worlds, with OpenTelemetry at its core, combined with observIQ’s functionalities to simplify its usage.

In this post, we are taking you through the installation of the observIQ distribution of the OpenTelemetry collector and the steps to configure the collector to gather host metrics, eventually forwarding those metrics to the Google Cloud Operations.

Step 1: Installing the collector

The simplest way to get started is with one of the single-line installation commands shown below. For more advanced options, you’ll find a variety of installation options for Linux, Windows, and macOS on GitHub.

Use the following single-line installation script to install the observiq-otel collector.

Please note that the collector must be installed on the system which you wish to collect host metrics from.


msiexec /i "" /quiet


sudo sh -c "$(curl -fsSlL"

Step 2: Setting up pre-requisites and authentication credentials

In the following example, we are using Google Cloud Operations as the destination. However, OpenTelemtry offers exporters for many destinations. Check out the list of exporters here

Setting up Google Cloud exporter prerequisites:

If running outside of Google Cloud (On prem, AWS, etc) or without the Cloud Monitoring scope, the Google Exporter requires a service account.

Create a service account with the following roles:

  • Metrics: roles/monitoring.metricWriter
  • Logs: roles/logging.logWriter

Create a service account JSON key and place it on the system that is running the collector.


In this example, the key is placed at /opt/observiq-otel-collector/sa.json and its permissions are restricted to the user running the collector process.

sudo cp sa.json /opt/observiq-otel-collector/sa.json
sudo chown observiq-otel-collector: /opt/observiq-otel-collector/sa.json
sudo chmod 0400 /opt/observiq-otel-collector/sa.json

Set the GOOGLE_APPLICATION_CREDENTIALS environment variable by creating a systemd override. A systemd override allows users to modify the systemd service configuration without modifying the service directly. This allows package upgrades to happen seamlessly. You can learn more about systemd units and overrides here.

Run the following command

sudo systemctl edit observiq-otel-collector

If this is the first time an override is being created, paste the following contents into the file:


If an override is already in place, simply insert the Environment parameter into the existing Service section.

Restart the collector

sudo systemctl restart observiq-otel-collector


In this example, the key is placed at C:/observiq/collector/sa.json.

Set the GOOGLE_APPLICATION_CREDENTIALS with the command prompt setx command.

Run the following command

setx GOOGLE_APPLICATION_CREDENTIALS "C:/observiq/collector/sa.json" /m

Restart the service using the services application.

Step 3: Configuring the collector

In this sample configuration, the steps to use the host metrics receiver to fetch metrics from the host system and export them to Google Cloud Operations are detailed. This is how it works:

  1. The collector scrapes metrics and logs from the host and exports them to a destination assigned in the configuration file. 
  2. To export the metrics to Google Cloud Operations, use the configurations outlined in the googlecloudexporter

After the installation, the config file for the collector can be found at:

  • C:\Program Files\observIQ OpenTelemetry Collector\config.yaml (Windows)
  • /opt/observiq-otel-collector/config.yaml (Linux)

Edit the configuration file and use the following configuration.

# Receivers collect metrics from a source. The host metrics receiver will
# get CPU load metrics about the machine the collector is running on
# every minute.
	collection_interval: 60s

# Processors are run on data between being received and being exported.
  # Resourcedetection is used to add a unique (
  # to the metric resource(s), allowing users to filter
  # between multiple systems.
	detectors: ["system"]
  	hostname_sources: ["os"]

  # Resourceattributetransposer is used to add labels to metrics.
  	# Process metrics require unique metric labels, otherwise the Google
  	# API will reject some metrics as "out of order" / duplicates.
  	- from: ""
    	  to: "hostname"
  	- from: ""
    	  to: "pid"
  	- from: ""
    	  to: "binary"
  # Normalizesums smoothes out data points for more
  # comprehensive visualizations.

  # The batch processor aggregates incoming metrics into a batch,
  # releasing them if a certain time has passed or if a certain number
  # of entries have been aggregated.

# Exporters send the data to a destination, in this case GCP.
  	enabled: false

# Service specifies how to construct the data pipelines using
# the configurations above.
  	- hostmetrics
  	- resourcedetection
  	- resourceattributetransposer
  	- normalizesums
  	- batch
  	- googlecloud

3. Restart the collector

systemctl restart observiq-otel-collector

Step 3: Viewing the metrics in Google Cloud Operations

You should now be able to view the host metrics in your Metrics explorer. Nice work! This is how simple it is to collect host metrics in Linux.

Metrics collected

Processes Created

Total number of created processes.

Process Count

Total number of processes in each state.

Process CPU time

Total CPU seconds broken down by different states.

Process Disk IO

Disk bytes transferred.

File System Inodes Used

FileSystem inodes

File System Utilization

Filesystem bytes used.

Process Physical Memory Utilization

The amount of physical memory in use.

Process Virtual Memory Utilization

Virtual memory size.

Networking Errors

The number of errors encountered.

Networking Connections

The number of connections.


observIQ’s distribution is a game-changer for companies looking to implement the OpenTelemetry standards. The single line installer, seamlessly integrated receivers, exporter, and processor pool make working with this collector simple. Follow this space to keep up with all our future posts and simplified configurations for various sources. For questions, requests, and suggestions, reach out to our support team at