Example #1
0
     }
     break;
 case "Model":
     $template = new CDUTemplate();
     $manufacturer = new Manufacturer();
     $template->TemplateID = $pdu->TemplateID;
     $template->GetTemplate();
     $manufacturer->ManufacturerID = $template->ManufacturerID;
     $manufacturer->GetManufacturerByID();
     $tooltip .= __($row["Label"]) . ": [{$manufacturer->Name}] {$template->Model}<br>\n";
     break;
 case "NumOutlets":
     $template = new CDUTemplate();
     $powerConn = new PowerConnection();
     $template->TemplateID = $pdu->TemplateID;
     $template->GetTemplate();
     $powerConn->PDUID = $pdu->PDUID;
     $connList = $powerConn->GetConnectionsByPDU();
     $tooltip .= __($row["Label"]) . ": " . count($connList) . "/" . ($template->NumOutlets + 1) . "<br>\n";
     break;
 case "Uptime":
     $tooltip .= __($row["Label"]) . ": " . $pdu->GetSmartCDUUptime() . "<br>\n";
     break;
 case "PanelID":
     $pan = new PowerPanel();
     $pan->PanelID = $pdu->PanelID;
     $pan->GetPanel();
     $tooltip .= __($row["Label"]) . ": {$pan->PanelLabel}<br>\n";
     break;
 case "PanelVoltage":
     $pan = new PowerPanel();
