Describe the bug
The output columns in ipmitool dcmi get_temp_reading are not consistently aligned.
The Entity Instance and Temp. Readings columns for inlet and CPU sensors appear in different positions compared to the baseboard sensor entries.
IPMITOOL Version
$ ipmitool -V
ipmitool version 1.8.19.59.gd62a996
To Reproduce
Steps to reproduce the behavior:
- Build the latest code from the current master branch.
- Run
ipmitool -I lanplus -H <bmc-ip> -U <user> -P <password> dcmi get_temp_reading
- Observe the abnormal reply:
Entity ID Entity Instance Temp. Readings
Inlet air temperature(40h) 1 +30 C
CPU temperature sensors(41h) 1 +41 C
CPU temperature sensors(41h) 2 +36 C
CPU temperature sensors(41h) 3 +37 C
Baseboard temperature sensors(42h) 1 +34 C
Baseboard temperature sensors(42h) 2 +33 C
Baseboard temperature sensors(42h) 3 +35 C
Baseboard temperature sensors(42h) 4 +33 C
Baseboard temperature sensors(42h) 5 +33 C
Baseboard temperature sensors(42h) 6 +32 C
Baseboard temperature sensors(42h) 7 +31 C
Baseboard temperature sensors(42h) 8 +36 C
Expected behavior
The Entity Instance and Temp. Readings columns should appear at the same positions for every row.
Additional context
The current implementation relies on tab characters (\t) for alignment. Since the sensor description strings have different lengths, the resulting column positions vary between sensor categories.
A possible solution is to use fixed-width formatting instead of tab-based alignment.
For example:
Entity ID field: fixed width of 45 characters
Entity Instance field: fixed width of 15 characters
Temp. Readings field follows afterward
I have tested a local patch that uses fixed-width formatting and it produces consistently aligned output.
Entity ID Entity Instance Temp. Readings
Inlet air temperature(40h) 1 +30 C
CPU temperature sensors(41h) 1 +41 C
CPU temperature sensors(41h) 2 +36 C
CPU temperature sensors(41h) 3 +37 C
Baseboard temperature sensors(42h) 1 +35 C
Baseboard temperature sensors(42h) 2 +33 C
Baseboard temperature sensors(42h) 3 +35 C
Baseboard temperature sensors(42h) 4 +33 C
Baseboard temperature sensors(42h) 5 +33 C
Baseboard temperature sensors(42h) 6 +32 C
Baseboard temperature sensors(42h) 7 +31 C
Baseboard temperature sensors(42h) 8 +36 C
If this approach is acceptable, I would be happy to submit a pull request.
**Describe the bug**
The output columns in `ipmitool dcmi get_temp_reading` are not consistently aligned.
The `Entity Instance` and `Temp. Readings` columns for inlet and CPU sensors appear in different positions compared to the baseboard sensor entries.
**IPMITOOL Version**
```none
$ ipmitool -V
ipmitool version 1.8.19.59.gd62a996
```
**To Reproduce**
Steps to reproduce the behavior:
1. Build the latest code from the current master branch.
2. Run `ipmitool -I lanplus -H <bmc-ip> -U <user> -P <password> dcmi get_temp_reading`
3. Observe the abnormal reply:
```none
Entity ID Entity Instance Temp. Readings
Inlet air temperature(40h) 1 +30 C
CPU temperature sensors(41h) 1 +41 C
CPU temperature sensors(41h) 2 +36 C
CPU temperature sensors(41h) 3 +37 C
Baseboard temperature sensors(42h) 1 +34 C
Baseboard temperature sensors(42h) 2 +33 C
Baseboard temperature sensors(42h) 3 +35 C
Baseboard temperature sensors(42h) 4 +33 C
Baseboard temperature sensors(42h) 5 +33 C
Baseboard temperature sensors(42h) 6 +32 C
Baseboard temperature sensors(42h) 7 +31 C
Baseboard temperature sensors(42h) 8 +36 C
```
**Expected behavior**
The `Entity Instance` and `Temp. Readings` columns should appear at the same positions for every row.
**Additional context**
The current implementation relies on tab characters (`\t`) for alignment. Since the sensor description strings have different lengths, the resulting column positions vary between sensor categories.
A possible solution is to use fixed-width formatting instead of tab-based alignment.
For example:
- `Entity ID` field: fixed width of 45 characters
- `Entity Instance` field: fixed width of 15 characters
- `Temp. Readings` field follows afterward
I have tested a local patch that uses fixed-width formatting and it produces consistently aligned output.
```none
Entity ID Entity Instance Temp. Readings
Inlet air temperature(40h) 1 +30 C
CPU temperature sensors(41h) 1 +41 C
CPU temperature sensors(41h) 2 +36 C
CPU temperature sensors(41h) 3 +37 C
Baseboard temperature sensors(42h) 1 +35 C
Baseboard temperature sensors(42h) 2 +33 C
Baseboard temperature sensors(42h) 3 +35 C
Baseboard temperature sensors(42h) 4 +33 C
Baseboard temperature sensors(42h) 5 +33 C
Baseboard temperature sensors(42h) 6 +32 C
Baseboard temperature sensors(42h) 7 +31 C
Baseboard temperature sensors(42h) 8 +36 C
```
If this approach is acceptable, I would be happy to submit a pull request.