Operate the host OpenTelemetry Collector
Use this runbook for collectors installed by
ansible/playbooks/opentelemetry.yml. The role sends host metrics to
otelcol_mimir_endpoint and new journald entries to otelcol_loki_endpoint.
On hosts with otelcol_node_exporter_enabled, it also installs a local
node_exporter for temperatures, thermal throttle counters, and local filesystem
capacity. With otelcol_node_exporter_storage_health_enabled, a systemd timer
writes SMART drive wear/health, ZFS pool capacity and error counts, and LVM
thin-pool usage to tmpfs for node_exporter's textfile collector.
Kubernetes node telemetry does not use this role. Flux manages that collector.
Verify a rollout
Run the playbook against one host before you add more hosts:
The role validates the generated configuration, checks journal access, restarts the service, and checks the local health endpoint. Then inspect the service:
ansible my-host -b -m ansible.builtin.command \
-a "systemctl --no-pager --full status otelcol-contrib"
ansible my-host -b -m ansible.builtin.command \
-a "journalctl -u otelcol-contrib --since=-10m --no-pager"
Then check the backends. The local health check does not prove that they
accepted telemetry. Query Mimir in the tenant from otelcol_mimir_tenant, and
replace proxmox-host with the host's otelcol_service_name:
system_cpu_load_average_1m{job="proxmox-host", instance="my-host"}
node_hwmon_temp_celsius{job="integrations/node_exporter", instance="my-host"}
node_filesystem_avail_bytes{job="integrations/node_exporter", instance="my-host", mountpoint="/"}
node_smart_percentage_used{job="integrations/node_exporter", instance="my-host"}
node_zfs_zpool_dataset_available_bytes{job="integrations/node_exporter", instance="my-host"}
Query Loki for a journal record from the last few minutes:
The integrations/node_exporter queries return data only on hosts with
otelcol_node_exporter_enabled, and the SMART, ZFS pool, and LVM thin-pool
metrics require otelcol_node_exporter_storage_health_enabled. The package
temperature of an Intel CPU has the label Package id 0 in
node_hwmon_sensor_label. An AMD CPU has Tctl. Loki keeps logs for 30 days.
On hosts with otelcol_node_exporter_storage_health_enabled, verify that the
storage health timer runs cleanly and reports zero scrape errors:
ansible my-host -b -m ansible.builtin.command \
-a "systemctl --no-pager status node-exporter-storage-health.timer"
ansible my-host -b -m ansible.builtin.command \
-a "grep -E '^node_(smart_percentage_used|zfs_zpool_checksum_errors|storage_health_scrape_errors)' /run/prometheus-node-exporter/storage-health.prom"
If the exporter reports TLS, authentication, or connection errors, stop the rollout. Fix the endpoint or its secret-backed settings before you add another host.
What the collector writes and uses
The collector keeps the journald cursor and the export queue under
/var/lib/otelcol-contrib/file_storage. It writes every batch to the queue
before it sends it, and deletes the batch once a backend accepts it. With
otelcol_exporter_queue_persistent: false the queue stays in memory, and the
cursor is the only file the collector writes. Use that on a host with a worn
disk. A restart during a backend outage then loses the queued batches.
The collector refuses new data above otelcol_memory_limit_mib. The kernel
kills the service above otelcol_systemd_memory_max, and systemd caps its CPU
at otelcol_systemd_cpu_quota. The node_exporter and the storage health
oneshot service have their own memory and CPU limits. The storage health timer
runs every otelcol_node_exporter_storage_health_interval (default 5min) and
writes /run/prometheus-node-exporter/storage-health.prom on tmpfs, so neither
node_exporter nor the storage health collector writes periodically to disk.
Metrics kept from node_exporter
otelcol_node_exporter_metric_regex filters scraped metrics before they leave
the host:
- Hardware sensors:
node_hwmon_*andnode_cpu_(core|package)_throttles_total - Local filesystems (
ext2/3/4,xfs,btrfs,vfat,zfs; network mounts under/mntexcluded so NAS outages cannot stall scrapes):node_filesystem_(avail|free|size)_bytesandnode_filesystem_readonly - SMART wear and drive health (NVMe and SATA, including ATA Device Statistics
for SSDs without standard SMART attributes):
node_smart_passed,node_smart_percentage_used,node_smart_nvme_available_spare_percent,node_smart_nvme_available_spare_threshold_percent,node_smart_nvme_media_errors,node_smart_nvme_critical_warning,node_smart_reallocated_sectors,node_smart_pending_sectors,node_smart_uncorrectable_errors, andnode_smart_crc_errors - ZFS pool capacity and health:
node_zfs_zpool_(size|allocated|free)_bytes,node_zfs_zpool_dataset_(used|available)_bytes,node_zfs_zpool_online, andnode_zfs_zpool_(read|write|checksum|data)_errors - LVM thin pools (on hosts that have them):
node_lvm_thinpool_size_bytes,node_lvm_thinpool_data_used_bytes, andnode_lvm_thinpool_(data|metadata)_used_percent - Storage collector freshness:
node_storage_health_scrape_timestamp_secondsandnode_storage_health_scrape_errors
Roll back a configuration or package update
Revert the role to its last working commit. Run the playbook against one host:
Confirm that the package version in the restored role has checksums for every supported architecture. Repeat the rollout checks before you continue.
Remove the collector from a host
Remove the host from opentelemetry_collector_hosts in
ansible/inventory/hosts.yml first. This prevents a later playbook run from
reinstalling the collector. The Proxmox nodes are in the group through
proxmox_hosts. To remove one node, replace that child group with a list of
the nodes that stay.
Stop and disable the service:
cd ansible
ansible my-host -b -m ansible.builtin.systemd \
-a "name=otelcol-contrib state=stopped enabled=false"
Remove the package and the systemd override:
ansible my-host -b -m ansible.builtin.apt \
-a "name=otelcol-contrib state=absent"
ansible my-host -b -m ansible.builtin.file \
-a "path=/etc/systemd/system/otelcol-contrib.service.d state=absent"
ansible my-host -b -m ansible.builtin.systemd -a "daemon_reload=true"
On a host with the node_exporter, remove it and any storage health timer units
too. Delete /etc/modules-load.d/drivetemp.conf if the role wrote it. The
module stays loaded until the next reboot.
ansible my-host -b -m ansible.builtin.systemd \
-a "name=node-exporter-storage-health.timer state=stopped enabled=false"
ansible my-host -b -m ansible.builtin.file \
-a "path=/etc/systemd/system/node-exporter-storage-health.timer state=absent"
ansible my-host -b -m ansible.builtin.file \
-a "path=/etc/systemd/system/node-exporter-storage-health.service state=absent"
ansible my-host -b -m ansible.builtin.file \
-a "path=/usr/local/libexec/node-exporter-storage-health state=absent"
ansible my-host -b -m ansible.builtin.file \
-a "path=/etc/tmpfiles.d/prometheus-node-exporter.conf state=absent"
ansible my-host -b -m ansible.builtin.apt \
-a "name=prometheus-node-exporter state=absent purge=true"
ansible my-host -b -m ansible.builtin.file \
-a "path=/etc/systemd/system/prometheus-node-exporter.service.d state=absent"
ansible my-host -b -m ansible.builtin.file \
-a "path=/etc/modules-load.d/drivetemp.conf state=absent"
ansible my-host -b -m ansible.builtin.systemd -a "daemon_reload=true"
Remove the collector account from systemd-journal:
ansible my-host -b -m ansible.builtin.command \
-a "gpasswd --delete otelcol-contrib systemd-journal"
Package removal keeps /etc/otelcol-contrib and /var/lib/otelcol-contrib.
Keep the state directory if you might reinstall the collector. It contains the
journald cursor and queued telemetry. Delete it only when losing that state is
acceptable: