mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 09:13:08 +00:00
Merge pull request #4607 from cxhong/rvitals
Support rvitals command for Intelligent PDU
This commit is contained in:
commit
e2ae1787de
@ -251,6 +251,8 @@ sub fill_outletCount {
|
||||
my $count = $session->get("$outletoid");
|
||||
if ($count) {
|
||||
$pdutab->setNodeAttribs($pdu, {outlet => $count});
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg("Invalid Outlet number ", $callback,$pdu);
|
||||
}
|
||||
|
||||
return $count;
|
||||
@ -988,7 +990,6 @@ sub rinv_for_irpdu
|
||||
if ($output) {
|
||||
xCAT::SvrUtils::sendmsg("PDU Description: $output", $callback,$pdu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1021,7 +1022,18 @@ sub showMonitorData {
|
||||
|
||||
foreach my $pdu (@$noderange) {
|
||||
unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") {
|
||||
xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu);
|
||||
my $session = connectTopdu($pdu,$callback);
|
||||
if (!$session) {
|
||||
$callback->({ errorcode => [1],error => "Couldn't connect to $pdu"});
|
||||
next;
|
||||
}
|
||||
my $count = $pduhash->{$pdu}->[0]->{outlet};
|
||||
unless ($count) {
|
||||
$count = fill_outletCount($session, $pdu, $callback);
|
||||
}
|
||||
if ($count > 0) {
|
||||
rvitals_for_irpdu($pdu, $count, $session, $callback);
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
@ -1050,6 +1062,47 @@ sub showMonitorData {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub rvitals_for_irpdu
|
||||
{
|
||||
my $pdu = shift;
|
||||
my $count = shift;
|
||||
my $session = shift;
|
||||
my $callback = shift;
|
||||
my $output;
|
||||
|
||||
#ibmPduVoltageWarning: (voltageNormal(0),voltageOutOfRange(1))
|
||||
my $voltagewarning = ".1.3.6.1.4.1.2.6.223.0.1.1.7.0";
|
||||
$output = $session->get("$voltagewarning");
|
||||
xCAT::SvrUtils::sendmsg("Voltage Warning: $output", $callback,$pdu);
|
||||
|
||||
# get power info for each outlet
|
||||
# starts oid .2.6.223.8.2.2.1.7 to .2.6.223.8.2.2.1.14
|
||||
#ibmPduOutletCurrent
|
||||
my $outletcurrent = ".1.3.6.1.4.1.2.6.223.8.2.2.1.7";
|
||||
#ibmPduOutletMaxCapacity
|
||||
my $outletmaxcap = ".1.3.6.1.4.1.2.6.223.8.2.2.1.8";
|
||||
#ibmPduOutletCurrentThresholdWarning
|
||||
my $currentthrewarning = ".1.3.6.1.4.1.2.6.223.8.2.2.1.9";
|
||||
#ibmPduOutletCurrentThresholdCritical
|
||||
my $currentthrecrit = ".1.3.6.1.4.1.2.6.223.8.2.2.1.10";
|
||||
#ibmPduOutletLastPowerReading
|
||||
my $lastpowerreading = ".1.3.6.1.4.1.2.6.223.8.2.2.1.13";
|
||||
for (my $outlet = 1; $outlet <= $count; $outlet++) {
|
||||
$output = $session->get("$outletcurrent.$outlet");
|
||||
xCAT::SvrUtils::sendmsg("outlet $outlet Current: $output mA", $callback,$pdu);
|
||||
$output = $session->get("$outletmaxcap.$outlet");
|
||||
xCAT::SvrUtils::sendmsg("outlet $outlet Max Capacity of the current: $output mA", $callback,$pdu);
|
||||
$output = $session->get("$currentthrewarning.$outlet");
|
||||
xCAT::SvrUtils::sendmsg("outlet $outlet Current Threshold Warning: $output mA", $callback,$pdu);
|
||||
$output = $session->get("$currentthrecrit.$outlet");
|
||||
xCAT::SvrUtils::sendmsg("outlet $outlet Current Threshold Critical: $output mA", $callback,$pdu);
|
||||
$output = $session->get("$lastpowerreading.$outlet");
|
||||
xCAT::SvrUtils::sendmsg("outlet $outlet Last Power Reading: $output Watts", $callback,$pdu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 relaystat
|
||||
|
Loading…
x
Reference in New Issue
Block a user