Esempio n. 1
0
function print_graph_row_port($graph_array, $port)
{
    global $config;
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $port['port_id'];
    print_graph_row($graph_array);
}
Esempio n. 2
0
            $typeinstances = array($MetaGraphDefs[$type]);
        }
        foreach ($typeinstances as &$tinst) {
            $i++;
            if (!is_integer($i / 2)) {
                $row_colour = $list_colour_a;
            } else {
                $row_colour = $list_colour_b;
            }
            echo '<tr><td>';
            echo '<h4>' . $graph_title;
            if ($tinst) {
                echo $vars['plugin'] . " {$instance} - {$type} - {$tinst}";
            } else {
                echo $vars['plugin'] . " {$instance} - {$type}";
            }
            echo '</h4>';
            $graph_array['type'] = "device_collectd";
            $graph_array['device'] = $device['device_id'];
            $graph_array['c_plugin'] = $vars['plugin'];
            $graph_array['c_plugin_instance'] = $instance;
            $graph_array['c_type'] = $type;
            $graph_array['c_type_instance'] = $tinst;
            print_graph_row($graph_array);
            echo '</tr></td>';
        }
    }
}
echo '</table>';
$pagetitle[] = "CollectD";
// EOF
    $graph_array['bg'] = 'ffffff00';
    # the 00 at the end makes the area transparent.
    $graph_array['from'] = $config['time']['day'];
    echo '
      <tr class="' . $sensor['row_class'] . '">
        <td class="state-marker"></td>
        <td class="entity">' . generate_device_link($sensor) . '</td>
        <td class="entity">' . generate_entity_link("sensor", $sensor) . '</td>
        <td class="text-right"><i class="' . $alert . '"></i></td>
        <td><span class="label">' . $sensor['sensor_thresholds'] . '</span></td>
        <td>' . generate_entity_link("sensor", $sensor, generate_graph_tag($graph_array), FALSE, FALSE) . '</td>
        <td style="text-align: right;"><span class="' . $sensor['state_class'] . '">' . $sensor['human_value'] . $sensor['sensor_symbol'] . '</span></td>
        </tr>' . PHP_EOL;
    if ($vars['view'] == "graphs") {
        echo '
      <tr class="' . $sensor['row_class'] . '">
        <td class="state-marker"></td>
        <td colspan=6>';
        $graph_array = array();
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $sensor['sensor_id'];
        $graph_array['type'] = 'sensor_graph';
        print_graph_row($graph_array, TRUE);
        echo '</td></tr>';
    }
    # endif graphs
}
echo "</tbody>";
echo "</table>";
echo $pagination_html;
// EOF
Esempio n. 4
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;
}
Esempio n. 5
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;
}
Esempio n. 6
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;
}