mirror of
https://github.com/librenms/librenms.git
synced 2024-09-22 10:58:42 +00:00
migrate towards new URL format. slowly.
git-svn-id: http://www.observium.org/svn/observer/trunk@2491 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
ab8471158c
commit
95a287baa7
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
function generate_url($vars, $new_vars = array())
|
||||
{
|
||||
|
||||
@ -20,6 +22,22 @@ function generate_url($vars, $new_vars = array())
|
||||
|
||||
}
|
||||
|
||||
function generate_overlib_content($graph_array, $text)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$overlib_content = '<div style="width: 580px;"><h2>'.$text."</h2>";
|
||||
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>";
|
||||
|
||||
return $overlib_content;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_percentage_colours($percentage)
|
||||
{
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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 = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
$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 = "<a href='graphs/".$sensor['sensor_id']."/" . $graph_type . "/' onmouseover=\"return ";
|
||||
$sensor_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$sensor['sensor_descr'];
|
||||
$sensor_link .= "</div><div style=\'width: 570px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
$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 . "<span " . ($sensor['sensor_current'] < $sensor['sensor_limit_low'] || $sensor['sensor_current'] > $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . "</span></a>";
|
||||
$sensor_link_b = $sensor_link . $sensor_minigraph . "</a>";
|
||||
$sensor_link_a = $sensor_link . $sensor['sensor_descr'] . "</a>";
|
||||
$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'] = $graph_colour;
|
||||
$sensor_minigraph = generate_graph_tag($graph_array);
|
||||
|
||||
$sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$sensor_link_a</strong></td><td width=80 align=right class=tablehead>$sensor_link_b<td width=80 align=right class=tablehead>$sensor_link_c</td></tr>");
|
||||
echo("<tr bgcolor='$row_colour'>
|
||||
<td class=tablehead><strong>".overlib_link($link, $sensor['sensor_descr'], $overlib_content)."</strong></td>
|
||||
<td width=80 align=right class=tablehead>".overlib_link($link, $sensor_minigraph, $overlib_content)."</td>
|
||||
<td width=80 align=right class=tablehead>".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>
|
||||
</tr>");
|
||||
$i++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
@ -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('<div class=list-large>".$device['hostname']." - ".$text_descr;
|
||||
$mempool_popup .= "</div><img src=\'graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=125\'>";
|
||||
$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("<tr bgcolor=$row_colour><td class=tablehead><a href='".$mempool_url."' $mempool_popup>" . $text_descr . "</a></td>
|
||||
<td width=90><a href='".$mempool_url."' $mempool_popup><img src='$mini_url'></a></td>
|
||||
<td width=200><a href='".$mempool_url."' $mempool_popup>
|
||||
".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("<tr bgcolor=$row_colour>
|
||||
<td class=tablehead>".overlib_link($link, $text_descr, $overlib_content)."</td>
|
||||
<td width=90>".overlib_link($link, $minigraph, $overlib_content)."</td>
|
||||
<td width=200>".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)."
|
||||
</a></td>
|
||||
</tr>");
|
||||
|
||||
|
@ -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 = "<div class=list-large>".$device['hostname']." - Device Traffic</div>";
|
||||
$content .= "<div style=\'width: 850px\'>";
|
||||
$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 .= "</div>";
|
||||
|
||||
$link = $config['base_url'] . "/graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $day . "/" . $config['now'] . "/";
|
||||
|
||||
echo(overlib_link($link, $graph, $content, NULL));
|
||||
|
||||
echo(' <div style="height: 5px;"></div>');
|
||||
|
@ -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('<div class=list-large>".$device['hostname']." - ".$proc['processor_descr'];
|
||||
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=125\'>";
|
||||
$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("<tr bgcolor=$row_colour><td class=tablehead><a href='".$proc_url."' $proc_popup>" . $text_descr . "</a></td>
|
||||
<td width=90><a href='".$proc_url."' $proc_popup><img src='$mini_url'></a></td>
|
||||
<td width=200><a href='".$proc_url."' $proc_popup>
|
||||
".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("<tr bgcolor=$row_colour>
|
||||
<td class=tablehead>".overlib_link($link, $text_descr, $overlib_content)."</td>
|
||||
<td width=90>".overlib_link($link, $minigraph, $overlib_content)."</td>
|
||||
<td width=200>".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)."
|
||||
</a></td>
|
||||
</tr>");
|
||||
$processor_rows++;
|
||||
|
@ -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('<div class=list-large>".$device['hostname']." - ".$drive['storage_descr'];
|
||||
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=125\'>";
|
||||
$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("<tr bgcolor=$row_colour><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['storage_descr'] . "</a></td>
|
||||
<td width=90><a href='".$fs_url."' $fs_popup><img src='$mini_graph' /></a></td>
|
||||
<td width=200><a href='".$fs_url."' $fs_popup>".print_percentage_bar (200, 20, $perc, "$used / $total", "ffffff", $background['left'], $perc . "%", "ffffff", $background['right'])."</a></td>
|
||||
</tr>");
|
||||
$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("<tr bgcolor=$row_colour>
|
||||
<td class=tablehead>".overlib_link($link, $text_descr, $overlib_content)."</td>
|
||||
<td width=90>".overlib_link($link, $minigraph, $overlib_content)."</td>
|
||||
<td width=200>".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)."
|
||||
</a></td>
|
||||
</tr>");
|
||||
|
||||
$drive_rows++;
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,26 @@
|
||||
<?php
|
||||
|
||||
$id = $_GET['opta'];
|
||||
$graph_type = $_GET['optb'];
|
||||
if (is_numeric($_GET['optc'])) { $from = $_GET['optc']; } else { $from = $config['time']['day']; }
|
||||
if (is_numeric($_GET['optd'])) { $to = $_GET['optd']; } else { $to = $config['time']['now']; }
|
||||
unset($vars['page']);
|
||||
|
||||
preg_match('/^(?P<type>[A-Za-z0-9]+)_(?P<subtype>.+)/', 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<type>[A-Za-z0-9]+)_(?P<subtype>.+)/', 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("<div style='margin: 0px 0px 0px 0px'>");
|
||||
|
||||
echo("<div style='margin: auto;'>");
|
||||
|
||||
$graph_array['from'] = $config['time']['sixhour'];
|
||||
echo("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>6 Hour</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/".$graph_array['to']."/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
$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("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>24 Hour</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/$to/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
|
||||
$graph_array['from'] = $config['time']['twoday'];
|
||||
echo("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>48 Hour</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/$to/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
foreach ($thumb_array as $period => $text)
|
||||
{
|
||||
|
||||
$graph_array['from'] = $config['time']['week'];
|
||||
echo("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>Week</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/$to/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
$graph_array['from'] = $config['time'][$period];
|
||||
|
||||
$graph_array['from'] = $config['time']['twoweek'];
|
||||
echo("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>Two Week</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/$to/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
|
||||
$graph_array['from'] = $config['time']['month'];
|
||||
echo("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>Month</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/$to/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
|
||||
$graph_array['from'] = $config['time']['twomonth'];
|
||||
echo("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>Two Month</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/$to/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
|
||||
$graph_array['from'] = $config['time']['year'];
|
||||
echo("<div style='width: ${width}px; margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>Year</span><br />
|
||||
<a href='graphs/$id/$graph_type/".$graph_array['from']."/$to/'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
$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("<div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5; float: left;' class='rounded-3px'>
|
||||
<span class=device-head>".$text."</span><br />
|
||||
<a href='".$link."'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo(" </a>
|
||||
</div>");
|
||||
}
|
||||
echo("</div>");
|
||||
|
||||
$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("<div style='width:1150px; margin: auto;'>");
|
||||
echo("<div style='width: ".$graph_array['width']."; margin: auto;'>");
|
||||
echo(generate_graph_tag($graph_array));
|
||||
echo("</div>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -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,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",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,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",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("<tr bgcolor=$row_colour>
|
||||
<td width=5></td>
|
||||
<td width=200 class=list-bold>" . generate_device_link($interface) . "</td>
|
||||
<td width=150 class=list-bold>" . generate_port_link($interface) . " $error_img</td>
|
||||
<td width=200 class=list-bold><a href='" . generate_device_url($interface) . "'>".$interface['hostname']."</a></td>
|
||||
<td width=150 class=list-bold><a href='" . generate_port_url($interface) . "'>".fixIfName($interface['label'])." $error_img</td>
|
||||
<td width=110 >$speed</td>
|
||||
<td width=110 class=green>".$interface['in_rate']."</td>
|
||||
<td width=110 class=blue>".$interface['out_rate']."</td>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$poll_device['sysDescr'] = str_replace("IOS (tm)", "IOS (tm),", $poll_device['sysDescr']);
|
||||
list(,$features,$version) = explode(",", $poll_device['sysDescr']);
|
||||
$version = str_replace(" Version ", "", $version);
|
||||
@ -35,12 +34,12 @@ list($version) = explode(",", $version);
|
||||
# $ciscomodel = str_replace("\"","",$ciscomodel);
|
||||
# if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
|
||||
|
||||
# if (strpos($poll_device['sysDescr'], "IOS XR")) {
|
||||
# list(,$version) = explode(",", $poll_device['sysDescr']);
|
||||
# $version = trim($version);
|
||||
# list(,$version) = explode(" ", $version);
|
||||
# list($version) = explode("\n", $version);
|
||||
# trim($version);
|
||||
# }
|
||||
if (strpos($poll_device['sysDescr'], "IOS XR")) {
|
||||
list(,$version) = explode(",", $poll_device['sysDescr']);
|
||||
$version = trim($version);
|
||||
list(,$version) = explode(" ", $version);
|
||||
list($version) = explode("\n", $version);
|
||||
trim($version);
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user