Hey Craig LGTM. It'll be in the next release of FreeIPMI. I added the patch into the FreeIPMI trunk and gave you credit in the ChangeLog. If you want, can you share your motherboard so the comments below are more clear?
Index: ipmi-sensors/ipmi-sensors-output-common.c =================================================================== --- ipmi-sensors/ipmi-sensors-output-common.c (revision 10196) +++ ipmi-sensors/ipmi-sensors-output-common.c (working copy) @@ -615,10 +615,15 @@ * * Get Sensor Thresholds is an optional IPMI command. If it's * not supported, use the SDR information. + * + * Unspecified Motherboard + * + * Similar to HP but w/ Parameter out of Range error */ if (ipmi_ctx_errnum (state_data->ipmi_ctx) == IPMI_ERR_COMMAND_INVALID_OR_UNSUPPORTED - && (ipmi_check_completion_code (obj_cmd_rs, IPMI_COMP_CODE_INVALID_COMMAND) == 1)) - { + && (ipmi_check_completion_code (obj_cmd_rs, IPMI_COMP_CODE_INVALID_COMMAND) == 1 + || ipmi_check_completion_code (obj_cmd_rs, IPMI_COMP_CODE_PARAMETER_OUT_OF_RANGE) == 1)) + { if (state_data->prog_data->args->common_args.debug) pstdout_fprintf (state_data->pstate, stderr, Al On Tue, 2015-08-18 at 22:34 +0000, Craig wrote: > Chu, Al <chu11@...> writes: > > > > > Hi Craig, > > > > Could you try the attached patch? Basically, I want to capture the error > and fall through to the normal "get thresholds via the SDR" code path. > > > > Al > > Ok, I modified your patch a little to capture the Invalid-Unsupported error > path as well (see patch text after results). Now the output contains the > thresholds as read from the SDR. Not sure why one sensor fails one way, and > the second one a different way... > > root@sdl3:/opt/freeipmi-1.4.9/ipmi-sensors> ./ipmi-sensors -v -h p-sm -u xxx > -p xxx -b -r 39,40 > Record ID: 39 > ID String: ARM CPU Temp > Sensor Type: Temperature (1h) > Sensor Number: 112 > IPMB Slave Address: 41h > Sensor Owner ID: 82h > Sensor Owner LUN: 0h > Channel Number: 0h > Entity ID: Chassis Specific (160) > Entity Instance: 96 > Entity Instance Type: Physical Entity > Event/Reading Type Code: 1h > api/ipmi-api-util.c: 354: _api_ipmi_cmd_post: error 'Parameter out of range. > One or more parameters in the data field of the Request are out of range. > This is different from 'Invalid data field' (CCh) code in that it indicates > that the erroneous field(s) has a contiguous range of possible values.' (201) > api/ipmi-sensor-cmds-api.c: 282: ipmi_cmd_get_sensor_thresholds: error > 'command invalid or unsupported' (23) > Lower Critical Threshold: 0.000000 C > Upper Critical Threshold: 65.000000 C > Lower Non-Critical Threshold: 5.000000 C > Upper Non-Critical Threshold: 55.000000 C > Lower Non-Recoverable Threshold: -10.000000 C > Upper Non-Recoverable Threshold: 75.000000 C > Sensor Min. Reading: -55.000000 C > Sensor Max. Reading: 125.000000 C > Normal Min.: 25.000000 C > Normal Max.: 55.000000 C > Nominal Reading: 40.000000 C > Sensor Reading: 24.000000 C > Sensor Event: 'OK' > > Record ID: 40 > ID String: ADM1062-TEMP 0 > Sensor Type: Temperature (1h) > Sensor Number: 6 > IPMB Slave Address: 41h > Sensor Owner ID: 82h > Sensor Owner LUN: 0h > Channel Number: 0h > Entity ID: Chassis Specific (160) > Entity Instance: 96 > Entity Instance Type: Physical Entity > Event/Reading Type Code: 1h > api/ipmi-api-util.c: 354: _api_ipmi_cmd_post: error 'Unspecified error.' (255) > api/ipmi-sensor-cmds-api.c: 282: ipmi_cmd_get_sensor_thresholds: error 'bad > completion code' (24) > Lower Critical Threshold: 0.000000 C > Upper Critical Threshold: 65.000000 C > Lower Non-Critical Threshold: 5.000000 C > Upper Non-Critical Threshold: 55.000000 C > Lower Non-Recoverable Threshold: -10.000000 C > Upper Non-Recoverable Threshold: 75.000000 C > Sensor Min. Reading: -128.000000 C > Sensor Max. Reading: 127.000000 C > Normal Min.: 25.000000 C > Normal Max.: 55.000000 C > Nominal Reading: 40.000000 C > Sensor Reading: 33.000000 C > Sensor Event: 'OK' > > > ------------------------------- BEGIN PATCH-------------------------------- > --- ipmi-sensors-output-common.c.orig 2015-08-18 12:44:43.421131866 -0700 > +++ ipmi-sensors-output-common.c 2015-08-18 15:27:07.246676301 -0700 > @@ -591,6 +591,26 @@ > goto cleanup; > } > > + /* Likely error from failed bridge or something similar. Fall > through to SDR */ > + if (ipmi_ctx_errnum (state_data->ipmi_ctx) == > IPMI_ERR_BAD_COMPLETION_CODE > + && (ipmi_check_completion_code (obj_cmd_rs, > + > IPMI_COMP_CODE_PARAMETER_OUT_OF_RANGE) == 1 > + || ipmi_check_completion_code (obj_cmd_rs, > + > IPMI_COMP_CODE_UNSPECIFIED_ERROR) == 1)) > + { > + if (state_data->prog_data->args->common_args.debug) > + pstdout_fprintf (state_data->pstate, > + stderr, > + "Get Sensor Thresholds failed, using SDR > information\n"); > + > + if (_get_sdr_sensor_thresholds (state_data, obj_cmd_rs) < 0) > + goto cleanup; > + > + goto continue_get_sensor_thresholds; > + } > + > + > + > /* IPMI Workaround > * > * HP DL 585 > @@ -599,7 +619,8 @@ > * not supported, use the SDR information. > */ > if (ipmi_ctx_errnum (state_data->ipmi_ctx) == > IPMI_ERR_COMMAND_INVALID_OR_UNSUPPORTED > - && (ipmi_check_completion_code (obj_cmd_rs, > IPMI_COMP_CODE_INVALID_COMMAND) == 1)) > + && (ipmi_check_completion_code (obj_cmd_rs, > IPMI_COMP_CODE_INVALID_COMMAND) == 1 > + || ipmi_check_completion_code (obj_cmd_rs, > IPMI_COMP_CODE_PARAMETER_OUT_OF_RANGE) == 1)) > { > if (state_data->prog_data->args->common_args.debug) > pstdout_fprintf (state_data->pstate, > > ---------------------END PATCH----------------------------------- > > Craig > > > > > ________________________________________ > > From: freeipmi-users-bounces+chu11=llnl.gov-mXXj517/zsQ <at> > public.gmane.org [freeipmi-users-bounces+chu11=llnl.gov-mXXj517/zsQ <at> > public.gmane.org] on behalf of Craig [agspoon-Re5JQEeQqe8AvxtiuMwx3w <at> > public.gmane.org] > > Sent: Tuesday, August 18, 2015 10:28 AM > > To: freeipmi-users-mXXj517/zsQ <at> public.gmane.org > > Subject: Re: [Freeipmi-users] Bridging sensor threshold requests > > > > Albert Chu <chu11 <at> ...> writes: > > > > > > > > Hi Craig, > > > > > > No one ever requested this, so it's never come up. However ... > > > > > > There's a decent chance that FreeIPMI just isn't handling the get sensor > > > thresholds error correctly. If the call fails, it should just fall > > > through and use the thresholds listed in the SDR. Perhaps its an > > > unique/unexpected error code. > > > > > > Could you send the --debug output that shows the error. You can limit > > > the output by only specifying one sensor w/ -r. > > > > > > Al > > > > > > On Mon, 2015-08-17 at 18:10 +0000, Craig wrote: > > > > Hello, > > > > > > > > I was wondering if anyone has worked out a patch to extend ipmi-sensors > > > > to > > > > extract threshold settings from sensors that are not local to the BMC > > > > (i.e > > > > across an IPMB bridge). > > > > > > > > The "-b" option provides a means to get the sensor readings, but if > you ask > > > > for the verbose output (-v) or explicitly request threshold output > > > > (--output-sensor-thresholds), the output stops as soon as it encounters > > > > an > > > > error trying to read the threshold values for a non-local sensor. > > > > > > > > Looking at the code, it seems like there needs to be a parallel > function to > > > > "ipmi_cmd_get_sensor_reading_ipmb()" that retrieves the threshold > values as > > > > well. e.g. ipmi_cmd_get_sensor_thresholds_ipmb() > > > > > > > > I had a look at the code, and it seems non-trivial to accomplish this > > > > for > > > > someone unfamiliar with the code and API. > > > > > > > > Thanks for any advice you can give me. > > > > > > > > Craig > > > > > > > > > > > > _______________________________________________ > > > > Freeipmi-users mailing list > > > > Freeipmi-users <at> ... > > > > https://lists.gnu.org/mailman/listinfo/freeipmi-users > > > > Ok, here are some results. Sorry for the long lines.. > > > > First a working case, where the sensor is owned by the BMC (p-sm), and all > > looks good. > > > > root <at> sdl3:/opt/freeipmi-1.4.9/ipmi-sensors> ./ipmi-sensors -v -h p-sm > -u xxx > > -p xxx -b -r 15 > > Record ID: 15 > > ID String: Chassis Temp2 > > Sensor Type: Temperature (1h) > > Sensor Number: 98 > > IPMB Slave Address: 10h > > Sensor Owner ID: 20h > > Sensor Owner LUN: 0h > > Channel Number: 0h > > Entity ID: OEM System Integrator (208) > > Entity Instance: 1 > > Entity Instance Type: Physical Entity > > Event/Reading Type Code: 1h > > Lower Critical Threshold: 0.000000 C > > Upper Critical Threshold: 65.000000 C > > Lower Non-Critical Threshold: 5.000000 C > > Upper Non-Critical Threshold: 55.000000 C > > Lower Non-Recoverable Threshold: -10.000000 C > > Upper Non-Recoverable Threshold: 75.000000 C > > Sensor Min. Reading: -55.000000 C > > Sensor Max. Reading: 125.000000 C > > Normal Min.: 25.000000 C > > Normal Max.: 55.000000 C > > Nominal Reading: 40.000000 C > > Sensor Reading: 27.000000 C > > Sensor Event: 'OK' > > > > Just getting the bridged sensor readings works fine. > > > > root <at> sdl3:/opt/freeipmi-1.4.9/ipmi-sensors> ./ipmi-sensors -h p-sm > -u xxx > > -p xxx -b -r 39,40 > > ID | Name | Type | Reading | Units | Event > > 39 | ARM CPU Temp | Temperature | 23.00 | C | 'OK' > > 40 | ADM1062-TEMP 0 | Temperature | 33.00 | C | 'OK' > > > > > > Then if I ask for a couple of sensors that are owned by a different FRU, the > > tool exits out early. > > > > root <at> sdl3:/opt/freeipmi-1.4.9/ipmi-sensors> ./ipmi-sensors -v -h p-sm > -u xxx > > -p xxx -b -r 39,40 > > Record ID: 39 > > ID String: ARM CPU Temp > > Sensor Type: Temperature (1h) > > Sensor Number: 112 > > IPMB Slave Address: 41h > > Sensor Owner ID: 82h > > Sensor Owner LUN: 0h > > Channel Number: 0h > > Entity ID: Chassis Specific (160) > > Entity Instance: 96 > > Entity Instance Type: Physical Entity > > Event/Reading Type Code: 1h > > api/ipmi-api-util.c: 354: _api_ipmi_cmd_post: error 'Parameter out of range. > > One or more parameters in the data field of the Request are out of range. > > This is different from 'Invalid data field' (CCh) code in that it indicates > > that the erroneous field(s) has a contiguous range of possible values.' > > (201) > > api/ipmi-sensor-cmds-api.c: 282: ipmi_cmd_get_sensor_thresholds: error > > 'command invalid or unsupported' (23) > > > > > > It only tries the first sensor, and then exits when it encounters the error. > > If I patch ipmi-sensors-detailed-output.c as follows, > > > > > > > > _______________________________________________ > Freeipmi-users mailing list > Freeipmi-users@gnu.org > https://lists.gnu.org/mailman/listinfo/freeipmi-users _______________________________________________ Freeipmi-users mailing list Freeipmi-users@gnu.org https://lists.gnu.org/mailman/listinfo/freeipmi-users