Exemplo n.º 1
0
function print_graph_row($graph_array)
{
    global $config;
    if ($_SESSION['widescreen']) {
        if ($_SESSION['big_graphs']) {
            if (!$graph_array['height']) {
                $graph_array['height'] = "110";
            }
            if (!$graph_array['width']) {
                $graph_array['width'] = "353";
            }
            $periods = array('sixhour', 'week', 'month', 'year');
        } else {
            if (!$graph_array['height']) {
                $graph_array['height'] = "110";
            }
            if (!$graph_array['width']) {
                $graph_array['width'] = "215";
            }
            $periods = array('sixhour', 'day', 'week', 'month', 'year', 'twoyear');
        }
    } else {
        if ($_SESSION['big_graphs']) {
            if (!$graph_array['height']) {
                $graph_array['height'] = "100";
            }
            if (!$graph_array['width']) {
                $graph_array['width'] = "323";
            }
            $periods = array('day', 'week', 'month');
        } else {
            if (!$graph_array['height']) {
                $graph_array['height'] = "100";
            }
            if (!$graph_array['width']) {
                $graph_array['width'] = "228";
            }
            $periods = array('day', 'week', 'month', 'year');
        }
    }
    if ($graph_array['shrink']) {
        $graph_array['width'] = $graph_array['width'] - $graph_array['shrink'];
    }
    $graph_array['to'] = $config['time']['now'];
    foreach ($periods as $period) {
        $graph_array['from'] = $config['time'][$period];
        $graph_array_zoom = $graph_array;
        $graph_array_zoom['height'] = "175";
        $graph_array_zoom['width'] = "600";
        $link_array = $graph_array;
        $link_array['page'] = "graphs";
        unset($link_array['height'], $link_array['width']);
        $link = generate_url($link_array);
        echo overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
    }
}
Exemplo n.º 2
0
            $graph_array = array();
            $graph_array['height'] = "100";
            $graph_array['width'] = "210";
            $graph_array['to'] = $config['time']['now'];
            $graph_array['device'] = $device['device_id'];
            $graph_array['mod'] = $index;
            $graph_array['chan'] = $subindex;
            $graph_array['type'] = "c6kxbar_util";
            $graph_array['from'] = $config['time']['day'];
            $graph_array['legend'] = "no";
            $link_array = $graph_array;
            $link_array['page'] = "graphs";
            unset($link_array['height'], $link_array['width'], $link_array['legend']);
            $link = generate_url($link_array);
            $text_descr = $entity['entPhysicalName'] . " - Fabric " . $subindex;
            $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr);
            $graph_array['width'] = 80;
            $graph_array['height'] = 20;
            $graph_array['bg'] = 'ffffff00';
            $graph_array['style'][] = 'margin-top: -6px';
            $minigraph = generate_graph_tag($graph_array);
            echo '<tr class="' . $background['class'] . '">
          <td class="state-marker"></td>
          <td width=150><strong>Fabric ' . $subindex . '</strong></td>
          <td><span style="font-weight: bold;" class="label label-' . $fabric['mode_class'] . '">' . $fabric['cc6kxbarModuleChannelFabStatus'] . "</span></td>\n          <td>" . formatRates($fabric['cc6kxbarModuleChannelSpeed'] * 1000000) . "</td>\n          <td>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n          <td width=125>" . print_percentage_bar(125, 20, $percent_in, "Ingress", "ffffff", $background['left'], $percent_in . "%", "ffffff", $background['right']) . "</td>\n          <td width=125>" . print_percentage_bar(125, 20, $percent_out, "Egress", "ffffff", $background['left'], $percent_out . "%", "ffffff", $background['right']) . "</td>\n          </tr>";
        }
    }
}
echo "</table>";
echo generate_box_close();
// EOF
Exemplo n.º 3
0
     foreach ($int_links as $int_link) {
         $link_if = get_port_by_id_cache($int_link);
         $link_dev = device_by_id_cache($link_if['device_id']);
         echo $br;
         if ($int_links_phys[$int_link]) {
             echo '<a alt="Directly connected" class="oicon-connect"></a> ';
         } else {
             echo '<a alt="Same subnet" class="oicon-network-hub"></a> ';
         }
         echo "<b>" . generate_port_link($link_if, short_ifname($link_if['label'])) . " on " . generate_device_link($link_dev, short_hostname($link_dev['hostname'])) . "</b>";
         ## FIXME -- do something fancy here.
         if ($int_links_v6[$int_link]) {
             echo ' ', overlib_link('', '<span class="label label-success">IPv6</span>', implode("<br />", $int_links_v6[$int_link]), NULL);
         }
         if ($int_links_v4[$int_link]) {
             echo ' ', overlib_link('', '<span class="label label-info">IPv4</span>', implode("<br />", $int_links_v4[$int_link]), NULL);
         }
         $br = "<br />";
     }
 }
 if (!isset($ports_has_ext['pseudowires']) || in_array($port['port_id'], $ports_has_ext['pseudowires'])) {
     foreach (dbFetchRows("SELECT * FROM `pseudowires` WHERE `port_id` = ?", array($port['port_id'])) as $pseudowire) {
         //`port_id`,`peer_device_id`,`peer_ldp_id`,`cpwVcID`,`cpwOid`
         #    $pw_peer_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($pseudowire['peer_device_id']));
         $pw_peer_int = dbFetchRow("SELECT * FROM `ports` AS I, `pseudowires` AS P WHERE I.`device_id` = ? AND P.`cpwVcID` = ? AND P.`port_id` = I.`port_id`", array($pseudowire['peer_device_id'], $pseudowire['cpwVcID']));
         #    $pw_peer_int = get_port_by_id_cache($pseudowire['peer_device_id']);
         $pw_peer_dev = device_by_id_cache($pseudowire['peer_device_id']);
         if (is_array($pw_peer_int)) {
             humanize_port($pw_peer_int);
             echo $br . '<i class="oicon-arrow-switch"></i> <strong>' . generate_port_link($pw_peer_int, short_ifname($pw_peer_int['label'])) . ' on ' . generate_device_link($pw_peer_dev, short_hostname($pw_peer_dev['hostname'])) . '</strong>';
         } else {
            $graph_array['legend'] = "no";
            $link_array = $graph_array;
            $link_array['page'] = "graphs";
            unset($link_array['height'], $link_array['width'], $link_array['legend']);
            $link = generate_url($link_array);
            $overlib_content = generate_overlib_content($graph_array);
            $graph_array['width'] = 80;
            $graph_array['height'] = 20;
            $graph_array['bg'] = 'ffffff00';
            # the 00 at the end makes the area transparent.
            $graph_array['from'] = $config['time']['day'];
            $graph_array['style'][] = 'margin-top: -6px';
            $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, '');
            if ($sensor['sensor_state']) {
                $sensor_value = $sensor['state_name'];
                $sensor_minigraph = overlib_link($link, generate_graph_tag($graph_array), $overlib_content);
            } else {
                $sensor_value = $sensor['human_value'];
                $sensor_minigraph = overlib_link($link, generate_graph_tag($graph_array), $overlib_content);
            }
            echo '<tr class="device-overview">
            <td><strong>' . overlib_link($link, $sensor['sensor_descr'], $overlib_content) . '</strong></td>
            <td style="width: 90px; align: right;">' . $sensor_minigraph . '</td>
            <td style="width: 80px; align: right;">' . overlib_link($link, '<span class="' . $sensor['state_class'] . '">' . $sensor_value . $sensor['sensor_symbol'] . '</span>', $overlib_content) . '</td>
            </tr>' . PHP_EOL;
        }
        echo "</table>";
        echo "</div></div>";
    }
}
// EOF
Exemplo n.º 5
0
     $peer['bgpPeerIdentifier'] = Net_IPv6::compress($peer['bgpPeerIdentifier']);
 }
 // display overlib graphs
 $graph_array = array();
 $graph_array['type'] = 'bgp_updates';
 $graph_array['id'] = $peer['bgpPeer_id'];
 $graph_array['to'] = $config['time']['now'];
 $graph_array['from'] = $config['time']['day'];
 $graph_array['height'] = '110';
 $graph_array['width'] = $width;
 // Peer Address
 $graph_array_zoom = $graph_array;
 $graph_array_zoom['height'] = '150';
 $graph_array_zoom['width'] = '500';
 $overlib_link = "device/device=" . $peer['device_id'] . "/tab=routing/proto=bgp/";
 $peeraddresslink = "<span class=list-large>" . overlib_link(NULL, $peer['bgpPeerIdentifier'], generate_graph_tag($graph_array_zoom), NULL) . "</span>";
 echo '<tr bgcolor="' . $bg_colour . '"' . ($peer['alert'] ? ' bordercolor="#cc0000"' : '') . ($peer['disabled'] ? ' bordercolor="#cccccc"' : '') . '>
     ';
 echo '   <td width=20><span class=list-large>' . $i . '</span></td>
     <td>' . $peeraddresslink . '<br />' . $peername . "</td>\n        <td>{$peer_type}</td>\n        <td style='font-size: 10px; font-weight: bold; line-height: 10px;'>" . (isset($peer['afi']) ? $peer['afi'] : '') . '</td>
     <td><strong>AS' . $peer['bgpPeerRemoteAs'] . '</strong><br />' . $peer['astext'] . "</td>\n        <td><strong><span style='color: {$admin_col};'>" . $peer['bgpPeerAdminStatus'] . "<span><br /><span style='color: {$col};'>" . $peer['bgpPeerState'] . '</span></strong></td>
     <td>' . formatUptime($peer['bgpPeerFsmEstablishedTime']) . "<br />\n        Updates <img src='images/16/arrow_down.png' align=absmiddle> " . $peer['bgpPeerInUpdates'] . "\n        <img src='images/16/arrow_up.png' align=absmiddle> " . $peer['bgpPeerOutUpdates'] . '</td>
     </tr>
     <tr height=5></tr>';
 unset($invalid);
 switch ($vars['view']) {
     case 'prefixes_ipv4unicast':
     case 'prefixes_ipv4multicast':
     case 'prefixes_ipv4vpn':
     case 'prefixes_ipv6unicast':
     case 'prefixes_ipv6multicast':
Exemplo n.º 6
0
function generate_ap_link($args, $text = NULL, $type = NULL, $escape = FALSE)
{
    global $config;
    humanize_port($args);
    if (!$text) {
        $text = rewrite_ifname($args['port_label'], !$escape);
    }
    // Negative escape flag for exclude double escape
    if ($type) {
        $args['graph_type'] = $type;
    }
    if (!isset($args['graph_type'])) {
        $args['graph_type'] = 'port_bits';
    }
    if (!isset($args['hostname'])) {
        $args = array_merge($args, device_by_id_cache($args['device_id']));
    }
    $content = "<div class=entity-title>" . $args['text'] . " - " . rewrite_ifname($args['port_label'], !$escape) . "</div>";
    if ($args['ifAlias']) {
        $content .= $args['ifAlias'] . "<br />";
    }
    $content .= "<div style=\\'width: 850px\\'>";
    $graph_array['type'] = $args['graph_type'];
    $graph_array['legend'] = "yes";
    $graph_array['height'] = "100";
    $graph_array['width'] = "340";
    $graph_array['to'] = $config['time']['now'];
    $graph_array['from'] = $config['time']['day'];
    $graph_array['id'] = $args['accesspoint_id'];
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $config['time']['week'];
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $config['time']['month'];
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $config['time']['year'];
    $content .= generate_graph_tag($graph_array);
    $content .= "</div>";
    $url = generate_ap_url($args);
    if (port_permitted($args['interface_id'], $args['device_id'])) {
        return overlib_link($url, $text, $content, $class, $escape);
    } else {
        return rewrite_ifname($text);
    }
}
/**
 * Display syslog messages.
 *
 * Display pages with device syslog messages.
 * Examples:
 * print_syslogs() - display last 10 syslog messages from all devices
 * print_syslogs(array('pagesize' => 99)) - display last 99 syslog messages from all device
 * print_syslogs(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 syslog messages from page 3 with pagination header
 * print_syslogs(array('pagesize' => 10, 'device' = 4)) - display last 10 syslog messages for device_id 4
 * print_syslogs(array('short' => TRUE)) - show small block with last syslog messages
 *
 * @param array $vars
 * @return none
 *
 */
function print_syslogs($vars)
{
    // Short events? (no pagination, small out)
    $short = isset($vars['short']) && $vars['short'];
    // With pagination? (display page numbers in header)
    $pagination = isset($vars['pagination']) && $vars['pagination'];
    $pageno = isset($vars['pageno']) && !empty($vars['pageno']) ? $vars['pageno'] : 1;
    $pagesize = isset($vars['pagesize']) && !empty($vars['pagesize']) ? $vars['pagesize'] : 10;
    $start = $pagesize * $pageno - $pagesize;
    $priorities = $GLOBALS['config']['syslog']['priorities'];
    $param = array();
    $where = ' WHERE 1 ';
    foreach ($vars as $var => $value) {
        if ($value != '') {
            $cond = array();
            switch ($var) {
                case 'device':
                case 'device_id':
                    $where .= ' AND `device_id` = ?';
                    $param[] = $value;
                    break;
                case 'priority':
                    if (!is_array($value)) {
                        $value = array($value);
                    }
                    foreach ($value as $k => $v) {
                        // Rewrite priority strings to numbers
                        $value[$k] = priority_string_to_numeric($v);
                    }
                    // Do not break here, it's true!
                // Do not break here, it's true!
                case 'program':
                    if (!is_array($value)) {
                        $value = array($value);
                    }
                    foreach ($value as $v) {
                        $cond[] = '?';
                        $param[] = $v === '[[EMPTY]]' ? '' : $v;
                    }
                    $where .= " AND `{$var}` IN (";
                    $where .= implode(', ', $cond);
                    $where .= ')';
                    break;
                case 'message':
                    foreach (explode(',', $value) as $val) {
                        $param[] = '%' . $val . '%';
                        $cond[] = '`msg` LIKE ?';
                    }
                    $where .= 'AND (';
                    $where .= implode(' OR ', $cond);
                    $where .= ')';
                    break;
                case 'timestamp_from':
                    $where .= ' AND `timestamp` > ?';
                    $param[] = $value;
                    break;
                case 'timestamp_to':
                    $where .= ' AND `timestamp` < ?';
                    $param[] = $value;
                    break;
            }
        }
    }
    // Show events only for permitted devices
    $query_permitted = generate_query_permitted();
    $query = 'FROM `syslog` ';
    $query .= $where . $query_permitted;
    $query_count = 'SELECT COUNT(`seq`) ' . $query;
    $query = 'SELECT * ' . $query;
    $query .= ' ORDER BY `seq` DESC ';
    $query .= "LIMIT {$start},{$pagesize}";
    // Query syslog messages
    $entries = dbFetchRows($query, $param);
    // Query syslog count
    if ($pagination && !$short) {
        $count = dbFetchCell($query_count, $param);
    } else {
        $count = count($entries);
    }
    if (!$count) {
        // There have been no entries returned. Print the warning.
        print_warning('<h4>No syslog entries found!</h4>
Check that the syslog daemon and Observium configuration options are set correctly, that your devices are configured to send syslog to Observium and that there are no firewalls blocking the messages.

See <a href="http://www.observium.org/wiki/Category:Documentation" target="_blank">documentation</a> and <a href="http://www.observium.org/wiki/Configuration_Options#Syslog_Settings" target="_blank">configuration options</a> for more information.');
    } else {
        // Entries have been returned. Print the table.
        $list = array('device' => FALSE, 'priority' => TRUE);
        // For now (temporarily) priority always displayed
        if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'syslog') {
            $list['device'] = TRUE;
        }
        if ($short || !isset($vars['priority']) || empty($vars['priority'])) {
            $list['priority'] = TRUE;
        }
        $string = '<table class="table table-bordered table-striped table-hover table-condensed-more">' . PHP_EOL;
        if (!$short) {
            $string .= '  <thead>' . PHP_EOL;
            $string .= '    <tr>' . PHP_EOL;
            $string .= '      <th>Date</th>' . PHP_EOL;
            if ($list['device']) {
                $string .= '      <th>Device</th>' . PHP_EOL;
            }
            if ($list['priority']) {
                $string .= '      <th>Priority</th>' . PHP_EOL;
            }
            $string .= '      <th>Message</th>' . PHP_EOL;
            $string .= '    </tr>' . PHP_EOL;
            $string .= '  </thead>' . PHP_EOL;
        }
        $string .= '  <tbody>' . PHP_EOL;
        foreach ($entries as $entry) {
            $string .= '  <tr>';
            if ($short) {
                $string .= '    <td class="syslog" style="white-space: nowrap">';
                $timediff = $GLOBALS['config']['time']['now'] - strtotime($entry['timestamp']);
                $string .= overlib_link('', formatUptime($timediff, "short-3"), format_timestamp($entry['timestamp']), NULL) . '</td>' . PHP_EOL;
            } else {
                $string .= '    <td width="160">';
                $string .= format_timestamp($entry['timestamp']) . '</td>' . PHP_EOL;
            }
            if ($list['device']) {
                $dev = device_by_id_cache($entry['device_id']);
                $device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'syslog');
                $string .= '    <td class="entity">' . generate_device_link($dev, short_hostname($dev['hostname']), $device_vars) . '</td>' . PHP_EOL;
            }
            if ($list['priority']) {
                if (!$short) {
                    $string .= '    <td style="color: ' . $priorities[$entry['priority']]['color'] . '; white-space: nowrap;">' . nicecase($priorities[$entry['priority']]['name']) . ' (' . $entry['priority'] . ')</td>' . PHP_EOL;
                }
            }
            $entry['program'] = empty($entry['program']) ? '[[EMPTY]]' : $entry['program'];
            if ($short) {
                $string .= '    <td class="syslog">';
                $string .= '<strong style="color: ' . $priorities[$entry['priority']]['color'] . ';">' . $entry['program'] . '</strong> : ';
            } else {
                $string .= '    <td>';
                $string .= '<strong>' . $entry['program'] . '</strong> : ';
            }
            $string .= htmlspecialchars($entry['msg']) . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
        }
        $string .= '  </tbody>' . PHP_EOL;
        $string .= '</table>' . PHP_EOL;
        // Print pagination header
        if ($pagination && !$short) {
            $string = pagination($vars, $count) . $string . pagination($vars, $count);
        }
        // Print syslog
        echo $string;
    }
}
        }
        $perc = round($drive['storage_perc'], 0);
        $total = formatStorage($drive['storage_size']);
        $free = formatStorage($drive['storage_free']);
        $used = formatStorage($drive['storage_used']);
        $graph_array['type'] = $graph_type;
        $graph_array['id'] = $drive['storage_id'];
        $graph_array['from'] = $config['time']['day'];
        $graph_array['to'] = $config['time']['now'];
        $graph_array['height'] = "20";
        $graph_array['width'] = "80";
        $graph_array_zoom = $graph_array;
        $graph_array_zoom['height'] = "150";
        $graph_array_zoom['width'] = "400";
        $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/";
        $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
        $background = get_percentage_colours($perc);
        echo "<tr class='health'><td>" . generate_device_link($drive) . "</td><td class=tablehead>" . $drive['storage_descr'] . "</td>\n         <td>{$mini_graph}</td>\n         <td>\n          <a href='#' {$store_popup}>" . print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $background['left'], $free, "ffffff", $background['right']) . "</a>\n          </td><td>{$perc}" . "%</td></tr>";
        if ($vars['view'] == "graphs") {
            echo "<tr></tr><tr class='health'><td colspan=5>";
            $graph_array['height'] = "100";
            $graph_array['width'] = "216";
            $graph_array['to'] = $config['time']['now'];
            $graph_array['id'] = $drive['storage_id'];
            $graph_array['type'] = $graph_type;
            include "includes/print-graphrow.inc.php";
            echo "</td></tr>";
        }
        # endif graphs
    }
}
Exemplo n.º 9
0
// <th></th>
// </tr>");
$row = 1;
foreach (dbFetchRows('SELECT * FROM `ucd_diskio` WHERE device_id = ? ORDER BY diskio_descr', array($device['device_id'])) as $drive) {
    if (is_integer($row / 2)) {
        $row_colour = $list_colour_a;
    } else {
        $row_colour = $list_colour_b;
    }
    $fs_url = 'device/device=' . $device['device_id'] . '/tab=health/metric=diskio/';
    $graph_array_zoom['id'] = $drive['diskio_id'];
    $graph_array_zoom['type'] = 'diskio_ops';
    $graph_array_zoom['width'] = '400';
    $graph_array_zoom['height'] = '125';
    $graph_array_zoom['from'] = $config['time']['twoday'];
    $graph_array_zoom['to'] = $config['time']['now'];
    echo "<tr bgcolor='{$row_colour}'><th>";
    echo overlib_link($fs_url, $drive['diskio_descr'], generate_graph_tag($graph_array_zoom), null);
    echo '</th></tr>';
    $types = array('diskio_bits', 'diskio_ops');
    foreach ($types as $graph_type) {
        echo '<tr bgcolor="' . $row_colour . '"><td colspan=5>';
        $graph_array = array();
        $graph_array['id'] = $drive['diskio_id'];
        $graph_array['type'] = $graph_type;
        include 'includes/print-graphrow.inc.php';
        echo '</td></tr>';
    }
    $row++;
}
echo '</table>';
Exemplo n.º 10
0
/**
 * Display events.
 *
 * Display pages with device/port/system events on some formats.
 * Examples:
 * print_events() - display last 10 events from all devices
 * print_events(array('pagesize' => 99)) - display last 99 events from all device
 * print_events(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 events from page 3 with pagination header
 * print_events(array('pagesize' => 10, 'device' = 4)) - display last 10 events for device_id 4
 * print_events(array('short' => TRUE)) - show small block with last events
 *
 * @param array $vars
 * @return none
 *
 */
