Example #1
0
 $text_descr = $proc['processor_descr'];
 $text_descr = str_replace("Routing Processor", "RP", $text_descr);
 $text_descr = str_replace("Switching Processor", "SP", $text_descr);
 $text_descr = str_replace("Sub-Module", "Module ", $text_descr);
 $text_descr = str_replace("DFC Card", "DFC", $text_descr);
 $graph_array = array();
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $proc['processor_id'];
 $graph_array['type'] = $graph_type;
 $graph_array['legend'] = "no";
 $link_array = $graph_array;
 $link_array['page'] = "graphs";
 unset($link_array['height'], $link_array['width'], $link_array['legend']);
 $link_graph = generate_url($link_array);
 $link = generate_url(array("page" => "device", "device" => $proc['device_id'], "tab" => "health", "metric" => 'processor'));
 $overlib_content = generate_overlib_content($graph_array, $proc['hostname'] . " - " . htmlentities($text_descr), NULL);
 $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'];
 $mini_graph = generate_graph_tag($graph_array);
 $perc = round($proc['processor_usage']);
 $background = get_percentage_colours($perc);
 echo '<tr class="' . $proc['html_row_class'] . '">
     <td class="entity">' . generate_device_link($proc) . '</td>
     <td>' . overlib_link($link, htmlentities($text_descr), $overlib_content) . '</td>
     <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
     <td><a href="' . $link_graph . '">
       ' . print_percentage_bar(400, 20, $perc, $perc . "%", "ffffff", $background['left'], 100 - $perc . "%", "ffffff", $background['right']) . '
       </a>
Example #2
0
<?php 
    $graph_array['height'] = "100";
    $graph_array['width'] = "512";
    $graph_array['to'] = $config['time']['now'];
    $graph_array['device'] = $device['device_id'];
    $graph_array['type'] = "device_bits";
    $graph_array['from'] = $config['time']['day'];
    $graph_array['legend'] = "no";
    $graph = generate_graph_tag($graph_array);
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width']);
    $link = generate_url($link_array);
    $graph_array['width'] = "210";
    $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - Device Traffic");
    echo overlib_link($link, $graph, $overlib_content, NULL);
    echo '  <div style="height: 5px;"></div>';
    echo '<table class="table table-condensed table-striped table-bordered">
    <tr style="background-color: ' . $ports_colour . '; align: center;"><td></td>
      <td style="width: 25%"><img src="images/16/connect.png" alt="" /> ' . $ports['total'] . '</td>
      <td style="width: 25%" class="green"><img src="images/16/if-connect.png" alt="" /> ' . $ports['up'] . '</td>
      <td style="width: 25%" class="red"><img src="images/16/if-disconnect.png" alt="" /> ' . $ports['down'] . '</td>
      <td style="width: 25%" class="grey"><img src="images/16/if-disable.png" alt="" /> ' . $ports['disabled'] . '</td>
    </tr>
  </table>';
    echo '  <div style="margin: 8px; font-size: 11px; font-weight: bold;">';
    $ifsep = "";
    foreach (dbFetchRows("SELECT * FROM `ports` WHERE device_id = ? AND `deleted` != '1'", array($device['device_id'])) as $data) {
        humanize_port($data);
        $data = array_merge($data, $device);
 humanize_sensor($sensor);
 // FIXME - make this "four graphs in popup" a function/include and "small graph" a function.
 // FIXME - So now we need to clean this up and move it into a function. Isn't it just "print-graphrow"?
 // FIXME - DUPLICATED IN health/sensors
 $graph_colour = str_replace("#", "", $row_colour);
 $graph_array = array();
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $sensor['sensor_id'];
 $graph_array['type'] = "sensor_" . $sensor_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);
 $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">
