rendered paste bodysub _populate_embedded_health {
my $self = shift;
my $ilo_command = $self->_generate_cmd('get_embedded_health');
my $response = $self->_send($ilo_command) or return;
my $xml = $self->_serialize($response) or return;
if ( my $errmsg = _check_errors($xml) ) {
$self->error($errmsg);
return;
}
my $fans = $xml->{GET_EMBEDDED_HEALTH_DATA}->{FANS}->{FAN};
my $power_supplies = $xml->{GET_EMBEDDED_HEALTH_DATA}->{POWER_SUPPLIES}->{SUPPLY};
my $temperatures = $xml->{GET_EMBEDDED_HEALTH_DATA}->{TEMPERATURE}->{TEMP};
foreach my $fan (@$fans) {
my $location = $fan->{ZONE}->{VALUE};
my $name = $fan->{LABEL}->{VALUE};
my $speed = $fan->{SPEED}->{VALUE};
my $status = $fan->{STATUS}->{VALUE};
my $unit = $fan->{SPEED}->{UNIT};
next unless $speed && $speed =~ /^\d+$/;
push( @{$self->{fans}}, {
'location' => $location,
'name' => $name,
'speed' => $speed,
'status' => $status,
'unit' => $unit,
});
}
foreach my $power_supply (@$power_supplies) {
my $name = $power_supply->{LABEL}->{VALUE};
my $status = $power_supply->{STATUS}->{VALUE};
next if $status eq 'Not Installed';
push( @{$self->{power_supplies}}, {
'name' => $name,
'status' => $status,
});
}
foreach my $temperature (@$temperatures) {
my $location = $temperature->{LOCATION}->{VALUE};
my $name = $temperature->{LABEL}->{VALUE};
my $status = $temperature->{STATUS}->{VALUE};
my $value = $temperature->{CURRENTREADING}->{VALUE};
my $unit = $temperature->{CURRENTREADING}->{UNIT};
next unless $value && $value =~ /^\d+$/;
push( @{$self->{temperatures}}, {
'location' => $location,
'name' => $name,
'status' => $status,
'value' => $value,
'unit' => $unit,
});
}
return 1;
}