function print_events($vars)
{
    // Get events array
    $events = get_events_array($vars);
    if (!$events['count']) {
        // There have been no entries returned. Print the warning.
        print_warning('<h4>No eventlog entries found!</h4>');
    } else {
        // Entries have been returned. Print the table.
        $list = array('device' => FALSE, 'port' => FALSE);
        if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'eventlog') {
            $list['device'] = TRUE;
        }
        if ($events['short'] || !isset($vars['port']) || empty($vars['port'])) {
            $list['port'] = TRUE;
        }
        $string = '<table class="table table-bordered table-striped table-hover table-condensed-more">' . PHP_EOL;
        if (!$events['short']) {
            $string .= '  <thead>' . PHP_EOL;
            $string .= '    <tr>' . PHP_EOL;
            $string .= '      <th>Date</th>' . PHP_EOL;
            if ($list['device']) {
                $string .= '      <th>Device</th>' . PHP_EOL;
            }
            if ($list['port']) {
                $string .= '      <th>Entity</th>' . PHP_EOL;
            }
            $string .= '      <th>Message</th>' . PHP_EOL;
            $string .= '    </tr>' . PHP_EOL;
            $string .= '  </thead>' . PHP_EOL;
        }
        $string .= '  <tbody>' . PHP_EOL;
        foreach ($events['entries'] as $entry) {
            $icon = geteventicon($entry['message']);
            if ($icon) {
                $icon = '<img src="images/16/' . $icon . '" />';
            }
            $string .= '  <tr>' . PHP_EOL;
            if ($events['short']) {
                $string .= '    <td class="syslog" style="white-space: nowrap">';
                $timediff = $GLOBALS['config']['time']['now'] - strtotime($entry['timestamp']);
                $string .= overlib_link('', formatUptime($timediff, "short-3"), format_timestamp($entry['timestamp']), NULL) . '</td>' . PHP_EOL;
            } else {
                $string .= '    <td style="width: 160px">';
                $string .= format_timestamp($entry['timestamp']) . '</td>' . PHP_EOL;
            }
            if ($list['device']) {
                $dev = device_by_id_cache($entry['device_id']);
                $device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'eventlog');
                $string .= '    <td class="entity">' . generate_device_link($dev, short_hostname($dev['hostname']), $device_vars) . '</td>' . PHP_EOL;
            }
            if ($list['port']) {
                if ($entry['type'] == 'port') {
                    $this_if = get_port_by_id_cache($entry['reference']);
                    $entry['link'] = '<span class="entity">' . generate_port_link($this_if, short_ifname($this_if['label'])) . '</span>';
                } else {
                    $entry['link'] = ucfirst($entry['type']);
                }
                if (!$events['short']) {
                    $string .= '    <td>' . $entry['link'] . '</td>' . PHP_EOL;
                }
            }
            if ($events['short']) {
                $string .= '    <td class="syslog">' . $entry['link'] . ' ';
            } else {
                $string .= '    <td>';
            }
            $string .= htmlspecialchars($entry['message']) . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
        }
        $string .= '  </tbody>' . PHP_EOL;
        $string .= '</table>';
        // Print pagination header
        if ($events['pagination_html']) {
            $string = $events['pagination_html'] . $string . $events['pagination_html'];
        }
        // Print events
        echo $string;
    }
}
<?php

