tlBMC Metrics Module

The Metrics Module in tlBMC is responsible for collecting dynamic system-level and daemon-specific telemetry (CPU/Memory utilization, socket counts, firewall stats, and systemd service stall states) and exporting them to Redfish or other monitoring interfaces.

The core implementation resides in the third_party/milotic/external/cc/tlbmc/metrics/ directory.


Central Configuration

The metrics collection loop is configured via TlbmcConfig (defined in central_config.proto).

1. Metric Collector Module (MetricCollectorModule)

Controls the metrics service loops.

FieldTypeDefaultDescription
enabledbooltrueEnables the metrics
: : : : background tasks. :
collect_true_hitless_metricsbooltrueEnables parsing and
: : : : exposing true hitless :
: : : : update metrics. :
enable_psi_metricsboolfalseEnables reading
: : : : CPU/Memory Pressure :
: : : : Stall Information (PSI). :
enable_bios_key_metricsboolfalseControls the BIOS Key
: : : : metrics collector :
: : : : module. :

2. Software Metrics Configuration (SoftwareMetricsConfig)

Exposes detailed options for TCP socket and firewall rule monitoring (defined in software_metrics_config.proto).

FieldTypeDescription
socket_stat_ports`repeatedTCP port
: : int32` : numbers to :
: : : monitor socket :
: : : states (e.g. :
: : : LISTEN, :
: : : ESTABLISHED). :
netfilter_ports`repeatedPort numbers to
: : int32` : parse netfilter :
: : : SYN-ACK counts. :
true_hitless_metrics_refresh_interval_msint32Polling
: : : interval for :
: : : hitless :
: : : updates. :
true_hitless_metrics_pathstringFile path
: : : containing true :
: : : hitless state :
: : : JSON (parsed by :
: : : parser). :

Metric Categories

1. BMC Static Metrics (bmc_static_metrics.cc)

Information gathered at boot and exposed as static attributes:

  • Firmware Version: Read from VERSION_ID in /etc/os-release.
  • Flash ID: Extracted from mount directory names under /run/media/rofs-<flash-id>.
  • Machine UUID: Read using standard machine app IDs.

2. Socket Statistics (software_metrics.cc)

Exposes TCP socket states (LISTEN, ESTABLISHED, SYN-SENT, SYN-RECV, FIN-WAIT, etc.) for designated ports.

  • Mechanism: Executes ss -t -a -n and parses state counts.

3. Netfilter Connection Counts (software_metrics.cc)

Extracts packet and byte counters from nftables chains.

  • Mechanism: Executes nft -j list ruleset and searches for counter rules matching the comment tcp-server-<port>-synack for the configured netfilter ports.

4. Pressure Stall Information (PSI)

Enables tracking of operating system resource saturation:

  • System-wide PSI: Reads /sys/fs/cgroup/cpu.pressure, /sys/fs/cgroup/memory.pressure, and /sys/fs/cgroup/io.pressure.
  • Per-Service PSI: Reads individual systemd service slice stats under /sys/fs/cgroup/system.slice/{service_name}/cpu.pressure (and memory/io pressure).

Protobuf Configuration Schemas

The metrics collector service registers periodic tasks to check OS limits and updates the store using the following protobuf models:

  • SoftwareMetricsConfig (defined in software_metrics_config.proto): Configures TCP socket monitoring ports, firewall log check ports, and hitless update refresh schedules.
  • SoftwareMetrics (defined in software_metrics.proto): Schema representing system socket counts, netfilter stats, and CPU/Memory pressure stalls.
  • TrueHitlessMetrics (defined in true_hitless_metrics.proto): Schema representing active hitless update statuses.

Configuration Example (tlbmc_config_bundle.textproto)

Shows how platform integrators customize the metrics collection loops to monitor specific ports:

general_config {
  metric_collector_module {
    enabled: true
    collect_true_hitless_metrics: true
    enable_psi_metrics: true
  }
}

platform_to_config {
  key: "platform_name"
  value {
    metric_collector_module {
      enabled: true
    }
    # Platform-specific software metrics overrides
    # e.g., monitoring SSH (22) and Redfish (443) socket states
    # and tracking hitless metrics path
    # (These fields are mapped inside software_metrics_config)
  }
}

Code References

Config & Telemetry Protos

Core Code