Crate bit

Source
Expand description

§Example Usage

The log level in this application is controlled by the BIT_LEVEL environment variable. This variable determines the verbosity of the log output, allowing users to adjust the level of detail in the logs.

§Setting the Log Level

The log level can be set using the BIT_LEVEL environment variable. The levels are defined as follows:

0 - No logs
1 - Error logs only
2 - Warning logs
3 - Info logs
4 - Debug logs
5 - Trace logs

To set the log level, you can use the following command in your terminal before running the application:

export BIT_LEVEL=3

Will always output INFO logs when run in the terminal where the environment variable is set.

§Running Tests

To set the log level once during execution, use the following command (Runs factory tests -f only):

BIT_LEVEL=1 ./target/debug/bit_manager -f

Runs with only Errors reported in the output to stdio.

§Example Log Output

Log file: /tmp/bit_manager_INFO_8e47c006-5e0c-48f6-bfe1-ebf5ffadf571.log
2025-07-27 02:21:34.451 FBIT:[DISABLED] Serial loop back test
2025-07-27 02:21:34.451 FBIT:[PASS] USB Factory test
2025-07-27 02:21:34.712 FBIT:[DISABLED] CAN loop back test
2025-07-27 02:21:34.712 FBIT:[PASS] Test TCP traffic against given iPerf3 server
2025-07-27 02:21:39.160 FBIT:[PASS] USB Factory test
2025-07-27 02:21:42.014 FBIT:[PASS] Test TCP traffic against given iPerf3 server
2025-07-27 02:21:45.262 FBIT:[PASS] USB Factory test
...

§Inspect

To find out what tests are installed you can use the inspect tool

$ bit_inspect
cbit_cpu_usage:  CPU utilization test: Check the CPU is not over 90% for the last 5 runs
cbit_disk_usage:  Disk utilization test: Check the disk is not nearing full
cbit_memory_usage:  Memory utilization test: Check the Memory is not over 90% for the last 5 runs
fbit_can_data:  CAN loop back test: Factory test, loop back the two ports in the config file
fbit_serial_data:  Serial loop back test: This test sends 100kb over a serial port that its wired TX/RX for loop back
fbit_ssd:  USB Factory test: USB factory test, create 1Mb and transfer file to /tmp (check MD5)
fbit_tcp_data:  Test TCP traffic against given iPerf server: A test of the local Ethernet ports
fbit_usb:  USB Factory test: USB factory test, create 1Mb and transfer file to /tmp (check MD5)
pbit_cpu_usage:  CPU utilization test: Check the CPU is not over 90%
pbit_memory_usage:  Memory utilization test: Check the Memory is not over 90%
pbit_pci_whitelist:  PCI Check: PCI white list, test specific description
...

For more detail or if you know the name of the plugin you want to inspect run:

$ bit_inspect cbit_disk_usage
Details:
  Long-Name              Disk utilization test
  Author                 Ross Newman <ross.newman@astutesys.com>
  Description            Check the disk is not nearing full
  Status                 NotRun

Plugin Details:
  Plugin Name            cbit_disk_usage
  Version                1.0.0
  Date Built             2025-07-28 06:08:12
  Module                 /usr/local/lib/bit_manager/libcbit_disk_usage.so
  Config File            /etc/bit/cbit_disk_usage.toml
  Run Frequency          CBIT(30s)

Config Details:
  cbit_disk_usage
    +---- enabled: true
    +---- frequency: 30

  disk
    +----(0) disk: "/dev/nvme0n1p5"
    +----(0) threshold: 80
    +----(1) disk: "/dev/sda1"
    +----(1) threshold: 80

If a test has its own configuration file you can review the settings and modify them as needed i.e. /etc/bit/cbit_disk_usage.toml contains the settings for the test above, the contents is shown when you run bit_inspect.

§Learn

The command bit_learn is provided to allow easy configuration of the .toml files for you target system. It can take a considerable amount of time to manually edit the USB and PCIe whitelists which can be autogenerated using this tool.

The tool is interactive please review the questions and make any further modifications after auto generating.

NOTE: If you make changes and re-run bit_learn your changes will be lost.

§Running as a service

To enable the service

sudo systemctl enable bit_manager

To start the service

sudo systemctl enable bit_manager

To check the current status

sudo systemctl status bit_manager

Modules§

bit
Generated file from bit.proto
log
utils
Common utility functions
zenoh
Zenoh publish / subscribe messages

Constants§

GIT_HASH
This file is auto-generated by build.rs
GIT_HASH_SHORT