Closed pszlazak closed 3 months ago
@pszlazak We plan to fix this, this output made as PowerSupplies array now is this OK. { "PowerSupply Redundancy Group 1": { "Redundancy Health": "OK", "Redundancy Mode": "Failover", "Redundancy State": "Enabled" }, "power": { "Power Metrics on 20 min. Intervals": { "Average Power": "127 W", "Max Consumed Power": "153 W", "Minimum Consumed Power": "126 W" }, "PowerSupplies": [ {
"Health": "OK",
"Hotplug Capable": true,
"Input Voltage": "227 V",
"Input Voltage Type": "ACHighLine",
"Last Power Output": "69 W",
"Power Capacity": "1600 W",
"State": "Enabled",
"iPDU Capable": false
},
{
"Health": "OK",
"Hotplug Capable": true,
"Input Voltage": "227 V",
"Input Voltage Type": "ACHighLine",
"Last Power Output": "59 W",
"Power Capacity": "1600 W",
"State": "Enabled",
"iPDU Capable": false
}
],
"Total Power Capacity": "3200 W",
"Total Power Consumed": "128 W"
} }
You may have to change the below command:
$ ilorest serverinfo --power --json --nologo | jq --raw-output '.power.PowerSupplies[].Status.Health'
instead you can use this command
$ ilorest serverinfo --power --json --nologo | jq --raw-output '.power.PowerSupplies[].Health'
@pszlazak This is fixed in build 5.0.0.0. Please you can verify.
@rajkumar14 I confirm, JSON schema is corrected in 5.0.0.0. Although it differs from the old schema. Yet, with suggested command, I can get needed data:
$ ilorest serverinfo --power --json --nologo | jq --raw-output '.power.PowerSupplies[].Health'
BTW - for 5.0.0.0 I don't see Debian package created. Is it intended or just an accident?
@pszlazak , For debian, please use the pypi package from https://pypi.org/project/ilorest/
Recently I was recreating my server and updated from ilorest
3.2.2
to4.7.0.0
. My scripts used to parse JSON data stopped to work. I found issue #66 , but it does not solve my problems.According to my checks new schema was introduced in
3.6.0.0
and it generally dropped usage of arrays in JSON. Current output:Previously it was:
As I use jq to parse outputs, I was able to quickly select needed data, e.g.
In previous output, PSUs were available as two separate objects of
PowerSupplies
array.In current output, under
power
we have three objects:Power Metrics on 20 min. Intervals
Power Supply 1
Power Supply 2
and additional two keys:
Total Power Capacity
Total Power Consumed
In short I would call current output too flat.