<div><label for="SNMPFailureCount">' . __("Consecutive SNMP Failures") . '*</label></div> <div><input type="number" name="SNMPFailureCount" id="SNMPFailureCount" value="' . $dev->SNMPFailureCount . '"></div> </div> </div> <br><span>*' . __("Polling is disabled after three consecutive failures.") . '</span> </fieldset> <fieldset id="cdu" class="hide"> <legend>' . __("Power Specifications") . '</legend> <div class="table"> <div> <div><label for="PanelID">', __("Source Panel"), '</label></div> <div> <select name="PanelID" id="PanelID" > <option value=0>', __("Select Panel"), '</option>'; $Panel = new PowerPanel(); $PanelList = $Panel->getPanelList(); foreach ($PanelList as $key => $value) { $selected = $value->PanelID == $pdu->PanelID ? ' selected' : ""; print "\n\t\t\t\t\t<option value=\"{$value->PanelID}\"{$selected}>{$value->PanelLabel}</option>\n"; } echo ' </select> </div> </div> <div> <div><label for="voltage">', __("Voltages:"), '</label></div> <div id="voltage">'; if ($pdu->PanelID > 0) { $pnl = new PowerPanel(); $pnl->PanelID = $pdu->PanelID; $pnl->getPanel();
$dataMaxValue = sprintf("%.0{$decimalplaces}lf", $panelCap / 1000); $dataHighlights = sprintf("0 %d #eee, %d %d #fffacd, %d %d #eaa", $panelCap / 1000 * 0.6, $panelCap / 1000 * 0.6, $panelCap / 1000 * 0.8, $panelCap / 1000 * 0.8, $panelCap / 1000); $mtarray = implode(",", explode(" ", $dataMajorTicks)); $hilights = sprintf("{from: 0, to: %.0{$decimalplaces}lf, color: '#eee'}, {from: %.0{$decimalplaces}lf, to: %.0{$decimalplaces}lf, color: '#fffacd'}, {from: %.0{$decimalplaces}lf, to: %.0{$decimalplaces}lf, color: '#eaa'}", $panelCap / 1000 * 0.6, $panelCap / 1000 * 0.6, $panelCap / 1000 * 0.8, $panelCap / 1000 * 0.8, $panelCap / 1000); // Generate JS for load display $script = "\n\tvar gauge=new Gauge({\n\t\trenderTo: 'power-gauge',\n\t\ttype: 'canv-gauge',\n\t\ttitle: 'Load',\n\t\tminValue: '0',\n\t\tmaxValue: '{$dataMaxValue}',\n\t\tmajorTicks: [ {$mtarray} ],\n\t\tminorTicks: '2',\n\t\tstrokeTicks: false,\n\t\tunits: 'kW',\n\t\tvalueFormat: { int : 3, dec : 2 },\n\t\tglow: false,\n\t\tanimation: {\n\t\t\tdelay: 10,\n\t\t\tduration: 200,\n\t\t\tfn: 'bounce'\n\t\t\t},\n\t\tcolors: {\n\t\t\tneedle: {start: '#f00', end: '#00f' },\n\t\t\ttitle: '#00f',\n\t\t\t},\n\t\thighlights: [ {$hilights} ],\n\t\t});\n\tgauge.draw().setValue({$panelLoad});\n"; /* Example for updating the gauge later. This will start an endless loop that will update the gauge once a second. setInterval( function() { gauge.setValue($.get('api/v1/power/whateverhere')); }, 1000); */ } $panelList = $panel->getPanelList(); ?> <!doctype html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>openDCIM Data Center Management</title> <link rel="stylesheet" href="css/inventory.php" type="text/css"> <link rel="stylesheet" href="css/jquery-ui.css" type="text/css"> <!--[if lt IE 9]> <link rel="stylesheet" href="css/ie.css" type="text/css"> <![endif]--> <script type="text/javascript" src="scripts/jquery.min.js"></script>