diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 2300f8f437..461cd717ea 100644 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -19,6 +19,7 @@ Cacti CHANGELOG -bug#0001158: Deleted user causes error on user log viewer -bug#0001161: radio buttons have duplicate IDs. can easily be improved for usablility -bug#0001164: alt attributes don't make tooltips, title attrs do (host.php) +-bug#0001168: ALL_DATA_SOURCES_NODUPS includes DUPs? SIMILAR_DATA_SOURCES_DUPS is available again -bug: Cacti does not guarentee RRA consolidation functions exist in RRA's. -bug: Alert on changing logarithmic scaling removed -bug: add_hosts.php did not accept privacy protocol diff --git a/include/global_arrays.php b/include/global_arrays.php index 6e71d95a77..1017c5debd 100644 --- a/include/global_arrays.php +++ b/include/global_arrays.php @@ -302,8 +302,9 @@ $custom_data_source_types = array( "CURRENT_DATA_SOURCE" => "Current Graph Item Data Source", "ALL_DATA_SOURCES_NODUPS" => "All Data Sources (Don't Include Duplicates)", "ALL_DATA_SOURCES_DUPS" => "All Data Sources (Include Duplicates)", - "CURRENT_DS_MINIMUM_VALUE" => "Current Data Source Item: Minimum Value", "SIMILAR_DATA_SOURCES_NODUPS" => "All Similar Data Sources (Don't Include Duplicates)", + "SIMILAR_DATA_SOURCES_DUPS" => "All Similar Data Sources (Include Duplicates)", + "CURRENT_DS_MINIMUM_VALUE" => "Current Data Source Item: Minimum Value", "CURRENT_DS_MAXIMUM_VALUE" => "Current Data Source Item: Maximum Value", "CURRENT_GRAPH_MINIMUM_VALUE" => "Graph: Lower Limit", "CURRENT_GRAPH_MAXIMUM_VALUE" => "Graph: Upper Limit"); diff --git a/lib/rrd.php b/lib/rrd.php index 5990f6040a..90659a7e11 100644 --- a/lib/rrd.php +++ b/lib/rrd.php @@ -955,14 +955,18 @@ function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rr /* make cdef string here; a note about CDEF's in cacti. A CDEF is neither unique to a data source of global cdef, but is unique when those two variables combine. */ - $cdef_graph_defs = ""; $cdef_total_ds = ""; $cdef_similar_ds = ""; + $cdef_graph_defs = ""; $cdef_total_ds = ""; $cdef_similar_ds = ""; + $cdef_similar_ds_nodups = ""; $cdef_total_ds_nodups = ""; if ((!empty($graph_item["cdef_id"])) && (!isset($cdef_cache{$graph_item["cdef_id"]}{$graph_item["data_template_rrd_id"]}[$cf_id]))) { $cdef_string = $graph_variables["cdef_cache"]{$graph_item["graph_templates_item_id"]}; /* create cdef string for "total all data sources" if requested */ if (ereg("ALL_DATA_SOURCES_(NO)?DUPS", $cdef_string)) { - $item_count = 0; + $item_count = 0; + $nodups_item_count = 0; + $already_seen = array(); + for ($t=0;($t 1) { $cdef_total_ds .= str_repeat(",+", ($item_count - 2)) . ",+"; } + if ($nodups_item_count > 1) { + $cdef_total_ds_nodups .= str_repeat(",+", ($nodups_item_count - 2)) . ",+"; + } } /* create cdef string for "total similar data sources" if requested */ if (ereg("SIMILAR_DATA_SOURCES_(NO)?DUPS", $cdef_string) ) { - $sources_seen = array(); - $item_count = 0; + $item_count = 0; + $nodups_item_count = 0; + $sources_seen = array(); for ($t=0;($t 1) { $cdef_similar_ds .= str_repeat(",+", ($item_count - 2)) . ",+"; } + if ($nodups_item_count > 1) { + $cdef_similar_ds_nodups .= str_repeat(",+", ($nodups_item_count - 2)) . ",+"; + } } $cdef_string = str_replace("CURRENT_DATA_SOURCE", generate_graph_def_name(strval((isset($cf_ds_cache{$graph_item["data_template_rrd_id"]}[$cf_id]) ? $cf_ds_cache{$graph_item["data_template_rrd_id"]}[$cf_id] : "0"))), $cdef_string); - $cdef_string = str_replace("ALL_DATA_SOURCES_NODUPS", $cdef_total_ds, $cdef_string); - $cdef_string = str_replace("SIMILAR_DATA_SOURCES_NODUPS", $cdef_similar_ds, $cdef_string); + $cdef_string = str_replace("ALL_DATA_SOURCES_NODUPS", $cdef_total_ds_nodups, $cdef_string); + $cdef_string = str_replace("ALL_DATA_SOURCES_DUPS", $cdef_total_ds, $cdef_string); + $cdef_string = str_replace("SIMILAR_DATA_SOURCES_NODUPS", $cdef_similar_ds_nodups, $cdef_string); + $cdef_string = str_replace("SIMILAR_DATA_SOURCES_DUPS", $cdef_similar_ds, $cdef_string); /* data source item variables */ $cdef_string = str_replace("CURRENT_DS_MINIMUM_VALUE", (empty($graph_item["rrd_minimum"]) ? "0" : $graph_item["rrd_minimum"]), $cdef_string); @@ -1477,14 +1503,18 @@ function rrdtool_function_xport($local_graph_id, $rra_id, $xport_data_array, &$x /* make cdef string here; a note about CDEF's in cacti. A CDEF is neither unique to a data source of global cdef, but is unique when those two variables combine. */ - $cdef_xport_defs = ""; $cdef_total_ds = ""; $cdef_similar_ds = ""; + $cdef_xport_defs = ""; $cdef_total_ds = ""; $cdef_similar_ds = ""; + $cdef_similar_ds_nodups = ""; $cdef_total_ds_nodups = ""; if ((!empty($xport_item["cdef_id"])) && (!isset($cdef_cache{$xport_item["cdef_id"]}{$xport_item["data_template_rrd_id"]}[$cf_id]))) { $cdef_string = $xport_variables["cdef_cache"]{$xport_item["graph_templates_item_id"]}; /* create cdef string for "total all data sources" if requested */ if (ereg("ALL_DATA_SOURCES_(NO)?DUPS", $cdef_string)) { - $item_count = 0; + $item_count = 0; + $nodups_item_count = 0; + $already_seen = array(); + for ($t=0;($t 1) { $cdef_total_ds .= str_repeat(",+", ($item_count - 2)) . ",+"; } + if ($nodups_item_count > 1) { + $cdef_total_ds_nodups .= str_repeat(",+", ($nodups_item_count - 2)) . ",+"; + } } /* create cdef string for "total similar data sources" if requested */ if (ereg("SIMILAR_DATA_SOURCES_(NO)?DUPS", $cdef_string) ) { - $sources_seen = array(); - $item_count = 0; + $item_count = 0; + $nodups_item_count = 0; + $sources_seen = array(); for ($t=0;($t 1) { $cdef_similar_ds .= str_repeat(",+", ($item_count - 2)) . ",+"; } + if ($nodups_item_count > 1) { + $cdef_similar_ds_nodups .= str_repeat(",+", ($nodups_item_count - 2)) . ",+"; + } } $cdef_string = str_replace("CURRENT_DATA_SOURCE", generate_graph_def_name(strval((isset($cf_ds_cache{$xport_item["data_template_rrd_id"]}[$cf_id]) ? $cf_ds_cache{$xport_item["data_template_rrd_id"]}[$cf_id] : "0"))), $cdef_string); - $cdef_string = str_replace("ALL_DATA_SOURCES_NODUPS", $cdef_total_ds, $cdef_string); - $cdef_string = str_replace("SIMILAR_DATA_SOURCES_NODUPS", $cdef_similar_ds, $cdef_string); + $cdef_string = str_replace("ALL_DATA_SOURCES_DUPS", $cdef_total_ds, $cdef_string); + $cdef_string = str_replace("ALL_DATA_SOURCES_NODUPS", $cdef_total_ds_nodups, $cdef_string); + $cdef_string = str_replace("SIMILAR_DATA_SOURCES_DUPS", $cdef_similar_ds, $cdef_string); + $cdef_string = str_replace("SIMILAR_DATA_SOURCES_NODUPS", $cdef_similar_ds_nodups, $cdef_string); /* data source item variables */ $cdef_string = str_replace("CURRENT_DS_MINIMUM_VALUE", (empty($xport_item["rrd_minimum"]) ? "0" : $xport_item["rrd_minimum"]), $cdef_string);