bit-manager¶
Executes PBIT/CBIT/FBIT tests from plugin libraries and publishes results via Zenoh.
Environment Variables (with defaults)¶
BIT_TEST_PATH- Directory containing test plugins (default:/usr/local/lib/bit_manager)BIT_CONFIG_PATH- Directory containing configuration files (default:/etc/bit)BIT_STDOUT_LOG- Enable stdout logging (default: disabled, enabled in systemd service)BIT_LOG_FILE- Enable file logging (default: disabled, set to1for/var/log/bit/bit.log)RUST_LOG- Control log verbosity (default:info)
Usage¶
One-Shot Mode¶
Run all tests once and exit:
Use cases:
- Initial system validation
- CI/CD pipelines
- Manual testing
- Debugging
Behavior:
- Loads all PBIT and CBIT tests
- Executes each test once
- Displays results
- Exits with status code (0 = all passed, non-zero = failures)
Service Mode (Default)¶
Run continuously as a system service:
# Enable and start service
sudo systemctl enable --now bit_manager
# Check status
sudo systemctl status bit_manager
Behavior:
- PBIT tests: Run once at startup
- CBIT tests: Run continuously at configured intervals
- FBIT tests: Run on-demand via remote control
- Runs until stopped or system shutdown
- Logs to systemd journal
Specific Test Mode¶
Run only specific tests by name:
# Single test
bit-manager -t pbit_cpu_usage -o
# Multiple tests
bit-manager -t pbit_cpu_usage -t cbit_memory_usage -t pbit_ethernet -o
Use cases:
- Testing specific hardware components
- Debugging individual tests
- Validation after hardware changes
Remote Monitoring Mode¶
Enable Zenoh publishing for remote monitors:
This allows bit-monitor-cli and bit-monitor-gui to connect remotely and view test results in real-time.
Command-Line Options¶
# Run all tests once
bit-manager -o
bit-manager --once
# Run specific test(s)
bit-manager -t test_name -o
bit-manager --test test_name -o
# Enable Zenoh publishing
bit-manager --zenoh
# Help
bit-manager -h
bit-manager --help
# Version
bit-manager -V
bit-manager --version
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | All tests passed |
| 1 | One or more tests failed |
| 2 | Configuration or plugin loading error |
Using Exit Codes in Scripts¶
#!/bin/bash
bit-manager -o
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo "All tests passed"
elif [ $EXIT_CODE -eq 1 ]; then
echo "Tests failed - check logs"
exit 1
elif [ $EXIT_CODE -eq 2 ]; then
echo "Configuration error"
exit 2
fi
Logging¶
Console Output¶
When run with -o, results print to stdout:
[2026-01-07 10:15:30] PBIT PASS: pbit_cpu_usage - CPU usage at 12%
[2026-01-07 10:15:31] PBIT PASS: pbit_memory_usage - Memory usage at 45%
[2026-01-07 10:15:32] CBIT PASS: cbit_disk_usage - Disk usage at 67%
[2026-01-07 10:15:33] CBIT FAIL: cbit_temperature - Temperature 85°C exceeds threshold
Service Logs¶
When running as a service, check systemd journal:
# Follow live logs
sudo journalctl -u bit_manager -f
# View recent logs
sudo journalctl -u bit_manager -n 100
# Filter by priority
sudo journalctl -u bit_manager -p err
# Filter by test type
sudo journalctl -u bit_manager | grep PBIT
sudo journalctl -u bit_manager | grep CBIT
File Logging¶
Enable file logging for persistent logs:
Logs written to /var/log/bit/bit.log.
Examples¶
System-Wide with Defaults¶
With Systemd¶
CI/CD Integration¶
#!/bin/bash
# Run critical tests in CI pipeline
bit-manager -t pbit_cpu_usage -t pbit_memory_usage -t pbit_disk_usage -o
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
echo "❌ Critical tests failed"
exit 1
else
echo "✓ All critical tests passed"
fi
Scheduled Testing¶
Run tests daily via cron:
Remote Testing¶
Run tests on a remote system:
# Via SSH
ssh user@remote-host "bit-manager -o"
# With sudo for PBIT tests
ssh user@remote-host "sudo bit-manager -o"
Troubleshooting¶
See Troubleshooting Guide for common issues.
Next Steps¶
- Test Types - Understand PBIT, CBIT, and FBIT
- Configuration Guide - Customize test settings
- bit-monitor-cli - Remote monitoring and control
- bit-monitor-gui - Graphical monitoring