Example #4
0
function generate_mempool_row($mempool, $vars)
{
    global $config;
    $table_cols = 7;
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $table_cols++;
    }
    // Add a column for device.
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $mempool['mempool_id'];
    $graph_array['type'] = "mempool_usage";
    $graph_array['legend'] = "no";
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width'], $link_array['legend']);
    $link_graph = generate_url($link_array);
    $link = generate_url(array("page" => "device", "device" => $mempool['device_id'], "tab" => "health", "metric" => 'mempool'));
    $overlib_content = generate_overlib_content($graph_array, $mempool['hostname'] . " - " . $mempool['mempool_descr']);
    $graph_array['width'] = 80;
    $graph_array['height'] = 20;
    $graph_array['bg'] = 'ffffff00';
    $graph_array['from'] = $config['time']['day'];
    $mini_graph = generate_graph_tag($graph_array);
    if ($mempool['mempool_total'] != '100') {
        $total = formatStorage($mempool['mempool_total']);
        $used = formatStorage($mempool['mempool_used']);
        $free = formatStorage($mempool['mempool_free']);
    } else {
        // If total == 100, than memory not have correct size and uses percents only
        $total = $mempool['mempool_total'] . '%';
        $used = $mempool['mempool_used'] . '%';
        $free = $mempool['mempool_free'] . '%';
    }
    $background = get_percentage_colours($mempool['mempool_perc']);
    $mempool['html_row_class'] = $background['class'];
    $row .= '<tr class="' . $mempool['html_row_class'] . '">
            <td class="state-marker"></td>';
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $row .= '<td class="entity">' . generate_device_link($mempool) . '</td>';
    }
    $row .= '<td class="entity">' . generate_entity_link('mempool', $mempool) . '</td>
        <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
        <td><a href="' . $link_graph . '">
          ' . print_percentage_bar(400, 20, $mempool['mempool_perc'], $used . '/' . $total . ' (' . $mempool['mempool_perc'] . '%)', "ffffff", $background['left'], $free . ' (' . (100 - $mempool['mempool_perc']) . '%)', "ffffff", $background['right']) . '
          </a>
        </td>
        <td>' . $mempool['mempool_perc'] . '%</td>
      </tr>
   ';
    if ($vars['view'] == "graphs") {
        $vars['graph'] = "usage";
    }
    if ($vars['graph']) {
        $row .= '<tr class="' . $mempool['html_row_class'] . '">';
        $row .= '<td class="state-marker"></td>';
        $row .= '<td colspan="' . $table_cols . '">';
        unset($graph_array['height'], $graph_array['width'], $graph_array['legend']);
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $mempool['mempool_id'];
        $graph_array['type'] = 'mempool_' . $vars['graph'];
        print_graph_row($graph_array, TRUE);
        $row .= '</td></tr>';
    }
    # endif graphs
    return $row;
}
Example #5
0
 //end foreach
 if ($config['cpu_details_overview'] === false) {
     //Generate average cpu graph
     $graph_array['height'] = '100';
     $graph_array['width'] = '485';
     $graph_array['device'] = $device['device_id'];
     $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>
     $free = $mempool['mempool_free'] . '%';
 }
 $background = get_percentage_colours($percent);
 $graph_array = array();
 $graph_array['height'] = "100";
 $graph_array['width'] = "210";
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $mempool['mempool_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);
 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">
 $text_descr = $proc['processor_descr'];
 $text_descr = str_replace("Routing Processor", "RP", $text_descr);
 $text_descr = str_replace("Switching Processor", "SP", $text_descr);
 $text_descr = str_replace("Sub-Module", "Module ", $text_descr);
 $text_descr = str_replace("DFC Card", "DFC", $text_descr);
 $graph_array = array();
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $proc['processor_id'];
 $graph_array['type'] = $graph_type;
 $graph_array['legend'] = "no";
 $link_array = $graph_array;
 $link_array['page'] = "graphs";
 unset($link_array['height'], $link_array['width'], $link_array['legend']);
 $link_graph = generate_url($link_array);
 $link = generate_url(array("page" => "device", "device" => $proc['device_id'], "tab" => "health", "metric" => 'processor'));
 $overlib_content = generate_overlib_content($graph_array, $proc['hostname'] . " - " . $text_descr, NULL);
 $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'];
 $mini_graph = generate_graph_tag($graph_array);
 $perc = round($proc['processor_usage']);
 $background = get_percentage_colours($perc);
 echo '<tr>
   <td>' . generate_device_link($proc) . '</td>
   <td>' . overlib_link($link, $text_descr, $overlib_content) . '</td>
   <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
   <td><a href="' . $proc_url . '" ' . $proc_popup . '>
     ' . print_percentage_bar(400, 20, $perc, $perc . "%", "ffffff", $background['left'], 100 - $perc . "%", "ffffff", $background['right']) . '
     </a>
Example #8
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>';
}
Example #9
0
 if (!$config['web_show_disabled']) {
     if ($cache['devices']['id'][$storage['device_id']]['disabled']) {
         continue;
     }
 }
 $graph_array = array();
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $storage['storage_id'];
 $graph_array['type'] = $graph_type;
 $graph_array['legend'] = "no";
 $link_array = $graph_array;
 $link_array['page'] = "graphs";
 unset($link_array['height'], $link_array['width'], $link_array['legend']);
 $link_graph = generate_url($link_array);
 $link = generate_url(array("page" => "device", "device" => $storage['device_id'], "tab" => "health", "metric" => 'storage'));
 $overlib_content = generate_overlib_content($graph_array, $storage['hostname'] . " - " . $storage['storage_descr'], NULL);
 $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'];
 $mini_graph = generate_graph_tag($graph_array);
 $total = formatStorage($storage['storage_size']);
 $used = formatStorage($storage['storage_used']);
 $free = formatStorage($storage['storage_free']);
 $background = get_percentage_colours($storage['storage_perc']);
 echo '<tr>
   <td class=strong>' . generate_device_link($storage) . '</td>
   <td>' . overlib_link($link, $storage['storage_descr'], $overlib_content) . '</td>
   <td>' . $total . '</td>
   <td>' . $used . '</td>