global $config;
if (!$graph_type) {
    $graph_type = $_GET['type'];
}
if (!$device) {
    $device['device_id'] = getifhost($interface['interface_id']);
}
$graph_array['height'] = "100";
$graph_array['width'] = "215";
$graph_array['to'] = $now;
$graph_array['port'] = $interface['interface_id'];
$graph_array['type'] = $graph_type;
$periods = array('day', 'week', 'month', 'year');
foreach ($periods as $period) {
    $graph_array['from'] = ${$period};
    $graph_array_zoom = $graph_array;
    $graph_array_zoom['height'] = "150";
    $graph_array_zoom['width'] = "400";
    echo overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
}
Exemplo n.º 12
0
function generatedevicelink($device, $text = 0, $start = 0, $end = 0)
{
    global $twoday;
    global $day;
    global $now;
    global $config;
    if (!$start) {
        $start = $day;
    }
    if (!$end) {
        $end = $now;
    }
    $class = devclass($device);
    if (!$text) {
        $text = $device['hostname'];
    }
    $graph_url = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&amp;from={$start}&amp;to={$end}&amp;width=400&amp;height=120&amp;type=device_cpu";
    $graph_url_b = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&amp;from={$start}&amp;to={$end}&amp;width=400&amp;height=120&amp;type=device_memory";
    $url = $config['base_url'] . "/device/" . $device['device_id'] . "/";
    $contents = "<div class=list-large>" . $device['hostname'] . " - CPU &amp; Memory Usage</div>";
    if (isset($device['location'])) {
        $contents .= "" . htmlentities($device['location'] . "<br />");
    }
    $contents .= "<img src=\\'{$graph_url}\\'><br /><img src=\\'{$graph_url_b}\\'";
    $text = htmlentities($text);
    $link = overlib_link($url, $text, $contents, $class);
    return $link;
}
Exemplo n.º 13
0
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $sensor['sensor_id'];
        $graph_array['type'] = $graph_type;
        $graph_array['from'] = $config['time']['day'];
        $graph_array['legend'] = "no";
        $link_array = $graph_array;
        $link_array['page'] = "graphs";
        unset($link_array['height'], $link_array['width'], $link_array['legend']);
        $link = generate_url($link_array);
        $overlib_content = '<div style="width: 580px;"><h2>' . $device['hostname'] . " - " . $sensor['sensor_descr'] . "</h1>";
        foreach (array('day', 'week', 'month', 'year') as $period) {
            $graph_array['from'] = $config['time'][$period];
            $overlib_content .= str_replace('"', "\\'", generate_graph_tag($graph_array));
        }
        $overlib_content .= "</div>";
        $graph_array['width'] = 80;
        $graph_array['height'] = 20;
        $graph_array['bg'] = 'ffffff00';
        # the 00 at the end makes the area transparent.
        $graph_array['from'] = $config['time']['day'];
        $sensor_minigraph = generate_graph_tag($graph_array);
        $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, '');
        echo "<tr>\n           <td><strong>" . overlib_link($link, $sensor['sensor_descr'], $overlib_content) . "</strong></td>\n           <td>" . overlib_link($link, $sensor_minigraph, $overlib_content) . "</td>\n           <td>" . overlib_link($link, "<span " . ($sensor['sensor_current'] < $sensor['sensor_limit_low'] || $sensor['sensor_current'] > $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . "</span>", $overlib_content) . "</td>\n          </tr>";
    }
    echo "</table>";
    echo "</div>";
    echo "</div>";
    echo "</div>";
    echo "</div>";
}
        $graph_array = array();
        $graph_array['height'] = "100";
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['device'] = $device['device_id'];
        $graph_array['id'] = $proc['id'];
        $graph_array['type'] = $graph_type;
        $graph_array['from'] = $config['time']['day'];
        $graph_array['legend'] = "no";
        $link_array = $graph_array;
        $link_array['page'] = "graphs";
        unset($link_array['height'], $link_array['width'], $link_array['legend']);
        $link = generate_url($link_array);
        $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr);
        $graph_array['width'] = 80;
        $graph_array['height'] = 20;
        $graph_array['bg'] = 'ffffff00';
        # the 00 at the end makes the area transparent.
        //    $graph_array['style'][] = 'margin-top: -6px';
        $minigraph = generate_graph_tag($graph_array);
        $count_button = $proc['count'] > 1 ? '<span class="label pull-right" style="margin-top: 2px; font-size: 11px;"><i class="icon-remove"></i> ' . $proc['count'] . '</span>' : '';
        echo '<tr>
           <td><span class="entity">' . overlib_link($link, $text_descr, $overlib_content) . '</span>' . $count_button . '</td>
           <td style="width: 90px">' . overlib_link($link, $minigraph, $overlib_content) . '</td>
           <td style="width: 200px">' . overlib_link($link, print_percentage_bar(200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content) . '</td>
         </tr>';
    }
    echo "</table>";
    echo "</div></div>";
}
// EOF
Exemplo n.º 15
0
            $background_in = get_percentage_colours($percent_in);
            $percent_out = $fabric['cc6kxbarStatisticsOutUtil'];
            $background_out = get_percentage_colours($percent_out);
            $graph_array = array();
            $graph_array['height'] = "100";
            $graph_array['width'] = "210";
            $graph_array['to'] = $config['time']['now'];
            $graph_array['device'] = $device['device_id'];
            $graph_array['mod'] = $index;
            $graph_array['chan'] = $subindex;
            $graph_array['type'] = "c6kxbar_util";
            $graph_array['from'] = $config['time']['day'];
            $graph_array['legend'] = "no";
            $link_array = $graph_array;
            $link_array['page'] = "graphs";
            unset($link_array['height'], $link_array['width'], $link_array['legend']);
            $link = generate_url($link_array);
            $text_descr = $entity['entPhysicalName'] . " - Fabric " . $subindex;
            $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr);
            $graph_array['width'] = 80;
            $graph_array['height'] = 20;
            $graph_array['bg'] = 'ffffff00';
            # the 00 at the end makes the area transparent.
            $graph_array['style'][] = 'margin-top: -6px';
            $minigraph = generate_graph_tag($graph_array);
            echo "<tr class=device-overview>\n          <td width=10></td>\n          <td width=150><strong>Fabric " . $subindex . "</strong></td>\n          <td><span style='font-weight: bold;' class=" . $fabric['mode_class'] . ">" . $fabric['cc6kxbarModuleChannelFabStatus'] . "</span></td>\n          <td>" . formatRates($fabric['cc6kxbarModuleChannelSpeed'] * 1000000) . "</td>\n          <td>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n          <td width=125>" . print_percentage_bar(125, 20, $percent_in, "Ingress", "ffffff", $background['left'], $percent_in . "%", "ffffff", $background['right']) . "</td>\n          <td width=125>" . print_percentage_bar(125, 20, $percent_out, "Egress", "ffffff", $background['left'], $percent_out . "%", "ffffff", $background['right']) . "</td>\n          </tr>";
        }
    }
}
echo "</table>";
echo "</div></div>";
Exemplo n.º 16
0
        $graph_array['type'] = 'device_processor';
        $graph = generate_lazy_graph_tag($graph_array);
        //Generate link to graphs
        $link_array = $graph_array;
        $link_array['page'] = 'graphs';
        unset($link_array['height'], $link_array['width']);
        $link = generate_url($link_array);
        //Generate tooltip
        $graph_array['width'] = '210';
        $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . ' - CPU usage');
        echo '<tr>
              <td colspan="4">';
        echo overlib_link($link, $graph, $overlib_content, null);
        echo '  </td>
            </tr>';
        //Add a row with CPU desc, count and percent graph
        $totalPercent = $totalPercent / count($processors);
        $background = get_percentage_colours($totalPercent);
        echo '<tr>
             <td>' . overlib_link($link, $text_descr, $overlib_content) . '</td>
             <td>' . overlib_link($link, 'x' . count($processors), $overlib_content) . '</td>
             <td>' . overlib_link($link, print_percentage_bar(200, 20, $totalPercent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']), $overlib_content) . '</td>
           </tr>';
    }
    echo '</table>
        </div>
        </div>
        </div>
        </div>';
}
//end if
Exemplo n.º 17
0
        //$total = formatStorage($toner['toner_size']);
        //$free = formatStorage($toner['toner_free']);
        //$used = formatStorage($toner['toner_used']);
        $background = toner2colour($toner['toner_descr'], $percent);
        $graph_array = array();
        $graph_array['height'] = "100";
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $toner['toner_id'];
        $graph_array['type'] = $graph_type;
        $graph_array['from'] = $config['time']['day'];
        $graph_array['legend'] = "no";
        $link_array = $graph_array;
        $link_array['page'] = "graphs";
        unset($link_array['height'], $link_array['width'], $link_array['legend']);
        $link = generate_url($link_array);
        $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $toner['toner_descr']);
        $graph_array['width'] = 80;
        $graph_array['height'] = 20;
        $graph_array['bg'] = 'ffffff00';
        # the 00 at the end makes the area transparent.
        $graph_array['style'][] = 'margin-top: -6px';
        $minigraph = generate_graph_tag($graph_array);
        $percent_text = $percent < 0 ? "Unknown" : $percent . "%";
        echo "<tr class=device-overview>\n           <td class=strong>" . overlib_link($link, $toner['toner_descr'], $overlib_content) . "</td>\n           <td style='width: 90px;'>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n           <td style='width: 200px;'>" . overlib_link($link, print_percentage_bar(200, 20, $percent, NULL, "ffffff", $background['left'], $percent_text, "ffffff", $background['right']), $overlib_content) . "</td>\n         </tr>";
    }
    echo "</table>";
    echo "</div></div>";
}
unset($toner_rows);
// EOF
Exemplo n.º 18
0
        if ($hrdevice['hrDeviceType'] == 'hrDeviceNetwork') {
            $int = str_replace('network interface ', '', $hrdevice['hrDeviceDescr']);
            $interface = dbFetchRow('SELECT * FROM ports WHERE device_id = ? AND ifDescr = ?', array($device['device_id'], $int));
            if ($interface['ifIndex']) {
                echo '<td>' . generate_port_link($interface) . '</td>';
                $graph_array['height'] = '20';
                $graph_array['width'] = '100';
                $graph_array['to'] = $config['time']['now'];
                $graph_array['id'] = $interface['port_id'];
                $graph_array['type'] = 'port_bits';
                $graph_array['from'] = $config['time']['day'];
                $graph_array_zoom = $graph_array;
                $graph_array_zoom['height'] = '150';
                $graph_array_zoom['width'] = '400';
                // FIXME click on graph should also link to port, but can't use generate_port_link here...
                $mini_graph = overlib_link(generate_port_url($interface), generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
                echo "<td>{$mini_graph}</td>";
            } else {
                echo '<td>' . stripslashes($hrdevice['hrDeviceDescr']) . '</td>';
                echo '<td></td>';
            }
        } else {
            echo '<td>' . stripslashes($hrdevice['hrDeviceDescr']) . '</td>';
            echo '<td></td>';
        }
    }
    //end if
    echo '<td>' . $hrdevice['hrDeviceType'] . '</td><td>' . $hrdevice['hrDeviceStatus'] . '</td>';
    echo '<td>' . $hrdevice['hrDeviceErrors'] . '</td><td>' . $hrdevice['hrProcessorLoad'] . '</td>';
    echo '</tr>';
}
        $graph_array['legend'] = "no";
        $link_array = $graph_array;
        $link_array['page'] = "graphs";
        unset($link_array['height'], $link_array['width'], $link_array['legend']);
        $link = generate_url($link_array);
        $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr);
        $graph_array['width'] = 80;
        $graph_array['height'] = 20;
        $graph_array['bg'] = 'ffffff00';
        # the 00 at the end makes the area transparent.
        //    $graph_array['style'][] = 'margin-top: -6px';
        $minigraph = generate_graph_tag($graph_array);
        echo '<tr class="device-overview">
           <td style="max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"><strong>' . overlib_link($link, $text_descr, $overlib_content) . '</strong></td>
           <td style="width: 90px">' . overlib_link($link, $minigraph, $overlib_content) . '</td>
           <td style="width: 200px">' . overlib_link($link, print_percentage_bar(200, 20, $percent, $used . "/" . $total . " (" . $percent . "%)", "ffffff", $background['left'], $free . " (" . (100 - $percent) . "%)", "ffffff", $background['right']), $overlib_content) . '</td>
         </tr>';
        /**
          <tr class="small">
            <td colspan=3>
              <span class="pull-right">
                 <?php echo("<strong>Used</strong> <strong style='color:#".$background['left'].";'>$used ($percent%)</strong> / <strong>Free</strong> <strong style='color:#".$background['right'].";'>$free (".(100 - $percent) . "%)</strong> / <strong>Total</strong> <strong>$total</strong>"); ?>
              </span>
            </td>
          </tr>
        */
    }
    echo "</table>";
    echo "</div></div>";
}
// EOF
Exemplo n.º 20
0
    $total = formatStorage($mempool['mempool_total']);
    $free = formatStorage($mempool['mempool_free']);
    $used = formatStorage($mempool['mempool_used']);
    $graph_array['type'] = $graph_type;
    $graph_array['id'] = $mempool['mempool_id'];
    $graph_array['from'] = $config['time']['day'];
    $graph_array['to'] = $config['time']['now'];
    $graph_array['height'] = "20";
    $graph_array['width'] = "80";
    $graph_array_zoom = $graph_array;
    $graph_array_zoom['height'] = "150";
    $graph_array_zoom['width'] = "400";
    $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/";
    $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
    $background = get_percentage_colours($perc);
    $bar_link = overlib_link($link, print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $background['left'], $free, "ffffff", $background['right']), generate_graph_tag($graph_array_zoom), NULL);
    $response[] = array('hostname' => generate_device_link($mempool), 'mempool_descr' => $mempool['mempool_descr'], 'graph' => $mini_graph, 'mempool_used' => $bar_link, 'mempool_perc' => $perc . "%");
    if ($_POST['view'] == "graphs") {
        $graph_array['height'] = "100";
        $graph_array['width'] = "216";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $mempool['mempool_id'];
        $graph_array['type'] = $graph_type;
        $return_data = true;
        include "includes/print-graphrow.inc.php";
        unset($return_data);
        $response[] = array('hostname' => $graph_data[0], 'mempool_descr' => $graph_data[1], 'graph' => $graph_data[2], 'mempool_used' => $graph_data[3], 'mempool_perc' => '');
    }
    # endif graphs
}
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $count);
Exemplo n.º 21
0
    $graph_type = "atmvp_bits";
}
echo '<table cellspacing="0" cellpadding="5" border="0">';
foreach (dbFetchRows("SELECT * FROM juniAtmVp WHERE port_id = ?", array($interface['port_id'])) as $vp) {
    if (is_integer($row / 2)) {
        $row_colour = $list_colour_a;
    } else {
        $row_colour = $list_colour_b;
    }
    echo '<tr bgcolor="' . $row_colour . '">';
    echo '<td><span class=strong>' . $row . '. VP' . $vp['vp_id'] . ' ' . $vp['vp_descr'] . '</span></td>';
    echo '</tr>';
    $graph_array['height'] = "100";
    $graph_array['width'] = "214";
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $vp['juniAtmVp_id'];
    $graph_array['type'] = $graph_type;
    $periods = array('day', 'week', 'month', 'year');
    echo '<tr bgcolor="' . $row_colour . '"><td>';
    foreach ($periods as $period) {
        $graph_array['from'] = ${$period};
        $graph_array_zoom = $graph_array;
        $graph_array_zoom['height'] = "150";
        $graph_array_zoom['width'] = "400";
        echo overlib_link("#", generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
    }
    echo '</td></tr>';
    $row++;
}
echo '</table>';
// EOF
Exemplo n.º 22
0
                    // Critical
                    $state_style = "class='label label-danger'";
                    break;
                case 3:
                    // Unknown
                // Unknown
                default:
                    $state_style = "class='label label-default'";
                    break;
            }
            echo '<tr>
                <td class="col-md-4">' . overlib_link($link, shorten_interface_type($sensor['sensor_descr']), $overlib_content, $sensor_class) . '</td>
                <td class="col-md-4">' . overlib_link($link, $sensor_minigraph, $overlib_content, $sensor_class) . '</td>
                <td class="col-md-4">' . overlib_link($link, '<span ' . $state_style . '>' . $state_translation['0']['state_descr'] . '</span>', $overlib_content, $sensor_class) . '</td>
                </tr>';
        } else {
            echo '<tr>
                <td class="col-md-4">' . overlib_link($link, shorten_interface_type($sensor['sensor_descr']), $overlib_content, $sensor_class) . '</td>
                <td class="col-md-4">' . overlib_link($link, $sensor_minigraph, $overlib_content, $sensor_class) . '</td>
                <td class="col-md-4">' . overlib_link($link, '<span ' . ($sensor['sensor_current'] < $sensor['sensor_limit_low'] || $sensor['sensor_current'] > $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . '</span>', $overlib_content, $sensor_class) . '</td>
                </tr>';
        }
    }
    //end foreach
    echo '</table>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
}
//end if
Exemplo n.º 23
0
    foreach (dbFetchRows('SELECT * FROM `packages` WHERE `name` = ? ORDER BY version, build', array($entry['name'])) as $entry_v) {
        $entry['blah'][$entry_v['version']][$entry_v['build']][$entry_v['device_id']] = 1;
    }
    foreach ($entry['blah'] as $version => $bleu) {
        $content = '<div style="width: 800px;">';
        foreach ($bleu as $build => $bloo) {
            if ($build) {
                $dbuild = '-' . $build;
            } else {
                $dbuild = '';
            }
            $content .= '<div style="background-color: #eeeeee; margin: 5px;"><span style="font-weight: bold; ">' . $version . $dbuild . '</span>';
            foreach ($bloo as $device_id => $no) {
                $this_device = device_by_id_cache($device_id);
                $content .= '<span style="background-color: #f5f5f5; margin: 5px;">' . $this_device['hostname'] . '</span> ';
            }
            $content .= '</div>';
        }
        $content .= '</div>';
        if (empty($vars['name'])) {
            echo "<span style='margin:5px;'>" . overlib_link('', $version, $content, null) . '</span>';
        } else {
            echo "{$version} {$content}";
        }
    }
    //end foreach
    echo '<td>';
    echo '</tr>';
}
//end foreach
echo '</table>';
Exemplo n.º 24
0
foreach ($app_list as $app) {
    echo '<div style="clear: both;">';
    echo '<h2>' . generate_link(nicecase($app['app_type']), array('page' => 'apps', 'app' => $app['app_type'])) . '</h2>';
    $app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($app['app_type']));
    foreach ($app_devices as $app_device) {
        $graph_type = $graphs[$app['app_type']][0];
        $graph_array['type'] = "application_" . $app['app_type'] . "_" . $graph_type;
        $graph_array['id'] = $app_device['app_id'];
        $graph_array_zoom['type'] = "application_" . $app['app_type'] . "_" . $graph_type;
        $graph_array_zoom['id'] = $app_device['app_id'];
        $link_array = $graph_array;
        $link_array['page'] = "device";
        $link_array['device'] = $app_device['device_id'];
        $link_array['tab'] = "apps";
        $link_array['app'] = $app['app_type'];
        unset($link_array['height'], $link_array['width']);
        $overlib_url = generate_url($link_array);
        $overlib_link = '<span style="float:left; margin-left: 10px; font-weight: bold;">' . shorthost($app_device['hostname']) . "</span>";
        if (!empty($app_device['app_instance'])) {
            $overlib_link .= '<span style="float:right; margin-right: 10px; font-weight: bold;">' . $app_device['app_instance'] . "</span>";
            $app_device['content_add'] = '(' . $app_device['app_instance'] . ')';
        }
        $overlib_link .= "<br/>";
        $overlib_link .= generate_graph_tag($graph_array);
        $overlib_content = generate_overlib_content($graph_array, $app_device['hostname'] . " - " . $app_device['app_type'] . $app_device['content_add']);
        echo "<div style='display: block; padding: 1px; padding-top: 3px; margin: 2px; min-width: " . $width_div . "px; max-width:" . $width_div . "px; min-height:165px; max-height:165px;\n                      text-align: center; float: left; background-color: #f5f5f5;'>";
        echo overlib_link($overlib_url, $overlib_link, $overlib_content);
        echo "</div>";
    }
    echo '</div>';
}
Exemplo n.º 25
0
}
//end if
if ($_SESSION['screen_width']) {
    if ($_SESSION['screen_width'] < 1024 && $_SESSION['screen_width'] > 700) {
        $graph_array['width'] = round(($_SESSION['screen_width'] - 90) / 2, 0);
    } else {
        if ($_SESSION['screen_width'] > 1024) {
            $graph_array['width'] = round(($_SESSION['screen_width'] - 90) / count($periods) + 1, 0);
        } else {
            $graph_array['width'] = $_SESSION['screen_width'] - 70;
        }
    }
}
$graph_array['height'] = round($graph_array['width'] / 2.15);
$graph_array['to'] = $config['time']['now'];
$graph_data = array();
foreach ($periods as $period) {
    $graph_array['from'] = $config['time'][$period];
    $graph_array_zoom = $graph_array;
    $graph_array_zoom['height'] = '150';
    $graph_array_zoom['width'] = '400';
    $link_array = $graph_array;
    $link_array['page'] = 'graphs';
    unset($link_array['height'], $link_array['width']);
    $link = generate_url($link_array);
    if ($return_data === true) {
        $graph_data[] = overlib_link($link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
    } else {
        echo overlib_link($link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
    }
}
Exemplo n.º 26
0
 foreach (array('day', 'week', 'month', 'year') as $period) {
     $graph_array['from'] = $config['time'][$period];
     $overlib_content .= str_replace('"', "\\'", generate_graph_tag($graph_array));
 }
 $overlib_content .= '</div>';
 $graph_array['width'] = 80;
 $graph_array['height'] = 20;
 $graph_array['bg'] = 'ffffff00';
 // the 00 at the end makes the area transparent.
 $graph_array['from'] = $config['time']['day'];
 $sensor_minigraph = generate_lazy_graph_tag($graph_array);
 $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, '');
 echo '<tr class="health">
       <td class=list-bold>' . generate_device_link($sensor) . '</td>
       <td>' . overlib_link($link, $sensor['sensor_descr'], $overlib_content) . '</td>
       <td >' . overlib_link($link_graph, $sensor_minigraph, $overlib_content) . '</td>
       <td >' . $alert . '</td>
       <td class="text-center"><strong>' . $sensor['sensor_current'] . $unit . '</strong></td>
       <td class="text-center">' . round($sensor['sensor_limit_low'], 2) . $unit . ' - ' . round($sensor['sensor_limit'], 2) . $unit . '</td>
       <td>' . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . '</td>
     </tr>
  ';
 if ($vars['view'] == 'graphs') {
     echo "<tr></tr><tr class='health'><td colspan=7>";
     $daily_graph = 'graph.php?id=' . $sensor['sensor_id'] . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . '&amp;width=211&amp;height=100';
     $daily_url = 'graph.php?id=' . $sensor['sensor_id'] . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . '&amp;width=400&amp;height=150';
     $weekly_graph = 'graph.php?id=' . $sensor['sensor_id'] . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['week'] . '&amp;to=' . $config['time']['now'] . '&amp;width=211&amp;height=100';
     $weekly_url = 'graph.php?id=' . $sensor['sensor_id'] . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['week'] . '&amp;to=' . $config['time']['now'] . '&amp;width=400&amp;height=150';
     $monthly_graph = 'graph.php?id=' . $sensor['sensor_id'] . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['month'] . '&amp;to=' . $config['time']['now'] . '&amp;width=211&amp;height=100';
     $monthly_url = 'graph.php?id=' . $sensor['sensor_id'] . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['month'] . '&amp;to=' . $config['time']['now'] . '&amp;width=400&amp;height=150';
     $yearly_graph = 'graph.php?id=' . $sensor['sensor_id'] . '&amp;type=' . $graph_type . '&amp;from=' . $config['time']['year'] . '&amp;to=' . $config['time']['now'] . '&amp;width=211&amp;height=100';
Exemplo n.º 27
0
        $graph_array['height'] = 100;
        $graph_array['width'] = 210;
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $port['port_id'];
        $graph_array['type'] = $graph_type;
        $graph_array['from'] = $config['time']['day'];
        $graph_array['legend'] = 'no';
        $link_array = $graph_array;
        $link_array['page'] = 'graphs';
        unset($link_array['height'], $link_array['width'], $link_array['legend']);
        $link = generate_url($link_array);
        $overlib_content = generate_overlib_content($graph_array, $port['hostname'] . ' - ' . $port['label']);
        $graph_array['title'] = 'yes';
        $graph_array['width'] = $width;
        $graph_array['height'] = 119;
        $graph = generate_lazy_graph_tag($graph_array);
        echo "<div style='display: block; padding: 1px; margin: 2px; min-width: " . $width_div . 'px; max-width:' . $width_div . "px; min-height:180px; max-height:180px; text-align: center; float: left; background-color: #f5f5f5;'>";
        echo overlib_link($link, $graph, $overlib_content);
        echo '</div>';
        // echo("<div style='display: block; padding: 1px; margin: 2px; min-width: 393px; max-width:393px; min-height:180px; max-height:180px; text-align: center; float: left; background-color: #f5f5f5;'>
        // <a href='".generate_port_url($port)."/' onmouseover=\"return overlib('\
        // <div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$port['ifDescr']."</div>\
        // <img src=\'graph.php?type=$graph_type&amp;id=".$port['port_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=450&amp;height=150&amp;title=yes\'>\
        // ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\"  >".
        // "<img src='graph.php?type=$graph_type&amp;id=".$port['port_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=315&amp;height=110&amp;legend=no&amp;title=yes'>
        // </a>
        // </div>");
    }
    //end if
}
//end foreach
Exemplo n.º 28
0
                $graph_array_new['type'] = $graph_type;
                $graph_array_new['device'] = $device['device_id'];
                $graph_array_new['height'] = '110';
                $graph_array_new['width'] = $width;
                $graph_array_new['legend'] = 'no';
                $graph_array_new['title'] = 'yes';
                $graph_array_new['from'] = $graph_array['from'];
                $graph_array_new['to'] = $graph_array['to'];
                $graph_array_zoom = $graph_array_new;
                $graph_array_zoom['height'] = '150';
                $graph_array_zoom['width'] = '400';
                $graph_array_zoom['legend'] = 'yes';
                $overlib_link = "device/device=" . $device['device_id'] . "/";
                echo '<div class="devices-overlib-box" style="min-width:' . ($width + 90) . '; max-width: ' . ($width + 90) . '">';
                echo '<div class="panel panel-default">';
                echo overlib_link($overlib_link, generate_lazy_graph_tag($graph_array_new), generate_graph_tag($graph_array_zoom), null);
                echo "</div></div>\n\n";
            }
        }
    }
} else {
    if (is_admin() === true || is_read() === true) {
        $os = "SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`";
        $ver = "SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`";
        $platform = "SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`";
        $features = "SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`";
        $types = "SELECT `type` FROM `devices` AS D WHERE 1 GROUP BY `type` ORDER BY `type`";
    } else {
        $os = "SELECT `os` FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` GROUP BY `os` ORDER BY `os`";
        $ver = "SELECT `version` FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` GROUP BY `version` ORDER BY `version`";
        $platform = "SELECT `hardware` FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` GROUP BY `hardware` ORDER BY `hardware`";
Exemplo n.º 29
0
function generate_ap_link($args, $text = null, $type = null)
{
    global $config;
    $args = ifNameDescr($args);
    if (!$text) {
        $text = fixIfName($args['label']);
    }
    if ($type) {
        $args['graph_type'] = $type;
    }
    if (!isset($args['graph_type'])) {
        $args['graph_type'] = 'port_bits';
    }
    if (!isset($args['hostname'])) {
        $args = array_merge($args, device_by_id_cache($args['device_id']));
    }
    $content = '<div class=list-large>' . $args['text'] . ' - ' . fixifName($args['label']) . '</div>';
    if ($args['ifAlias']) {
        $content .= $args['ifAlias'] . '<br />';
    }
    $content .= "<div style=\\'width: 850px\\'>";
    $graph_array = array();
    $graph_array['type'] = $args['graph_type'];
    $graph_array['legend'] = 'yes';
    $graph_array['height'] = '100';
    $graph_array['width'] = '340';
    $graph_array['to'] = $config['time']['now'];
    $graph_array['from'] = $config['time']['day'];
    $graph_array['id'] = $args['accesspoint_id'];
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $config['time']['week'];
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $config['time']['month'];
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $config['time']['year'];
    $content .= generate_graph_tag($graph_array);
    $content .= '</div>';
    $url = generate_ap_url($args);
    if (port_permitted($args['interface_id'], $args['device_id'])) {
        return overlib_link($url, $text, $content, null);
    } else {
        return fixifName($text);
    }
}
Exemplo n.º 30
0
        $total = formatStorage($toner['toner_size']);
        $free = formatStorage($toner['toner_free']);
        $used = formatStorage($toner['toner_used']);
        $background = toner2colour($toner['toner_descr'], $percent);
        $graph_array = array();
        $graph_array['height'] = "100";
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $toner['toner_id'];
        $graph_array['type'] = $graph_type;
        $graph_array['from'] = $config['time']['day'];
        $graph_array['legend'] = "no";
        $link_array = $graph_array;
        $link_array['page'] = "graphs";
        unset($link_array['height'], $link_array['width'], $link_array['legend']);
        $link = generate_url($link_array);
        $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $toner['toner_descr']);
        $graph_array['width'] = 80;
        $graph_array['height'] = 20;
        $graph_array['bg'] = 'ffffff00';
        # the 00 at the end makes the area transparent.
        $minigraph = generate_graph_tag($graph_array);
        echo "<tr>\n            <td>" . overlib_link($link, $toner['toner_descr'], $overlib_content) . "</td>\n            <td>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n            <td>" . overlib_link($link, print_percentage_bar(200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content) . "\n           </a></td>\n         </tr>";
    }
    echo "</table>";
    echo "</div>";
    echo "</div>";
    echo "</div>";
    echo "</div>";
}
unset($toner_rows);