Files

104 lines
2.8 KiB
PHP
Raw Permalink Normal View History

2012-01-12 11:09:45 +00:00
<?php
print_optionbar_start();
echo "<span style='font-weight: bold;'>Serverfarm Rservers</span> &#187; ";
2012-01-12 11:09:45 +00:00
// $auth = TRUE;
$menu_options = array('basic' => 'Basic');
2012-01-12 11:09:45 +00:00
if (!$_GET['opta']) {
$_GET['opta'] = 'basic';
2012-01-12 11:09:45 +00:00
}
$sep = '';
foreach ($menu_options as $option => $text) {
if ($_GET['optd'] == $option) {
echo "<span class='pagemenu-selected'>";
}
2012-01-12 11:09:45 +00:00
echo '<a href="device/device='.$device['device_id'].'/tab=routing/type=loadbalancer_rservers/'.$option.'/">'.$text .'</a>';
if ($_GET['optd'] == $option) {
echo '</span>';
}
2012-01-12 11:09:45 +00:00
echo ' | ';
}
2012-01-12 11:09:45 +00:00
unset($sep);
2012-01-12 11:09:45 +00:00
echo ' Graphs: ';
// $graph_types = array("bits" => "Bits",
// "pkts" => "Packets",
// "errors" => "Errors");
$graph_types = array(
2015-07-13 20:10:26 +02:00
'curr' => 'CurrentConns',
'failed' => 'FailedConns',
'total' => 'TotalConns',
);
foreach ($graph_types as $type => $descr) {
echo "$type_sep";
if ($_GET['opte'] == $type) {
echo "<span class='pagemenu-selected'>";
}
echo '<a href="device/device='.$device['device_id'].'/tab=routing/type=loadbalancer_rservers/graphs/'.$type.'/">'.$descr.'</a>';
if ($_GET['opte'] == $type) {
echo '</span>';
}
$type_sep = ' | ';
2012-01-12 11:09:45 +00:00
}
print_optionbar_end();
echo "<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>";
$i = '0';
foreach (dbFetchRows('SELECT * FROM `loadbalancer_rservers` WHERE `device_id` = ? ORDER BY `farm_id`', array($device['device_id'])) as $rserver) {
if (is_integer($i / 2)) {
2019-06-23 00:29:12 -05:00
$bg_colour = \LibreNMS\Config::get('list_colour.even');
2016-08-18 20:28:22 -05:00
} else {
2019-06-23 00:29:12 -05:00
$bg_colour = \LibreNMS\Config::get('list_colour.odd');
}
if ($rserver['StateDescr'] == 'Server is now operational') {
$rserver_class = 'green';
2016-08-18 20:28:22 -05:00
} else {
$rserver_class = 'red';
}
echo "<tr bgcolor='$bg_colour'>";
// echo("<td width=320 class=list-large>" . $tunnel['local_addr'] . " &#187; " . $tunnel['peer_addr'] . "</a></td>");
echo '<td width=700 class=list-small>'.$rserver['farm_id'].'</a></td>';
// echo("<td width=150 class=box-desc>" . $rserver['farm_id'] . "</td>");
echo "<td width=230 class=list-small><span class='".$rserver_class."'>".$rserver['StateDescr'].'</span></td>';
echo '</tr>';
if ($_GET['optd'] == 'graphs') {
echo '<tr class="list-bold">';
echo '<td colspan = 3>';
$graph_type = 'rserver_'.$_GET['opte'];
$graph_array['height'] = '100';
$graph_array['width'] = '215';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['id'] = $rserver['rserver_id'];
$graph_array['type'] = $graph_type;
2019-04-11 23:26:42 -05:00
require 'includes/html/print-graphrow.inc.php';
2019-04-11 23:26:42 -05:00
// include("includes/html/print-interface-graphs.inc.php");
echo '
2012-01-12 11:09:45 +00:00
</td>
</tr>';
}
2012-01-12 11:09:45 +00:00
echo '</td>';
echo '</tr>';
2012-01-12 11:09:45 +00:00
$i++;
2012-01-12 11:09:45 +00:00
}
echo '</table></div>';