diff --git a/html/pages/device/graphs.inc.php b/html/pages/device/graphs.inc.php
index cadfeaf0f..72fa6ba1a 100644
--- a/html/pages/device/graphs.inc.php
+++ b/html/pages/device/graphs.inc.php
@@ -17,13 +17,6 @@ echo("Graphs » ");
$sep = "";
-foreach (dbFetchRows("SELECT * FROM munin_plugins WHERE device_id = ? ORDER BY mplug_category, mplug_type", array($device['device_id'])) as $mplug)
-{
-# if (strlen($mplug['mplug_category']) == 0) { $mplug['mplug_category'] = "general"; } else { }
- $graph_enable[$mplug['mplug_category']][$mplug['mplug_type']]['id'] = $mplug['mplug_id'];
- $graph_enable[$mplug['mplug_category']][$mplug['mplug_type']]['title'] = $mplug['mplug_title'];
-}
-
foreach (dbFetchRows("SELECT * FROM device_graphs WHERE device_id = ? ORDER BY graph", array($device['device_id'])) as $graph)
{
$section = $config['graph_types']['device'][$graph['graph']]['section'];
@@ -59,18 +52,11 @@ $graph_enable = $graph_enable[$vars['group']];
#foreach ($config['graph_types']['device'] as $graph => $entry)
foreach ($graph_enable as $graph => $entry)
{
+ $graph_array = array();
if ($graph_enable[$graph])
{
- if (is_numeric($entry['id']))
- {
- $graph_title = $entry['title'];
- $graph_array['type'] = "munin_graph";
- $graph_array['id'] = $entry['id'];
- } else {
- $graph_title = $config['graph_types']['device'][$graph]['descr'];
- $graph_array['type'] = "device_" . $graph;
- }
-
+ $graph_title = $config['graph_types']['device'][$graph]['descr'];
+ $graph_array['type'] = "device_" . $graph;
include("includes/print-device-graph.php");
}
}
diff --git a/html/pages/device/graphs/netstats_icmp_info.inc.php b/html/pages/device/graphs/netstats_icmp_info.inc.php
index a396c940f..9e798d2c7 100644
--- a/html/pages/device/graphs/netstats_icmp_info.inc.php
+++ b/html/pages/device/graphs/netstats_icmp_info.inc.php
@@ -8,4 +8,4 @@ if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-icmp.rrd"
include("includes/print-device-graph.php");
}
-?>
\ No newline at end of file
+?>
diff --git a/html/pages/device/munin.inc.php b/html/pages/device/munin.inc.php
new file mode 100644
index 000000000..1d0498c34
--- /dev/null
+++ b/html/pages/device/munin.inc.php
@@ -0,0 +1,76 @@
+ 'device',
+ 'device' => $device['device_id'],
+ 'tab' => 'munin');
+
+$bg="#ffffff";
+
+echo('');
+
+print_optionbar_start();
+
+echo("Munin » ");
+
+$sep = "";
+
+foreach (dbFetchRows("SELECT * FROM munin_plugins WHERE device_id = ? ORDER BY mplug_category, mplug_type", array($device['device_id'])) as $mplug)
+{
+# if (strlen($mplug['mplug_category']) == 0) { $mplug['mplug_category'] = "general"; } else { }
+ $graph_enable[$mplug['mplug_category']][$mplug['mplug_type']]['id'] = $mplug['mplug_id'];
+ $graph_enable[$mplug['mplug_category']][$mplug['mplug_type']]['title'] = $mplug['mplug_title'];
+ $graph_enable[$mplug['mplug_category']][$mplug['mplug_type']]['plugin'] = $mplug['mplug_type'];
+}
+
+foreach ($graph_enable as $section => $nothing)
+{
+ if (isset($graph_enable) && is_array($graph_enable[$section]))
+ {
+ $type = strtolower($section);
+ if (!$vars['group']) { $vars['group'] = $type; }
+ echo($sep);
+ if ($vars['group'] == $type)
+ {
+ echo('");
+ }
+ $sep = " | ";
+ }
+}
+
+unset ($sep);
+print_optionbar_end();
+
+$graph_enable = $graph_enable[$vars['group']];
+
+#foreach ($config['graph_types']['device'] as $graph => $entry)
+foreach ($graph_enable as $graph => $entry)
+{
+ $graph_array = array();
+ if ($graph_enable[$graph])
+ {
+ if (!empty($entry['plugin']))
+ {
+ $graph_title = $entry['title'];
+ $graph_array['type'] = "munin_graph";
+ $graph_array['device'] = $device['device_id'];
+ $graph_array['plugin'] = $entry['plugin'];
+ } else {
+ $graph_title = $config['graph_types']['device'][$graph]['descr'];
+ $graph_array['type'] = "device_" . $graph;
+ }
+
+ include("includes/print-device-graph.php");
+ }
+}
+
+$pagetitle[] = "Graphs";
+
+?>
diff --git a/html/pages/device/overview/ports.inc.php b/html/pages/device/overview/ports.inc.php
index 406b6ac6c..2efc94341 100644
--- a/html/pages/device/overview/ports.inc.php
+++ b/html/pages/device/overview/ports.inc.php
@@ -7,7 +7,7 @@ if ($ports['total'])
$graph_array['height'] = "100";
$graph_array['width'] = "485";
$graph_array['to'] = $config['time']['now'];
- $graph_array['id'] = $device['device_id'];
+ $graph_array['device'] = $device['device_id'];
$graph_array['type'] = "device_bits";
$graph_array['from'] = $config['time']['day'];
$graph_array['legend'] = "no";
diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php
index 2a6d8fd7f..e51dc6aac 100644
--- a/html/pages/graphs.inc.php
+++ b/html/pages/graphs.inc.php
@@ -22,6 +22,13 @@ $type = $graphtype['type'];
$subtype = $graphtype['subtype'];
$id = $vars['id'];
+if(is_numeric($vars['device']))
+{
+ $device = device_by_id_cache($vars['device']);
+} elseif(!empty($vars['device'])) {
+ $device = device_by_name($vars['device']);
+}
+
if (is_file("includes/graphs/".$type."/auth.inc.php"))
{
include("includes/graphs/".$type."/auth.inc.php");
diff --git a/html/pages/packages.inc.php b/html/pages/packages.inc.php
index 52dc6cc89..e505daa39 100644
--- a/html/pages/packages.inc.php
+++ b/html/pages/packages.inc.php
@@ -7,8 +7,8 @@ foreach ($vars as $var => $value)
switch ($var)
{
case 'name':
- $where .= " AND `$var` LIKE ?";
- $param[] = "%".$value."%";
+ $where .= " AND `$var` = ?";
+ $param[] = $value;
break;
}
}
@@ -45,8 +45,12 @@ foreach (dbFetchRows("SELECT * FROM `packages` WHERE 1 $where GROUP BY `name`",
$content .= "
";
}
$content .= "";
-
- echo("".overlib_link("", $version, $content, NULL)."");
+ if(empty($vars['name']))
+ {
+ echo("".overlib_link("", $version, $content, NULL)."");
+ } else {
+ echo("$version $content");
+ }
}
echo("");
diff --git a/includes/common.php b/includes/common.php
index acb5895f8..bb039913a 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -257,6 +257,7 @@ function ifclass($ifOperStatus, $ifAdminStatus)
function device_by_name($name, $refresh = 0)
{
+ ## FIXME - cache name > id too.
return device_by_id_cache(getidbyname($name), $refresh);
}
|