diff --git a/html/includes/graphs/device/processor.inc.php b/html/includes/graphs/device/processor_separate.inc.php similarity index 83% rename from html/includes/graphs/device/processor.inc.php rename to html/includes/graphs/device/processor_separate.inc.php index 6fac4e91ef..e253634ba7 100644 --- a/html/includes/graphs/device/processor.inc.php +++ b/html/includes/graphs/device/processor_separate.inc.php @@ -1,7 +1,9 @@ \ No newline at end of file +?> diff --git a/html/includes/graphs/device/processor_stack.inc.php b/html/includes/graphs/device/processor_stack.inc.php new file mode 100644 index 0000000000..61af8679a2 --- /dev/null +++ b/html/includes/graphs/device/processor_stack.inc.php @@ -0,0 +1,38 @@ + diff --git a/html/includes/graphs/generic_multi_simplex_seperated.inc.php b/html/includes/graphs/generic_multi_simplex_seperated.inc.php index 680d1afa79..f92c84a0c3 100644 --- a/html/includes/graphs/generic_multi_simplex_seperated.inc.php +++ b/html/includes/graphs/generic_multi_simplex_seperated.inc.php @@ -2,40 +2,67 @@ include("includes/graphs/common.inc.php"); -$unit_text = str_pad(truncate($unit_text,10),10); + +$descrlen = "18"; +$unitlen = "10"; +if($nototal) { $descrlen += "2"; $unitlen += "2";} +$unit_text = str_pad(truncate($unit_text,$unitlen),$unitlen); + $rrd_options .= " COMMENT:'$unit_text Cur Max'"; if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; } $rrd_options .= " COMMENT:'\\n'"; -$iter=0; -foreach ($rrd_list as $rrd) +$colour_iter=0; +foreach ($rrd_list as $i => $rrd) { - if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; } - $colour = $config['graph_colours'][$colours][$iter]; + if (!$config['graph_colours'][$colours][$colour_iter]) { $colour_iter = 0; } + $colour = $config['graph_colours'][$colours][$colour_iter]; + $colour_iter++; + $rrd_options .= " DEF:".$rrd['rra'].$i."=".$rrd['filename'].":".$rrd['rra'].":AVERAGE "; $rrd_options .= " DEF:".$rrd['rra'].$i."max=".$rrd['filename'].":".$rrd['rra'].":MAX "; + + ## Suppress totalling? if (!$nototal) { $rrd_options .= " VDEF:tot".$rrd['rra'].$i."=".$rrd['rra'].$i.",TOTAL"; } + ## This this not the first entry? if ($i) { $stack="STACK"; } # if we've been passed a multiplier we must make a CDEF based on it! - $defname = $rrd['rra']; + $g_defname = $rrd['rra']; if (is_numeric($multiplier)) { - $defname = $defname . "_cdef"; - $rrd_options .= " CDEF:" . $defname . $i . "=" . $rrd['rra'] . $i . "," . $multiplier . ",*"; + $g_defname = $rrd['rra'] . "_cdef"; + $rrd_options .= " CDEF:" . $g_defname . $i . "=" . $rrd['rra'] . $i . "," . $multiplier . ",*"; + $rrd_options .= " CDEF:" . $g_defname . $i . "max=" . $rrd['rra'] . $i . "max," . $multiplier . ",*"; + + ## If we've been passed a divider (divisor!) we make a CDEF for it. + } elseif (is_numeric($divider)) + { + $g_defname = $rrd['rra'] . "_cdef"; + $rrd_options .= " CDEF:" . $g_defname . $i . "=" . $rrd['rra'] . $i . "," . $divider . ",/"; + $rrd_options .= " CDEF:" . $g_defname . $i . "max=" . $rrd['rra'] . $i . "max," . $divider . ",/"; } - $rrd_options .= " AREA:" . $defname . $i . "#" . $colour . ":'" . substr(str_pad($rrd['descr'], 18),0,18) . "':$stack"; - $rrd_options .= " GPRINT:".$rrd['rra'].$i.":LAST:%6.2lf%s$units"; - $rrd_options .= " GPRINT:".$rrd['rra'].$i."max:MAX:%6.2lf%s$units"; - if (!$nototal) { $rrd_options .= " GPRINT:tot".$rrd['rra'].$i.":%6.2lf%s$total_units"; } + ## Are our text values related to te multiplier/divisor or not? + if(isset($text_orig) && $text_orig) + { + $t_defname = $rrd['rra']; + } else { + $t_defname = $g_defname; + } + + + $rrd_options .= " AREA:".$g_defname.$i."#".$colour.":'".substr(str_pad($rrd['descr'], $descrlen),0,$descrlen)."':$stack"; + $rrd_options .= " GPRINT:".$t_defname.$i.":LAST:%6.2lf%s".str_replace("%", "%%", $units).""; + $rrd_options .= " GPRINT:".$t_defname.$i."max:MAX:%6.2lf%s".str_replace("%", "%%", $units).""; + + if (!$nototal) { $rrd_options .= " GPRINT:tot".$rrd['rra'].$i.":%6.2lf%s".str_replace("%", "%%", $total_units).""; } $rrd_options .= " COMMENT:'\\n'"; - $i++; $iter++; } ?> diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index 6e6c128424..f4d689da03 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -10,12 +10,6 @@ preg_match('/^(?P[A-Za-z0-9]+)_(?P.+)/', mres($graph_type), $grap $type = $graphtype['type']; $subtype = $graphtype['subtype']; -if (isset($config['graph'][$type][$subtype])) { $descr = $config['graph'][$type][$subtype]; } else { $descr = $graph_type; } - -#$descr = mysql_result(mysql_query("SELECT `graph_descr` FROM `graph_types` WHERE `graph_type` = '".$type."' AND `graph_subtype` = '".$subtype."'"),0); - -$descr = $config['graph_types'][$type][$subtype]['descr']; - if (is_file("includes/graphs/".$type."/auth.inc.php")) { include("includes/graphs/".$type."/auth.inc.php"); @@ -27,7 +21,11 @@ if (!$auth) } else { # Do we really need to show the type? User does not have to see the type of graph (i.e. sensor_temperature) -# if (isset($config['graph'][$type][$subtype])) { $title .= " :: ".$config['graph'][$type][$subtype]; } else { $title .= " :: ".$graph_type; } + +# Yes, i think we doo, else we have graph titles of "router1". It's nice to show the type here. maybe only the pretty +# array_type? + + 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'] = "150"; @@ -115,4 +113,4 @@ if (!$auth) echo(""); } -?> \ No newline at end of file +?> diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 1d0cf21b48..987f992267 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -109,6 +109,7 @@ $warn_colour_b = "#ffcccc"; #$config['graph_colours']['blues'] = array("b5d7ff","6eb7ff","0064ff","0082ff","0019d5","0016cb","00007d"); ## Cold Blues $config['graph_colours']['mixed'] = array('CC0000','008C00','4096EE','73880A','D01F3C','36393D','FF0084'); +$config['graph_colours']['oranges'] = array('E43C00','E74B00','EB5B00','EF6A00','F37900','F78800','FB9700','FFA700'); $config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300'); $config['graph_colours']['pinks'] = array('D0558F','B34773','943A57','792C38','5C1F1E','401F10'); $config['graph_colours']['blues'] = array('A0A0E5','8080BD','606096','40406F','202048','000033'); diff --git a/includes/static-config.php b/includes/static-config.php index 426cf7b3cc..589c6739b9 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -18,6 +18,11 @@ $config['os']['default']['over'][0]['text'] = "Processor Usage"; $config['os']['default']['over'][1]['graph'] = "device_mempool"; $config['os']['default']['over'][1]['text'] = "Memory Usage"; +$os_group = "unix"; +$config['os_group'][$os_group]['type'] = "server"; +$config['os_group'][$os_group]['processor_stacked'] = 1; + + $os = "generic"; $config['os'][$os]['text'] = "Generic Device"; @@ -697,6 +702,20 @@ $config['os'][$os]['over'][0]['graph'] = "device_current"; $config['os'][$os]['over'][0]['text'] = "Current"; $config['os'][$os]['icon'] = "tripplite"; +foreach($config['os'] as $this_os => $blah) +{ + $this_os_group = $config['os'][$this_os]['group']; + if(isset($config['os'][$this_os]['group']) && isset($config['os_group'][$this_os_group])) + { + foreach ($config['os_group'][$this_os_group] as $property => $value) + { + if(!isset($config['os'][$this_os][$property])) + { + $config['os'][$this_os][$property] = $value; + } + } + } +} $device_types = array('server', 'network', 'firewall', 'workstation', 'printer', 'power', 'environment');