Example #10
0
function generate_processor_row($processor, $vars)
{
    global $config;
    $table_cols = 4;
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $table_cols++;
    }
    // Add a column for device.
    // FIXME should that really be done here? :-)
    // FIXME - not it shouldn't. we need some per-os rewriting on discovery-time.
    $text_descr = $processor['processor_descr'];
    $text_descr = str_replace("Routing Processor", "RP", $text_descr);
    $text_descr = str_replace("Switching Processor", "SP", $text_descr);
    $text_descr = str_replace("Sub-Module", "Module ", $text_descr);
    $text_descr = str_replace("DFC Card", "DFC", $text_descr);
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $processor['processor_id'];
    $graph_array['type'] = 'processor_usage';
    $graph_array['legend'] = "no";
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width'], $link_array['legend']);
    $link_graph = generate_url($link_array);
    $link = generate_url(array("page" => "device", "device" => $processor['device_id'], "tab" => "health", "metric" => 'processor'));
    $overlib_content = generate_overlib_content($graph_array, $processor['hostname'] . " - " . $text_descr);
    $graph_array['width'] = 80;
    $graph_array['height'] = 20;
    $graph_array['bg'] = 'ffffff00';
    $graph_array['from'] = $config['time']['day'];
    $mini_graph = generate_graph_tag($graph_array);
    $perc = round($processor['processor_usage']);
    $background = get_percentage_colours($perc);
    $processor['html_row_class'] = $background['class'];
    $row .= '<tr class="' . $processor['html_row_class'] . '">
          <td class="state-marker"></td>';
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $row .= '<td class="entity">' . generate_device_link($processor) . '</td>';
    }
    $row .= '  <td class="entity">' . generate_entity_link('processor', $processor) . '</td>
      <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
      <td><a href="' . $link_graph . '">
        ' . print_percentage_bar(400, 20, $perc, $perc . "%", "ffffff", $background['left'], 100 - $perc . "%", "ffffff", $background['right']) . '
        </a>
      </td>
    </tr>
   ';
    if ($vars['view'] == "graphs") {
        $vars['graph'] = "usage";
    }
    if ($vars['graph']) {
        $row .= '<tr class="' . $processor['html_row_class'] . '">';
        $row .= '<td class="state-marker"></td>';
        $row .= '<td colspan=' . $table_cols . '>';
        unset($graph_array['height'], $graph_array['width'], $graph_array['legend']);
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $processor['processor_id'];
        $graph_array['type'] = 'processor_' . $vars['graph'];
        print_graph_row($graph_array, TRUE);
        $row .= '</td></tr>';
    }
    # endif graphs
    return $row;
}
Example #11
0
     }
 }
 // FIXME - make this "four graphs in popup" a function/include and "small graph" a function.
 // FIXME - So now we need to clean this up and move it into a function. Isn't it just "print-graphrow"?
 // FIXME - DUPLICATED IN device/overview/sensors
 $graph_array = array();
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $sensor['sensor_id'];
 $graph_array['type'] = $graph_type;
 $graph_array['legend'] = "no";
 $link_array = $graph_array;
 $link_array['page'] = "graphs";
 unset($link_array['height'], $link_array['width'], $link_array['legend']);
 $link_graph = generate_url($link_array);
 $link = generate_url(array("page" => "device", "device" => $sensor['device_id'], "tab" => "health", "metric" => $sensor['sensor_class']));
 $overlib_content = generate_overlib_content($graph_array, $sensor['hostname'] . " - " . $sensor['sensor_descr'], NULL);
 $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, '');
 if ($class == "frequency") {
     echo '<tr>
   <td class=strong>' . generate_device_link($sensor) . '</td>
   <td>' . overlib_link($link, $sensor['sensor_descr'], $overlib_content) . '</td>
   <td>' . $alert . '</td>
   <td>' . overlib_link($link_graph, $sensor_minigraph, $overlib_content) . '</td>
   <td style="font-weight: bold;">' . format_si($sensor['sensor_value']) . $unit . '</td>
   <td>' . format_si(round($sensor['sensor_limit_low'], 2)) . $unit . ' - ' . format_si(round($sensor['sensor_limit'], 2)) . $unit . '</td>
            $background = toner_to_colour($supply['supply_descr'], $percent);
        }
        $background_percent = get_percentage_colours($percent - 100);
        $graph_array = array();
        $graph_array['height'] = "100";
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $supply['supply_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'] . " - " . $supply['supply_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);
        $percent_text = $percent < 0 ? "Unknown" : $percent . "%";
        echo '<tr class="' . $background_percent['class'] . '">
           <td class="state-marker"></td>
           <td class="entity">' . overlib_link($link, $supply['supply_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(400, 20, $percent, $percent_text, 'ffffff', $background['right'], NULL, "ffffff", $background['left']), $overlib_content) . "</td>\n         </tr>";
    }
    echo "</table>";
    echo generate_box_close();
}
unset($supply_rows);
// EOF
Example #13
0
 $graph_array = array();
 $graph_array['height'] = "100";
 $graph_array['width'] = "512";
 $graph_array['to'] = $config['time']['now'];
 $graph_array['device'] = $device['device_id'];
 $graph_array['type'] = 'device_processor';
 $graph_array['from'] = $config['time']['day'];
 $graph_array['legend'] = "no";
 $graph = generate_graph_tag($graph_array);
 $link_array = $graph_array;
 $link_array['page'] = "graphs";
 unset($link_array['height'], $link_array['width']);
 $graph_link = generate_url($link_array);
 $link = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'health', 'metric' => 'processor'));
 $graph_array['width'] = "210";
 $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - Processor Usage");
 echo overlib_link($graph_link, $graph, $overlib_content, NULL);
 $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('<table class="table table-condensed-more table-striped table-bordered">');
 $numprocs = 0;
 $total_percent = 0;
 foreach ($processors as $proc) {
     $text_descr = rewrite_entity_name($proc['processor_descr']);
     # disable short hrDeviceDescr. need to make this prettier.
     #$text_descr = rewrite_hrDevice($proc['processor_descr']);
     $percent = $proc['processor_usage'];
Example #14
0
        $free = formatStorage($drive['storage_free']);
        $used = formatStorage($drive['storage_used']);
        $background = get_percentage_colours($percent);
        $graph_array = array();
        $graph_array['height'] = "100";
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $drive['storage_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'] . " - " . $drive['storage_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 class="entity" style="max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">' . generate_entity_link('storage', $drive) . '</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>';
    }
    echo "</table>";
    echo generate_box_close();
Example #15
0
         $height = 102;
         $height_div = 158;
     }
 }
 $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'] . " - " . rewrite_ifname($port['label']));
 $graph_array['title'] = "yes";
 $graph_array['width'] = $width;
 $graph_array['height'] = $height;
 $graph = generate_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:" . $height_div . "px; max-height:" . $height_div . "; 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>");
