Configuration Reference

This guide explains BIT's TOML configuration format and how to customize tests for your system.

Configuration Overview

Each test has a TOML configuration file in /etc/bit/ that defines:

  • enabled - Whether the test should run (true/false)
  • frequency - How often CBIT tests run (in seconds)
  • thresholds - Resource limits (CPU %, disk %, temperature)
  • whitelists - Approved hardware devices (USB, PCI)
  • expected_states - Interface status (network UP/DOWN, speeds)

Configuration files are named <test_name>.toml (e.g., pbit_cpu_usage.toml, cbit_memory_usage.toml).

Configuration File Structure

Common Fields

All tests have an enabled field:

[pbit_cpu_usage]
enabled = true

CBIT (continuous) tests also have a frequency field:

[cbit_memory_usage]
enabled = true
frequency = 30    # Run every 30 seconds

Test-Specific Fields

Different tests require additional fields based on what they monitor:

Threshold Tests (CPU, memory, disk usage):

[pbit_cpu_usage]
enabled = true
threshold = 42    # Alert if CPU exceeds 42%

[cbit_disk_usage]
enabled = true
frequency = 30
threshold = 80    # Alert if disk exceeds 80%

Whitelist Tests (USB, PCI devices):

[pbit_usb_whitelist]
enabled = true

[[device]]
device_name = "USB Hub"
vendor_id = "1d6b"
device_id = "0002"

[[device]]
device_name = "Keyboard"
vendor_id = "046d"
device_id = "c52b"

Interface Tests (Ethernet, CAN):

[pbit_ethernet]
enabled = true

[[interface]]
name = "eth0"
expected_speed = 1000
expected_state = "up"

[[interface]]
name = "eth1"
expected_speed = 1000
expected_state = "up"

Multi-Resource Tests (Multiple disks, temperature sensors):

[cbit_disk_usage]
enabled = true
frequency = 30

[[disk]]
disk = "/dev/sda1"
threshold = 80

[[disk]]
disk = "/dev/shm"
threshold = 90

[pbit_temperature]
enabled = true

[[thermal_zone]]
label = "Core 0"
threshold = 85.0

[[thermal_zone]]
label = "Core 1"
threshold = 85.0

Modifying Configuration

You have two options for modifying configuration:

Option A: Edit TOML Files Manually

# Edit a specific test
sudo nano /etc/bit/cbit_disk_usage.toml

# Restart service to apply changes
sudo systemctl restart bit_manager

Pros: Precise control, preserves other configs
Cons: Manual editing, must know TOML format

Option B: Regenerate with bit-learn

sudo bit-learn

Pros: Auto-detects new hardware, updates all configs
Cons: Overwrites ALL existing configuration files

⚠️ Warning: bit-learn will overwrite your manual changes. Back up configs before regenerating.

Configuration Examples

Adjust Threshold

Change when alerts trigger:

sudo nano /etc/bit/cbit_disk_usage.toml

Change threshold from 80% to 90%:

[[disk]]
disk = "/dev/sda1"
threshold = 90    # Was 80

Change Monitoring Frequency

Make tests run more or less often:

sudo nano /etc/bit/cbit_temperature.toml

Change from every 30 seconds to every 5 minutes:

[cbit_temperature]
enabled = true
frequency = 300    # Was 30 (now 300 = 5 minutes)

Disable a Test

Prevent a test from running:

sudo nano /etc/bit/pbit_gpu_loading.toml
[pbit_gpu_loading]
enabled = false    # Was true

Add Approved Device

Add a new device to whitelist:

sudo nano /etc/bit/pbit_usb_whitelist.toml

Append new device block:

[[device]]
device_name = "New USB Device"
vendor_id = "1234"
device_id = "5678"

Or regenerate to auto-detect:

sudo bit-learn    # Detects all currently connected devices

Configuration by Test Type

PBIT Tests

Power-on tests run once at startup. Configuration typically includes test-specific thresholds or expected values.

Examples: pbit_cpu_usage, pbit_disk_health, pbit_ethernet, pbit_usb_whitelist

CBIT Tests

Continuous tests run periodically. Configuration includes frequency plus test-specific settings.

Examples: cbit_memory_usage, cbit_temperature, cbit_disk_usage

FBIT Tests

Factory tests typically have minimal configuration:

[fbit_ssd]
enabled = true
test_file_size_mb = 1
target_directory = "/tmp"

Common Scenarios

False Alerts

If tests fail unnecessarily, increase thresholds:

[cbit_cpu_usage]
threshold = 50    # Increased from 32

Too Many Alerts

Reduce monitoring frequency:

[cbit_temperature]
frequency = 300    # Check every 5 minutes instead of 30 seconds

Missing Hardware Test Passes

Tests gracefully pass when hardware isn't present:

[pbit_can]
enabled = true
# No CAN interfaces → test passes

This is normal behavior - you don't need to disable tests for missing hardware.

New Hardware Not Detected

After adding hardware, regenerate configs:

sudo bit-learn

Or manually add to existing config files.

Next Steps