Example #2
0
 function GetSmartCDUVersion()
 {
     if (!($dev = PowerDistribution::BasicTests($this->PDUID))) {
         return false;
     }
     if (!$this->GetPDU()) {
         return false;
     }
     $template = new CDUTemplate();
     $template->TemplateID = $this->TemplateID;
     if (!$template->GetTemplate()) {
         return false;
     }
     return self::OSS_SNMP_Lookup($dev, null, "{$template->VersionOID}");
 }
        $maxDraw = $PDUdev->InputAmperage * $pan->PanelVoltage * 1.732;
    }
    // De-rate all breakers to 80% sustained load
    $maxDraw *= 0.8;
    if ($maxDraw > 0) {
        $PDUPercent = intval($pduDraw / $maxDraw * 100);
    } else {
        $PDUPercent = 0;
    }
    $PDUColor = $PDUPercent > intval($config->ParameterArray["PowerRed"]) ? $CriticalColor : ($PDUPercent > intval($config->ParameterArray["PowerYellow"]) ? $CautionColor : $GoodColor);
    $body .= sprintf("\n\t\t\t<a href=\"devices.php?DeviceID=%d\">CDU %s</a><br>(%.2f kW) / (%.2f kW Max)<br>\n", $PDUdev->PDUID, $PDUdev->Label, $pduDraw / 1000, $maxDraw / 1000);
    $body .= "\t\t\t\t<div class=\"meter-wrap\">\n\t\t\t\t\t<div class=\"meter-value\" style=\"background-color: {$PDUColor}; width: {$PDUPercent}%;\">\n\t\t\t\t\t\t<div class=\"meter-text\">{$PDUPercent}%</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t<br>\n";
    if ($PDUdev->FailSafe) {
        $tmpl = new CDUTemplate();
        $tmpl->TemplateID = $PDUdev->TemplateID;
        $tmpl->GetTemplate();
        $ATSStatus = $PDUdev->getATSStatus();
        if ($ATSStatus == "") {
            $ATSColor = "rs.png";
            $ATSStatus = __("Unknown Status");
        } elseif ($ATSStatus == $tmpl->ATSDesiredResult) {
            $ATSColor = "gs.png";
            $ATSStatus = __("ATS Feeds OK");
        } else {
            $ATSColor = "ys.png";
            $ATSStatus = __("ATS Feeds Abnormal");
        }
        $body .= "<div><img src=\"images/{$ATSColor}\">{$ATSStatus}</div>\n";
    }
}
if ($person->CanWrite($cab->AssignedTo)) {
Example #4
0
 static function RowToObject($row, $extendmodel = true)
 {
     $Template = new DeviceTemplate();
     $Template->TemplateID = $row["TemplateID"];
     $Template->ManufacturerID = $row["ManufacturerID"];
     $Template->Model = $row["Model"];
     $Template->Height = $row["Height"];
     $Template->Weight = $row["Weight"];
     $Template->Wattage = $row["Wattage"];
     $Template->DeviceType = $row["DeviceType"];
     $Template->PSCount = $row["PSCount"];
     $Template->NumPorts = $row["NumPorts"];
     $Template->Notes = $row["Notes"];
     $Template->FrontPictureFile = $row["FrontPictureFile"];
     $Template->RearPictureFile = $row["RearPictureFile"];
     $Template->ChassisSlots = $row["ChassisSlots"];
     $Template->RearChassisSlots = $row["RearChassisSlots"];
     $Template->SNMPVersion = $row["SNMPVersion"];
     $Template->GlobalID = $row["GlobalID"];
     $Template->ShareToRepo = $row["ShareToRepo"];
     $Template->KeepLocal = $row["KeepLocal"];
     $Template->MakeDisplay();
     $Template->GetCustomValues();
     if ($extendmodel) {
         // Extend our device model
         if ($Template->DeviceType == "CDU") {
             $cdut = new CDUTemplate();
             $cdut->TemplateID = $Template->TemplateID;
             $cdut->GetTemplate();
             foreach ($cdut as $prop => $val) {
                 $Template->{$prop} = $val;
             }
         }
         if ($Template->DeviceType == "Sensor") {
             $st = new SensorTemplate();
             $st->TemplateID = $Template->TemplateID;
             $st->GetTemplate();
             foreach ($st as $prop => $val) {
                 $Template->{$prop} = $val;
             }
         }
     }
     return $Template;
 }
Example #5
0
 $tpp->TemplateID = $temp->TemplateID;
 $tppList = $tpp->getPorts();
 $postData["templatepowerports"] = array();
 foreach ($tppList as $pport) {
     array_push($postData["templatepowerports"], json_decode(json_encode($pport), true));
 }
 if ($temp->DeviceType == "Chassis") {
     $sList = Slot::getSlots($temp->TemplateID);
     $postData["slots"] = array();
     foreach ($sList as $s) {
         array_push($postData["slots"], json_decode(json_encode($s), true));
     }
 }
 if ($temp->DeviceType == "CDU") {
     $ct->TemplateID = $temp->TemplateID;
     $ct->GetTemplate();
     $postData["cdutemplate"] = json_decode(json_encode($ct), true);
 }
 if ($temp->DeviceType == "Sensor") {
     $sen->TemplateID = $temp->TemplateID;
     $sen->GetTemplate();
     $postData["sensortemplate"] = json_decode(json_encode($sen), true);
 }
 curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($postData));
 $result = curl_exec($c);
 $jr = json_decode($result);
 $postData = array();
 if ($temp->FrontPictureFile != "") {
     $postData["front"] = curl_file_create("pictures/" . $temp->FrontPictureFile);
 }
 if ($temp->RearPictureFile != "") {
Example #6
0
$pdf->Cell(0, 5, $cabmessage, 0, 1, 'C', 0);
$pdf->SetFont($config->ParameterArray['PDFfont'], '', 10);
$PDUList = $pdu->GetPDUbyCabinet();
$headerTags = array(__("Label"), __("NumOutputs"), __("Model"), __("PanelLabel"), __("PanelPole"));
$cellWidths = array(50, 30, 118, 70, 20);
$maxval = count($headerTags);
for ($col = 0; $col < $maxval; $col++) {
    $pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, 'C', 1);
}
$pdf->Ln();
foreach ($PDUList as $PDUrow) {
    $panel->PanelID = $PDUrow->PanelID;
    $panel->getPanel();
    $pdutemp = new CDUTemplate();
    $pdutemp->TemplateID = $PDUrow->TemplateID;
    $pdutemp->GetTemplate();
    $mfg->ManufacturerID = $pdutemp->ManufacturerID;
    $mfg->GetManufacturerByID();
    $pdf->Cell($cellWidths[0], 6, $PDUrow->Label, 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[1], 6, $pdutemp->NumOutlets, 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[2], 6, "[{$mfg->Name}] {$pdutemp->Model}", 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[3], 6, $panel->PanelLabel, 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[4], 6, $PDUrow->PanelPole, 'LBRT', 1, 'L', $fill);
    $pdf->Cell($cellWidths[0], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[1], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[2], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[3], 6, '', 'LBRT', 0, 'L', $fill);
    $pdf->Cell($cellWidths[4], 6, '', 'LBRT', 1, 'L', $fill);
    $fill = !$fill;
}
$pdf->Output();