$avai_perc = round($device_state['ucd_mem']['mem_avail'] / $device_state['ucd_mem']['mem_total'] * 100);
$graph_array = array();
$graph_array['height'] = "100";
$graph_array['width'] = "512";
$graph_array['to'] = $config['time']['now'];
$graph_array['device'] = $device['device_id'];
$graph_array['type'] = 'device_ucd_memory';
$graph_array['from'] = $config['time']['day'];
$graph_array['legend'] = "no";
$graph = generate_graph_tag($graph_array);
$link_array = $graph_array;
$link_array['page'] = "graphs";
unset($link_array['height'], $link_array['width']);
$link = generate_url($link_array);
$graph_array['width'] = "210";
$overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - Memory Usage");
echo overlib_link($link, $graph, $overlib_content, NULL);
$percentage_bar = array();
$percentage_bar['border'] = "#EA8F00";
$percentage_bar['border'] = "#E25A00";
$percentage_bar['bg'] = "#f0f0f0";
$percentage_bar['width'] = "100%";
$percentage_bar['text'] = $avai_perc . "%";
$percentage_bar['text_c'] = "#E25A00";
$percentage_bar['bars'][0] = array('percent' => $used_perc, 'colour' => '#FFAA66', 'text' => $used_perc_total . '%');
$percentage_bar['bars'][1] = array('percent' => $shar_perc, 'colour' => '#008fea', 'text' => '');
$percentage_bar['bars'][2] = array('percent' => $buff_perc, 'colour' => '#cc0000', 'text' => '');
$percentage_bar['bars'][3] = array('percent' => $cach_perc, 'colour' => '#f0e0a0', 'text' => '');
echo '<table width="100%" class="table table-striped table-condensed-more table-bordered">';
echo '  <tr>';
echo '    <td class="entity">RAM</td>';
Example #17
0
foreach ($sensors as $sensor) {
    humanize_sensor($sensor);
    $alert = $sensor['state_event'] == 'alert' ? 'oicon-exclamation-red' : '';
    // FIXME - make this "four graphs in popup" a function/include and "small graph" a function.
    // FIXME - DUPLICATED IN device/overview/sensors
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $sensor['sensor_id'];
    $graph_array['type'] = "sensor_{$sensor_type}";
    $graph_array['legend'] = "no";
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width'], $link_array['legend']);
    $link_graph = generate_url($link_array);
    $link = generate_url(array("page" => "device", "device" => $sensor['device_id'], "tab" => "health", "metric" => $sensor['sensor_class']));
    $overlib_content = generate_overlib_content($graph_array, $sensor['hostname'] . " - " . htmlentities($sensor['sensor_descr']), NULL);
    $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['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);
        $sensor_misc = '<span class="label">' . $sensor['entPhysicalClass'] . '</span>';
    } else {
        $sensor_value = $sensor['human_value'];
        $sensor_minigraph = overlib_link($link, generate_graph_tag($graph_array), $overlib_content);
        if ($sensor['sensor_limit_low'] != NULL) {
            switch ($sensor['sensor_class']) {
     $graph_array['from'] = $vars['from'];
     $graph_array['to'] = $vars['to'];
 } else {
     $graph_array['from'] = $config['time']['day'];
     $graph_array['to'] = $config['time']['now'];
 }
 $graph_array['height'] = 100;
 $graph_array['width'] = 210;
 $graph_array['id'] = $port['port_id'];
 $graph_array['type'] = $graph_type;
 $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'] . ' - ' . rewrite_ifname($port['label'], FALSE));
 $graph_array['title'] = "yes";
 $graph_array['width'] = $width;
 $graph_array['height'] = $height;
 $graph = generate_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:" . $height_div . "px; max-height:" . $height_div . "; 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>");
Example #19
0
 $memory_free = $app_data['memory']['total'] - $app_data['memory']['used'];
 $memory_free_perc = round($memory_free / $app_data['memory']['total'] * 100, 2);
 $graph_array = array();
 $graph_array['height'] = "100";
 $graph_array['width'] = "512";
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $app['app_id'];
 $graph_array['type'] = 'application_mssql_memory_usage';
 $graph_array['from'] = $config['time']['day'];
 $graph_array['legend'] = "no";
 $graph = generate_graph_tag($graph_array);
 $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, $app['app_instance'] . " - Memory Usage");
 $percentage_bar = array();
 $percentage_bar['border'] = "#EA8F00";
 $percentage_bar['border'] = "#E25A00";
 $percentage_bar['bg'] = "#f0f0f0";
 $percentage_bar['width'] = "100%";
 $percentage_bar['text'] = $memory_free_perc . "%";
 $percentage_bar['text_c'] = "#E25A00";
 $percentage_bar['bars'][0] = array('percent' => $memory_used_perc, 'colour' => '#EE9955', 'text' => $memory_used_perc . '%');
 $percentage_bar['bars'][1] = array('percent' => $memory_cached_perc, 'colour' => '#f0e0a0', 'text' => '');
 echo overlib_link($link, $graph, $overlib_content, NULL);
 ?>
   <div class="box box-solid">
     <div class="title"><i class="oicon-memory"></i> Memory</div>
     <div class="content">
       <table width="100%" class="table table-striped table-condensed-more ">
        //$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
Example #21
0
function generate_storage_row($storage, $vars)
{
    global $config;
    $table_cols = 8;
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $table_cols++;
    }
    // Add a column for device.
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $storage['storage_id'];
    $graph_array['type'] = 'storage_usage';
    $graph_array['legend'] = "no";
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width'], $link_array['legend']);
    $link_graph = generate_url($link_array);
    $link = generate_url(array("page" => "device", "device" => $storage['device_id'], "tab" => "health", "metric" => 'storage'));
    $overlib_content = generate_overlib_content($graph_array, $storage['hostname'] . ' - ' . $storage['storage_descr']);
    $graph_array['width'] = 80;
    $graph_array['height'] = 20;
    $graph_array['bg'] = 'ffffff00';
    $graph_array['from'] = $config['time']['day'];
    $mini_graph = generate_graph_tag($graph_array);
    $total = formatStorage($storage['storage_size']);
    $used = formatStorage($storage['storage_used']);
    $free = formatStorage($storage['storage_free']);
    $background = get_percentage_colours($storage['storage_perc']);
    if ($storage['storage_ignore']) {
        $storage['row_class'] = 'suppressed';
    } else {
        $storage['row_class'] = $background['class'];
    }
    $row .= '<tr class="ports ' . $storage['row_class'] . '">
          <td class="state-marker"></td>';
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $row .= '<td class="entity">' . generate_device_link($storage) . '</td>';
    }
    $row .= '  <td class="entity">' . generate_entity_link('storage', $storage) . '</td>
      <td>' . $total . '</td>
      <td>' . $used . '</td>
      <td>' . $free . '</td>
      <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
      <td><a href="' . $link_graph . '">
        ' . print_percentage_bar(400, 20, $storage['storage_perc'], $storage['storage_perc'] . '%', "ffffff", $background['left'], 100 - $storage['storage_perc'] . "%", "ffffff", $background['right']) . '
        </a>
      </td>
    </tr>
  ';
    if ($vars['view'] == "graphs") {
        $vars['graph'] = "usage";
    }
    if ($vars['graph']) {
        echo '<tr class="' . $storage['row_class'] . '">';
        echo '<td class="state-marker"></td>';
        echo '<td colspan="' . $table_cols . '">';
        unset($graph_array['height'], $graph_array['width'], $graph_array['legend']);
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $storage['storage_id'];
        $graph_array['type'] = 'storage_' . $vars['graph'];
        print_graph_row($graph_array, TRUE);
        $row .= '</td></tr>';
    }
    # endif graphs
    return $row;
}
            $graph_array['height'] = 100;
            $graph_array['width'] = 210;
            if (is_numeric($vars['to'])) {
                $graph_array['to'] = $vars['to'];
            } else {
                $graph_array['to'] = $config['time']['now'];
            }
            if (is_numeric($vars['from'])) {
                $graph_array['from'] = $vars['from'];
            } else {
                $graph_array['from'] = $config['time']['day'];
            }
            $graph_array['device'] = $device['device_id'];
            $graph_array['type'] = $graph_type;
            $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']);
            $graph_array['title'] = "yes";
            $graph_array['width'] = $width;
            $graph_array['height'] = $height;
            $graph = generate_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:" . $height_div . "px; max-height:" . $height_div . "; text-align: center; float: left; background-color: #f5f5f5;'>";
            echo overlib_link($link, $graph, $overlib_content);
            echo "</div>";
        }
    }
}
// EOF
 if (!$config['web_show_disabled']) {
     if ($cache['devices']['id'][$mempool['device_id']]['disabled']) {
         continue;
     }
 }
 $graph_array = array();
 $graph_array['to'] = $config['time']['now'];
 $graph_array['id'] = $mempool['mempool_id'];
 $graph_array['type'] = $graph_type;
 $graph_array['legend'] = "no";
 $link_array = $graph_array;
 $link_array['page'] = "graphs";
 unset($link_array['height'], $link_array['width'], $link_array['legend']);
 $link_graph = generate_url($link_array);
 $link = generate_url(array("page" => "device", "device" => $mempool['device_id'], "tab" => "health", "metric" => 'mempool'));
 $overlib_content = generate_overlib_content($graph_array, $mempool['hostname'] . " - " . $mempool['mempool_descr'], NULL);
 $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'];
 $mini_graph = generate_graph_tag($graph_array);
 $total = formatStorage($mempool['mempool_total']);
 $used = formatStorage($mempool['mempool_used']);
 $free = formatStorage($mempool['mempool_free']);
 $background = get_percentage_colours($mempool['mempool_perc']);
 echo '<tr>
   <td class="entity">' . generate_device_link($mempool) . '</td>
   <td>' . overlib_link($link, $mempool['mempool_descr'], $overlib_content) . '</td>
   <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
   <td><a href="' . $proc_url . '" ' . $proc_popup . '>
