Example #1
0
		<?php 
    $counter++;
    ?>
	</td>
	<td colspan="3" class="listr ellipsis" summary="address" align="center">
				<div id="gateway<?php 
    echo $counter;
    ?>
" style="display:inline"><b>
					<?php 
    $if_gw = '';
    if (is_ipaddr($gateway['gateway'])) {
        $if_gw = htmlspecialchars($gateway['gateway']);
    } else {
        if ($gateway['ipprotocol'] == "inet") {
            $if_gw = htmlspecialchars(get_interface_gateway($gateway['friendlyiface']));
        }
        if ($gateway['ipprotocol'] == "inet6") {
            $if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
        }
    }
    echo $if_gw == '' ? '~' : $if_gw;
    unset($if_gw);
    $counter++;
    ?>
				</b></div>
			</td>
	</tr>
	<tr>
			<td class="listr ellipsis" align="center" id="gateway<?php 
    echo $counter;
Example #2
0
	<th>Status</td>
</tr>
</thead>
<tbody>
<?php 
foreach ($a_gateways as $gname => $gateway) {
    ?>
	<tr>
		<td>
<?php 
    $if_gw = '';
    if (is_ipaddr($gateway['gateway'])) {
        $if_gw = $gateway['gateway'];
    } else {
        if ($gateway['ipprotocol'] == "inet") {
            $if_gw = get_interface_gateway($gateway['friendlyiface']);
        }
        if ($gateway['ipprotocol'] == "inet6") {
            $if_gw = get_interface_gateway_v6($gateway['friendlyiface']);
        }
    }
    ?>
			<?php 
    echo htmlspecialchars($gateway['name']);
    ?>
<br />
			<i><?php 
    echo $if_gw == '' ? '~' : htmlspecialchars($if_gw);
    ?>
</i>
		</td>
foreach ($periods as $period => $interval) {
    /* check which databases are valid for our category */
    foreach ($databases as $curdatabase) {
        if (!stristr($curdatabase, $curcat)) {
            continue;
        }
        $optionc = split("-", $curdatabase);
        $search = array("-", ".rrd", $optionc);
        $replace = array(" :: ", "", $friendly);
        switch ($curoption) {
            case "outbound":
                /* only show interfaces with a gateway */
                $optionc = "{$optionc['0']}";
                $friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc));
                $realif = convert_friendly_interface_to_real_interface_name(strtolower($optionc));
                $monitorip = get_interface_gateway(strtolower($optionc));
                if ($monitorip == "") {
                    continue 2;
                }
                if (!stristr($curdatabase, $optionc)) {
                    continue 2;
                }
                break;
            case "allgraphs":
                /* make sure we do not show the placeholder databases in the all view */
                if (stristr($curdatabase, "outbound") || stristr($curdatabase, "allgraphs")) {
                    continue 2;
                }
                break;
            default:
                /* just use the name here */
Example #4
0
function compose_table_body_contents()
{
    global $config;
    $rtnstr = '';
    $a_gateways = return_gateways_array();
    $gateways_status = array();
    $gateways_status = return_gateways_status(true);
    if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
        $display_type = $config["widgets"]["gateways_widget"]["display_type"];
    } else {
        $display_type = "gw_ip";
    }
    foreach ($a_gateways as $gname => $gateway) {
        $rtnstr .= "<tr>\n";
        $rtnstr .= "<td>\n";
        $rtnstr .= htmlspecialchars($gateway['name']) . "<br />";
        $rtnstr .= '<div id="gateway' . $counter . '" style="display:inline"><b>';
        $monitor_address = "";
        $monitor_address_disp = "";
        if ($display_type == "monitor_ip" || $display_type == "both_ip") {
            $monitor_address = $gateway['monitor'];
            if ($monitor_address != "" && $display_type == "both_ip") {
                $monitor_address_disp = " (" . $monitor_address . ")";
            } else {
                $monitor_address_disp = $monitor_address;
            }
        }
        $if_gw = '';
        // If the user asked to display Gateway IP or both IPs, or asked for just monitor IP but the monitor IP is blank
        // then find the gateway IP (which is also the monitor IP if the monitor IP was not explicitly set).
        if ($display_type == "gw_ip" || $display_type == "both_ip" || $display_type == "monitor_ip" && $monitor_address == "") {
            if (is_ipaddr($gateway['gateway'])) {
                $if_gw = htmlspecialchars($gateway['gateway']);
            } else {
                if ($gateway['ipprotocol'] == "inet") {
                    $if_gw = htmlspecialchars(get_interface_gateway($gateway['friendlyiface']));
                }
                if ($gateway['ipprotocol'] == "inet6") {
                    $if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
                }
            }
            if ($if_gw == "") {
                $if_gw = "~";
            }
        }
        if ($monitor_address == $if_gw) {
            $monitor_address_disp = "";
        }
        $rtnstr .= $if_gw . $monitor_address_disp;
        unset($if_gw);
        unset($monitor_address);
        unset($monitor_address_disp);
        $counter++;
        $rtnstr .= "</b>";
        $rtnstr .= "</div>\n";
        $rtnstr .= "</td>\n";
        if ($gateways_status[$gname]) {
            if (stristr($gateways_status[$gname]['status'], "force_down")) {
                $online = gettext("Offline (forced)");
                $bgcolor = "danger";
                // lightcoral
            } elseif (stristr($gateways_status[$gname]['status'], "down")) {
                $online = gettext("Offline");
                $bgcolor = "danger";
                // lightcoral
            } elseif (stristr($gateways_status[$gname]['status'], "loss")) {
                $online = gettext("Packetloss");
                $bgcolor = "warning";
                // khaki
            } elseif (stristr($gateways_status[$gname]['status'], "delay")) {
                $online = gettext("Latency");
                $bgcolor = "warning";
                // khaki
            } elseif ($gateways_status[$gname]['status'] == "none") {
                $online = gettext("Online");
                $bgcolor = "success";
                // lightgreen
            } elseif ($gateways_status[$gname]['status'] == "") {
                $online = gettext("Pending");
                $bgcolor = "info";
                // lightgray
            }
        } else {
            $online = gettext("Unknown");
            $bgcolor = "info";
            // lightblue
        }
        $rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['delay']) : gettext("Pending")) . "</td>\n";
        $rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['stddev']) : gettext("Pending")) . "</td>\n";
        $rtnstr .= "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending")) . "</td>\n";
        $rtnstr .= '<td class="bg-' . $bgcolor . '">' . $online . "</td>\n";
        $rtnstr .= "</tr>\n";
    }
    return $rtnstr;
}
Example #5
0
			<?php 
    echo $gateway['name'];
    ?>
	<?php 
    $counter++;
    ?>
	  </td>
	  <td class="listr" align="center" id="gateway<?php 
    echo $counter;
    ?>
">
<?php 
    if (is_ipaddr($gateway['gateway'])) {
        echo $gateway['gateway'];
    } else {
        echo get_interface_gateway($gateway['friendlyiface']);
    }
    ?>
	<?php 
    $counter++;
    ?>
	  </td>
	  <td class="listr" align="center" id="gateway<?php 
    echo $counter;
    ?>
">
<?php 
    if ($gateways_status[$gname]) {
        echo $gateways_status[$gname]['delay'];
    } else {
        echo 'Veri alınıyor.';