Пример #1
0
 $widget_settings['graph_' . $type] = json_decode($widget_settings['graph_' . $type], true) ?: $widget_settings['graph_' . $type];
 if ($type == 'device') {
     if (empty($widget_settings['title'])) {
         $widget_settings['title'] = $widget_settings['graph_device']['name'] . " / " . $widget_settings['graph_type'];
     }
     $param = 'device=' . $widget_settings['graph_device']['device_id'];
 } elseif ($type == 'application') {
     $param = 'id=' . $widget_settings['graph_' . $type]['app_id'];
 } elseif ($type == 'munin') {
     $param = 'device=' . $widget_settings['graph_' . $type]['device_id'] . '&plugin=' . $widget_settings['graph_' . $type]['name'];
 } elseif ($type == 'transit' || $type == 'peering' || $type == 'core' || $type == 'custom' || $type == 'manual') {
     if ($type == 'custom' || $type == 'manual') {
         $type = $widget_settings['graph_' . $type];
         $type = explode(',', $type);
     }
     $ports = get_ports_from_type($type);
     foreach ($ports as $port) {
         $tmp[] = $port['port_id'];
     }
     $param = 'id=' . implode(',', $tmp);
     $widget_settings['graph_type'] = 'multiport_bits_separate';
     if (empty($widget_settings['title'])) {
         $widget_settings['title'] = 'Overall ' . ucfirst(htmlspecialchars($type)) . ' Bits (' . $widget_settings['graph_range'] . ')';
     }
 } else {
     $param = 'id=' . $widget_settings['graph_' . $type][$type . '_id'];
 }
 if (empty($widget_settings['title'])) {
     $widget_settings['title'] = $widget_settings['graph_' . $type]['hostname'] . " / " . $widget_settings['graph_' . $type]['name'] . " / " . $widget_settings['graph_type'];
 }
 $common_output[] = '<a href="graphs/' . $param . '/type=' . $widget_settings['graph_type'] . '/from=' . $config['time'][$widget_settings['graph_range']] . '"><img class="minigraph-image" width="' . $widget_dimensions['x'] . '" height="' . $widget_dimensions['y'] . '" src="graph.php?' . $param . '&from=' . $config['time'][$widget_settings['graph_range']] . '&to=' . $config['time']['now'] . '&width=' . $widget_dimensions['x'] . '&height=' . $widget_dimensions['y'] . '&type=' . $widget_settings['graph_type'] . '&legend=' . ($widget_settings['graph_legend'] == 1 ? 'yes' : 'no') . '&absolute=1"/></a>';
Пример #2
0
function get_graph_by_portgroup()
{
    global $config;
    $app = \Slim\Slim::getInstance();
    $router = $app->router()->getCurrentRoute()->getParams();
    $group = $router['group'];
    $vars = array();
    if (!empty($_GET['from'])) {
        $vars['from'] = $_GET['from'];
    }
    if (!empty($_GET['to'])) {
        $vars['to'] = $_GET['to'];
    }
    $vars['width'] = $_GET['width'] ?: 1075;
    $vars['height'] = $_GET['height'] ?: 300;
    $auth = '1';
    $ports = get_ports_from_type(explode(',', $group));
    $if_list = '';
    $seperator = '';
    foreach ($ports as $port) {
        $if_list .= $seperator . $port['port_id'];
        $seperator = ',';
    }
    unset($seperator);
    $vars['type'] = 'multiport_bits_separate';
    $vars['id'] = $if_list;
    $app->response->headers->set('Content-Type', 'image/png');
    include 'includes/graphs/graph.inc.php';
}
Пример #3
0
    <tr bgcolor='$iftype'>
        <th>Device</th>
        <th>Interface</th>
        <th>Speed</th>
        <th>Circuit</th>
        <th>Notes</th>
    </tr>

<?php 
if ($bg == '#ffffff') {
    $bg = '#e5e5e5';
} else {
    $bg = '#ffffff';
}
$types_array = explode(',', $vars['type']);
$ports = get_ports_from_type($types_array);
foreach ($ports as $port) {
    $if_list .= $seperator . $port['port_id'];
    $seperator = ',';
}
unset($seperator);
for ($i = 0; $i < count($types_array); $i++) {
    $types_array[$i] = ucfirst($types_array[$i]);
}
$types = implode(' + ', $types_array);
echo "<tr class='iftype'>\n    <td colspan='5'><span class=list-large>Total Graph for ports of type : " . $types . '</span><br />';
if ($if_list) {
    $graph_type = 'multiport_bits_separate';
    $port['port_id'] = $if_list;
    include 'includes/print-interface-graphs.inc.php';
    echo '</td></tr>';