Example #24
0
 } else {
     $width_div = 393;
 }
 $graph_array = array();
 $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>");
echo '      <th></th>';
echo '      <th style="width: 200px;"><a href="' . generate_url($vars, array('sort' => 'usage')) . '">使用率 %</a></th>';
echo '    </tr>';
echo '  </thead>';
foreach ($storages as $storage) {
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $storage['storage_id'];
    $graph_array['type'] = $graph_type;
    $graph_array['legend'] = "no";
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width'], $link_array['legend']);
    $link_graph = generate_url($link_array);
    $link = generate_url(array("page" => "device", "device" => $storage['device_id'], "tab" => "health", "metric" => 'storage'));
    $overlib_content = generate_overlib_content($graph_array, $storage['hostname'] . ' - ' . $storage['storage_descr']);
    $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'];
    $mini_graph = generate_graph_tag($graph_array);
    $total = formatStorage($storage['storage_size']);
    $used = formatStorage($storage['storage_used']);
    $free = formatStorage($storage['storage_free']);
    $background = get_percentage_colours($storage['storage_perc']);
    echo '<tr class="' . $storage['html_row_class'] . '">
        <td class="entity">' . generate_device_link($storage) . '</td>
        <td>' . overlib_link($link, htmlentities($storage['storage_descr']), $overlib_content) . '</td>
        <td>' . $total . '</td>
        <td>' . $used . '</td>