You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2024-06-19 17:27:39

rocksteady
Member
Registered: 2023-07-07
Posts: 9

Rack power consumption

Hey, guys. I want to get racks power consumption using API.
So there are two parameters in racks - Max. power (in watts) and Measured power (in watts).
I've added power consumptions to all servers models and it shows it in Rack stats field (say 4200/5000).
But Measured power still equals to zero. Do I have to fill it manually? Or how do I get numbers from Rack stats Power field?

Offline

#2 2024-06-19 17:32:55

rocksteady
Member
Registered: 2023-07-07
Posts: 9

Re: Rack power consumption

There is also an error in json response. I suppose it should be "measured", not "mesured"... )

  "max_power": 5100,
  "mesured_power": 0,

Offline

#3 2024-06-19 19:54:12

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,807
Website

Re: Rack power consumption

rocksteady wrote:

There is also an error in json response. I suppose it should be "measured", not "mesured"... )

  "max_power": 5100,
  "mesured_power": 0,

No, "mesured_power" is considered correct because that is what the database column is named. It is indeed a typo, but maybe not one that can be fixed easily. The new API coming with GLPI 11 is more abstracted from the underlying database schema/code and this field is renamed properly through the new API.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#4 2024-06-20 10:21:25

rocksteady
Member
Registered: 2023-07-07
Posts: 9

Re: Rack power consumption

I can live with it, but still how do I fill measured power parameter? I suppose it should be filled automatically? Don't say that I need to parse GUI to fill all my racks)))

Offline

#5 2024-06-20 14:00:13

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,807
Website

Re: Rack power consumption

I don't actually know the purpose of this field, but looking at the code I can tell it isn't automatically calculated. My best guess is that it is meant to be filled manually with the actual/average power draw for the rack or automatically updated using some kind of plugin that can import the data from another software.
The 4200/5000 stat is saying that the current expected maximum power draw is 4200 while that maximum the rack itself can support is 5000.
Since the 4200 is calculated based on the models of the items in the rack, there is no field in the rack table itself for it.

The 4200 number probably won't ever be available in the current API and would have to be calculated each time by whatever is querying the API.
It is something that could be added in the new API though (not a promise) since there is more flexibility in the data it provides.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#6 2024-06-24 14:24:33

rocksteady
Member
Registered: 2023-07-07
Posts: 9

Re: Rack power consumption

Thank for reply! I've spent some time to fill my racks with max_power and measured_power parameters, and now I'm facing another issue... When I try to get all racks from API using this:

response=$(curl -s -X GET "${API_URL}/DCRoom/2/rack" \
  --header "Content-Type: application/json" \
  --header "App-Token: ${APP_TOKEN}" \
  --header "Session-Token: ${session_token}")

It returns only 16 random racks for each DCRoom. Is this normal behavior?

Offline

#7 2024-06-24 17:11:16

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,807
Website

Re: Rack power consumption

No it isn't, and its difficult for me to understand how that could happen at all.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

Board footer

Powered by FluxBB