Skip to content
Last9 named a Gartner Cool Vendor in AI for SRE Observability for 2025! Read more →
Last9

Host Metrics on Raspberry Pi

Monitor Raspberry Pi host metrics including CPU, memory, disk, network, system load, and temperature using OpenTelemetry Collector with Last9

Use OpenTelemetry to monitor Raspberry Pi host metrics including CPU, memory, disk, network, system load, and CPU/GPU temperature.

Prerequisites

Before setting up Raspberry Pi host metrics monitoring, ensure you have:

  • Raspberry Pi (any model) running Raspberry Pi OS
  • SSH access to your Pi
  • Last9 account with integration credentials
  1. Determine Your Pi’s Architecture

    Run this command to check your Pi’s architecture:

    uname -m
    • armv7l → 32-bit (use linux_armv7 package)
    • aarch64 → 64-bit (use linux_arm64 package)
  2. Install OpenTelemetry Collector

    Note: systemd is required for automatic service configuration.

    For Raspberry Pi 4/5 with 64-bit OS:

    sudo apt-get update
    sudo apt-get -y install wget
    wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.144.0/otelcol-contrib_0.144.0_linux_arm64.deb
    sudo dpkg -i otelcol-contrib_0.144.0_linux_arm64.deb

    More installation options can be found here.

  3. Configure OpenTelemetry Collector

    Create the configuration file:

    sudo nano /etc/otelcol-contrib/config.yaml

    Use the following configuration optimized for Raspberry Pi:

    receivers:
    hostmetrics:
    collection_interval: 30s
    scrapers:
    cpu:
    metrics:
    system.cpu.utilization:
    enabled: true
    system.cpu.logical.count:
    enabled: true
    memory:
    metrics:
    system.memory.utilization:
    enabled: true
    system.memory.limit:
    enabled: true
    load:
    disk:
    filesystem:
    metrics:
    system.filesystem.utilization:
    enabled: true
    network:
    processes:
    process:
    mute_process_user_error: true
    mute_process_io_error: true
    mute_process_exe_error: true
    metrics:
    process.cpu.utilization:
    enabled: true
    process.memory.utilization:
    enabled: true
    # Raspberry Pi temperature (requires pi-temp-exporter)
    prometheus/pi_temp:
    config:
    scrape_configs:
    - job_name: 'pi-temperature'
    scrape_interval: 30s
    static_configs:
    - targets: ['localhost:9101']
    processors:
    # Memory limiter to prevent OOM on resource-constrained Pi
    memory_limiter:
    check_interval: 5s
    limit_mib: 100
    spike_limit_mib: 25
    batch:
    timeout: 10s
    send_batch_size: 1000
    send_batch_max_size: 2000
    resourcedetection/system:
    detectors: ["system"]
    system:
    hostname_sources: ["os"]
    resource/pi:
    attributes:
    - key: device.type
    value: raspberry-pi
    action: upsert
    transform/hostmetrics:
    metric_statements:
    - context: datapoint
    statements:
    - set(attributes["host.name"], resource.attributes["host.name"])
    - set(attributes["os.type"], resource.attributes["os.type"])
    exporters:
    otlp/last9:
    endpoint: "{{ .Metrics.WriteURL }}"
    headers:
    "Authorization": "{{ .Metrics.AuthValue }}"
    service:
    pipelines:
    metrics:
    receivers: [hostmetrics, prometheus/pi_temp]
    processors: [memory_limiter, batch, resourcedetection/system, resource/pi, transform/hostmetrics]
    exporters: [otlp/last9]
  4. Install Temperature Exporter (Optional)

    To collect CPU/GPU temperature and throttle state:

    # Download the exporter
    sudo curl -o /usr/local/bin/pi-temp-exporter.py \
    https://raw.githubusercontent.com/last9/opentelemetry-examples/main/otel-collector/raspberry-pi/pi-temp-exporter.py
    sudo chmod +x /usr/local/bin/pi-temp-exporter.py
    # Create and start service
    sudo tee /etc/systemd/system/pi-temp-exporter.service > /dev/null <<EOF
    [Unit]
    Description=Raspberry Pi Temperature Exporter
    After=network.target
    [Service]
    Type=simple
    ExecStart=/usr/bin/python3 /usr/local/bin/pi-temp-exporter.py
    Restart=always
    User=root
    [Install]
    WantedBy=multi-user.target
    EOF
    sudo systemctl daemon-reload
    sudo systemctl enable pi-temp-exporter
    sudo systemctl start pi-temp-exporter
  5. Start the OpenTelemetry Collector Service

    Reload systemd to apply changes and start the service:

    sudo systemctl daemon-reload
    sudo systemctl enable otelcol-contrib
    sudo systemctl start otelcol-contrib

Verification

Check the service status:

sudo systemctl status otelcol-contrib

Monitor logs in real-time:

sudo journalctl -u otelcol-contrib -f

Log into your Last9 account to confirm host metrics are being received.

Collected Metrics

CategoryMetrics
CPUUsage per core, utilization, load averages
MemoryUsed, free, cached, buffers, utilization
DiskUsage, I/O operations, read/write bytes
FilesystemUsage per mount point
NetworkBytes sent/received, packets, errors
Load1m, 5m, 15m averages
ProcessCount, CPU/memory per process
TemperatureCPU temp, GPU temp, throttle state (with pi-temp-exporter)

Resource Optimization

For Raspberry Pi Zero or older models with limited resources, increase the collection interval and reduce batch sizes:

receivers:
hostmetrics:
collection_interval: 60s # Instead of 30s
processors:
batch:
send_batch_size: 500
send_batch_max_size: 1000

Need Help?

If you encounter any issues or have questions: