diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index de4430f1c..dc96b7326 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1,5 +1,7 @@

'.$text."

"; + 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 .= ""; + + return $overlib_content; + +} + function get_percentage_colours($percentage) { diff --git a/html/includes/print-quadgraphs.inc.php b/html/includes/print-quadgraphs.inc.php index b4c227ed6..5f11007b8 100644 --- a/html/includes/print-quadgraphs.inc.php +++ b/html/includes/print-quadgraphs.inc.php @@ -21,7 +21,10 @@ foreach ($periods as $period) $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; - $link = "graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $graph_array['from'] . "/" . $config['to'] . "/"; + $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)); } diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php index 8d2573e14..f897c4643 100644 --- a/html/pages/device/overview/generic/sensor.inc.php +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -14,25 +14,43 @@ if (count($sensors)) ### 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-quadgraphs"? + $graph_colour = str_replace("#", "", $row_colour); - $sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=210&height=100"; - $sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=".$config['time']['week']."&to=".$config['time']['now']."&width=210&height=100"; - $sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=".$config['time']['month']."&to=".$config['time']['now']."&width=210&height=100"; - $sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=".$config['time']['year']."&to=".$config['time']['now']."&width=210&height=100"; - $sensor_minigraph = ""; + $graph_array = array(); + $graph_array['height'] = "100"; + $graph_array['width'] = "210"; + $graph_array['to'] = $now; + $graph_array['id'] = $sensor['sensor_id']; + $graph_array['type'] = $graph_type; + $graph_array['from'] = $day; + $graph_array['legend'] = "no"; - $sensor_link = ""; + $link_array = $graph_array; + $link_array['page'] = "graphs"; + unset($link_array['height'], $link_array['width'], $link_array['legend']); + $link = generate_url($link_array); - $sensor_link_c = $sensor_link . " $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . ""; - $sensor_link_b = $sensor_link . $sensor_minigraph . ""; - $sensor_link_a = $sensor_link . $sensor['sensor_descr'] . ""; + $overlib_content = '

'.$device['hostname']." - ".$sensor['sensor_descr']."

"; + 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 .= "
"; + + $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = $graph_colour; + $sensor_minigraph = generate_graph_tag($graph_array); $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 25, ''); - echo("$sensor_link_a$sensor_link_b$sensor_link_c"); + echo(" + ".overlib_link($link, $sensor['sensor_descr'], $overlib_content)." + ".overlib_link($link, $sensor_minigraph, $overlib_content)." + ".overlib_link($link, " $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . "", $overlib_content)." + "); $i++; + } echo(""); diff --git a/html/pages/device/overview/mempools.inc.php b/html/pages/device/overview/mempools.inc.php index 9fb0b78e8..8102db89d 100644 --- a/html/pages/device/overview/mempools.inc.php +++ b/html/pages/device/overview/mempools.inc.php @@ -17,26 +17,36 @@ if (count($mempools)) { if (is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $perc = round($mempool['mempool_perc'],0); - $text_descr = rewrite_entity_descr($mempool['mempool_descr']); - - $mempool_url = $config['base_url'] . "/graphs/".$mempool['mempool_id']."/mempool_usage/"; - $mini_url = $config['base_url'] . "/graph.php?id=".$mempool['mempool_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; - - $mempool_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$text_descr; - $mempool_popup .= "
"; - $mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; - $total = formatStorage($mempool['mempool_total']); $used = formatStorage($mempool['mempool_used']); $free = formatStorage($mempool['mempool_free']); - $background = get_percentage_colours($perc); - echo("" . $text_descr . " - - - ".print_percentage_bar (200, 20, $perc, "$used / $total", "ffffff", $background['left'], $perc . "%", "ffffff", $background['right'])." + $graph_array = array(); + $graph_array['height'] = "100"; + $graph_array['width'] = "210"; + $graph_array['to'] = $now; + $graph_array['id'] = $mempool['mempool_id']; + $graph_array['type'] = $graph_type; + $graph_array['from'] = $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'] = $graph_colour; + + $minigraph = generate_graph_tag($graph_array); + + echo(" + ".overlib_link($link, $text_descr, $overlib_content)." + ".overlib_link($link, $minigraph, $overlib_content)." + ".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)." "); diff --git a/html/pages/device/overview/ports.inc.php b/html/pages/device/overview/ports.inc.php index 227aeea22..146dccba6 100644 --- a/html/pages/device/overview/ports.inc.php +++ b/html/pages/device/overview/ports.inc.php @@ -13,9 +13,16 @@ if ($ports['total']) $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); + + + $content = "
".$device['hostname']." - Device Traffic
"; $content .= "
"; - $graph_array['legend'] = "yes"; + $graph_array['legend'] = "no"; $graph_array['width'] = "340"; $graph_array['from'] = $config['time']['day']; $content .= generate_graph_tag($graph_array); @@ -27,8 +34,6 @@ if ($ports['total']) $content .= generate_graph_tag($graph_array); $content .= "
"; - $link = $config['base_url'] . "/graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $day . "/" . $config['now'] . "/"; - echo(overlib_link($link, $graph, $content, NULL)); echo('
'); diff --git a/html/pages/device/overview/processors.inc.php b/html/pages/device/overview/processors.inc.php index f943b4f88..d92416b5e 100644 --- a/html/pages/device/overview/processors.inc.php +++ b/html/pages/device/overview/processors.inc.php @@ -16,30 +16,40 @@ if (count($processors)) foreach($processors as $proc) { if (is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - - $proc_url = $config['base_url'] . "/graphs/".$proc['processor_id']."/processor_usage/"; - - $proc_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$proc['processor_descr']; - $proc_popup .= "
"; - $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; - - $mini_url = $config['base_url'] . "/graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; - ## REPLACE THIS SHITTY CODE. IT IS ALSO ELSEWHERE. $text_descr = rewrite_entity_descr($proc['processor_descr']); # disable short hrDeviceDescr. need to make this prettier. #$text_descr = short_hrDeviceDescr($proc['processor_descr']); - $percent = $proc['processor_usage']; - $background = get_percentage_colours($percent); + $graph_colour = str_replace("#", "", $row_colour); - echo("" . $text_descr . " - - - ".print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right'])." + $graph_array = array(); + $graph_array['height'] = "100"; + $graph_array['width'] = "210"; + $graph_array['to'] = $now; + $graph_array['id'] = $proc['processor_id']; + $graph_array['type'] = $graph_type; + $graph_array['from'] = $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'] = $graph_colour; + + $minigraph = generate_graph_tag($graph_array); + + echo(" + ".overlib_link($link, $text_descr, $overlib_content)." + ".overlib_link($link, $minigraph, $overlib_content)." + ".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)." "); $processor_rows++; diff --git a/html/pages/device/overview/storage.inc.php b/html/pages/device/overview/storage.inc.php index a6de4ca22..340af16d6 100644 --- a/html/pages/device/overview/storage.inc.php +++ b/html/pages/device/overview/storage.inc.php @@ -46,21 +46,35 @@ if (count($drives)) $total = formatStorage($drive['storage_size']); $free = formatStorage($drive['storage_free']); $used = formatStorage($drive['storage_used']); - - $fs_url = $config['base_url'] . "/graphs/".$drive['storage_id']."/storage_usage/"; - - $fs_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$drive['storage_descr']; - $fs_popup .= "
"; - $fs_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; - - $mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; - $background = get_percentage_colours($perc); - echo("" . $drive['storage_descr'] . " - - ".print_percentage_bar (200, 20, $perc, "$used / $total", "ffffff", $background['left'], $perc . "%", "ffffff", $background['right'])." - "); + $graph_array = array(); + $graph_array['height'] = "100"; + $graph_array['width'] = "210"; + $graph_array['to'] = $now; + $graph_array['id'] = $drive['storage_id']; + $graph_array['type'] = $graph_type; + $graph_array['from'] = $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'] = $graph_colour; + + $minigraph = generate_graph_tag($graph_array); + + echo(" + ".overlib_link($link, $text_descr, $overlib_content)." + ".overlib_link($link, $minigraph, $overlib_content)." + ".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)." + + "); + $drive_rows++; } diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index f4eeb5ccf..c7a0bc007 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -1,14 +1,26 @@ [A-Za-z0-9]+)_(?P.+)/', mres($graph_type), $graphtype); +### Setup here + +if($_SESSION['widescreen']) +{ + $graph_width=1700; + $thumb_width=180; +} else { + $graph_width=1075; + $thumb_width=113; +} + +if (is_numeric($vars['from'])) { $from = $vars['from']; } else { $from = $config['time']['day']; } +if (is_numeric($vars['to'])) { $to = $vars['to']; } else { $to = $config['time']['now']; } + +preg_match('/^(?P[A-Za-z0-9]+)_(?P.+)/', mres($vars['type']), $graphtype); $type = $graphtype['type']; $subtype = $graphtype['subtype']; +$id = $vars['id']; if (is_file("includes/graphs/".$type."/auth.inc.php")) { @@ -28,102 +40,52 @@ if (!$auth) if (isset($config['graph_types'][$type][$subtype]['descr'])) { $title .= " :: ".$config['graph_types'][$type][$subtype]['descr']; } else { $title .= " :: ".$graph_type; } $graph_array['height'] = "60"; - $graph_array['width'] = "125"; + $graph_array['width'] = $thumb_width; $graph_array['legend'] = "no"; $graph_array['to'] = $now; - $graph_array['id'] = $id; - $graph_array['type'] = $graph_type; - - $graph_array_zoom = $graph_array; - $graph_array_zoom['height'] = "150"; - $graph_array_zoom['width'] = "400"; + $graph_array['id'] = $vars['id']; + $graph_array['type'] = $vars['type']; print_optionbar_start(); echo($title); print_optionbar_end(); - echo("
"); - echo("
"); - $graph_array['from'] = $config['time']['sixhour']; - echo(""); + $thumb_array = array('sixhour' => '6 Hours', 'day' => '25 Hours', 'twoday' => '48 Hours', 'week' => 'One Week', 'twoweek' => 'Two Weeks', + 'month' => 'One Month', 'twomonth' => 'Two Months','year' => 'One Year', 'twoyear' => 'Two Years'); - $graph_array['from'] = $config['time']['day']; - echo(""); - $graph_array['from'] = $config['time']['twoday']; - echo(""); + foreach ($thumb_array as $period => $text) + { - $graph_array['from'] = $config['time']['week']; - echo(""); + $graph_array['from'] = $config['time'][$period]; - $graph_array['from'] = $config['time']['twoweek']; - echo(""); - - $graph_array['from'] = $config['time']['month']; - echo(""); - - $graph_array['from'] = $config['time']['twomonth']; - echo(""); - - $graph_array['from'] = $config['time']['year']; - echo(""); + $link_array = $vars; + $link_array['from'] = $graph_array['from']; + $link_array['to'] = $graph_array['to']; + $link_array['page'] = "graphs"; + $link = generate_url($link_array); + echo(""); + } echo("
"); + $graph_array = $vars; + $graph_array['height'] = "300"; - $graph_array['width'] = "1075"; - $graph_array['from'] = $from; - $graph_array['to'] = $to; - $graph_array['legend'] = "yes"; + $graph_array['width'] = $graph_width; echo generate_graph_js_state($graph_array); - echo("
"); + echo("
"); echo(generate_graph_tag($graph_array)); echo("
"); - echo("
"); } ?> diff --git a/html/pages/ports/list.inc.php b/html/pages/ports/list.inc.php index 5da3e81f2..00984036d 100644 --- a/html/pages/ports/list.inc.php +++ b/html/pages/ports/list.inc.php @@ -9,27 +9,28 @@ $row = 1; foreach (dbFetchRows($query, $param) as $interface) { - if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - - $speed = humanspeed($interface['ifSpeed']); - $type = humanmedia($interface['ifType']); - - $interface['in_rate'] = formatRates($interface['ifInOctets_rate'] * 8); - $interface['out_rate'] = formatRates($interface['ifOutOctets_rate'] * 8); - - - if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) - { - $error_img = generate_port_link($interface,"Interface Errors",errors); - } else { $error_img = ""; } if (port_permitted($interface['interface_id'], $interface['device_id'])) { + + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + + $speed = humanspeed($interface['ifSpeed']); + $type = humanmedia($interface['ifType']); + + if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) + { + $error_img = generate_port_link($interface,"Interface Errors",errors); + } else { $error_img = ""; } + + $interface['in_rate'] = formatRates($interface['ifInOctets_rate'] * 8); + $interface['out_rate'] = formatRates($interface['ifOutOctets_rate'] * 8); + $interface = ifLabel($interface, $device); echo(" - " . generate_device_link($interface) . " - " . generate_port_link($interface) . " $error_img + ".$interface['hostname']." + ".fixIfName($interface['label'])." $error_img $speed ".$interface['in_rate']." ".$interface['out_rate']." diff --git a/includes/polling/os/ios.inc.php b/includes/polling/os/ios.inc.php index 347c9fb15..58d0700c0 100755 --- a/includes/polling/os/ios.inc.php +++ b/includes/polling/os/ios.inc.php @@ -1,6 +1,5 @@