diff --git a/graphs_new.php b/graphs_new.php
index d1ae1736e0..76a83dea1b 100644
--- a/graphs_new.php
+++ b/graphs_new.php
@@ -388,6 +388,13 @@ function graphs() {
()
+
+
+
@@ -425,81 +432,79 @@ function graphs() {
0) {
- /* we give users the option to turn off the javascript features for data queries with lots of rows */
- if (read_config_option("max_data_query_javascript_rows") >= $total_rows) {
- $use_javascript = true;
- }else{
- $use_javascript = false;
- }
-
- start_box("Host Template [" . (empty($host["host_template_id"]) ? "None" : db_fetch_cell("select name from host_template where id=" . $host["host_template_id"])) . "]", "98%", $colors["header"], "3", "center", "");
-
- print "
-
Graph Template Name
-
\n
-
\n";
-
- $graph_templates = db_fetch_assoc("select
- graph_templates.id as graph_template_id,
- graph_templates.name as graph_template_name
- from host_graph,graph_templates
- where host_graph.graph_template_id=graph_templates.id
- and host_graph.host_id=" . $_REQUEST["host_id"] . "
- order by graph_templates.name");
-
- $template_graphs = db_fetch_assoc("select graph_local.graph_template_id from graph_local,host_graph where graph_local.graph_template_id=host_graph.graph_template_id and graph_local.host_id=" . $host["id"] . " group by graph_local.graph_template_id");
-
- print "\n";
-
- if ((sizeof($template_graphs) > 0) && ($use_javascript == true)) {
- print "\n";
- }
-
- /* create a row for each graph template associated with the host template */
- $i = 0;
- if (sizeof($graph_templates) > 0) {
- foreach ($graph_templates as $graph_template) {
- $query_row = $graph_template["graph_template_id"];
-
- print "
";
- }
- }
-
- if ($use_javascript == true) {
- print "\n";
- }
-
- /* create a row at the bottom that lets the user create any graph they choose */
- print "
-
- Create: ";
- form_dropdown("cg_g", db_fetch_assoc("select id,name from graph_templates order by name"), "name", "id", "", "(Select a graph type to create)", "", "font-size: 10px;");
- print "
-
";
-
- end_box();
+ /* we give users the option to turn off the javascript features for data queries with lots of rows */
+ if (read_config_option("max_data_query_javascript_rows") >= $total_rows) {
+ $use_javascript = true;
+ }else{
+ $use_javascript = false;
}
+ start_box("Graph Templates", "98%", $colors["header"], "3", "center", "");
+
+ print "
+
Graph Template Name
+
\n
+
\n";
+
+ $graph_templates = db_fetch_assoc("select
+ graph_templates.id as graph_template_id,
+ graph_templates.name as graph_template_name
+ from host_graph,graph_templates
+ where host_graph.graph_template_id=graph_templates.id
+ and host_graph.host_id=" . $_REQUEST["host_id"] . "
+ order by graph_templates.name");
+
+ $template_graphs = db_fetch_assoc("select graph_local.graph_template_id from graph_local,host_graph where graph_local.graph_template_id=host_graph.graph_template_id and graph_local.host_id=" . $host["id"] . " group by graph_local.graph_template_id");
+
+ print "\n";
+
+ if ((sizeof($template_graphs) > 0) && ($use_javascript == true)) {
+ print "\n";
+ }
+
+ /* create a row for each graph template associated with the host template */
+ $i = 0;
+ if (sizeof($graph_templates) > 0) {
+ foreach ($graph_templates as $graph_template) {
+ $query_row = $graph_template["graph_template_id"];
+
+ print "
";
+ }
+ }
+
+ if ($use_javascript == true) {
+ print "\n";
+ }
+
+ /* create a row at the bottom that lets the user create any graph they choose */
+ print "
+
+ Create: ";
+ form_dropdown("cg_g", db_fetch_assoc("select id,name from graph_templates order by name"), "name", "id", "", "(Select a graph type to create)", "", "font-size: 10px;");
+ print "
+
";
+
+ end_box();
+
$snmp_queries = db_fetch_assoc("select
snmp_query.id,
snmp_query.name,
@@ -518,7 +523,9 @@ function graphs() {
$xml_array = get_data_query_array($snmp_query["id"]);
$xml_outputs = array();
+ $total_rows = 0;
$num_input_fields = 0;
+ $num_visible_fields = 0;
if ($xml_array != false) {
/* loop through once so we can find out how many input fields there are */
@@ -531,11 +538,6 @@ function graphs() {
}
}
}
-
- reset($xml_array["fields"]);
- $snmp_query_indexes = array();
- $num_visible_fields = 0;
- $i = 0;
}
/* we give users the option to turn off the javascript features for data queries with lots of rows */
@@ -597,11 +599,11 @@ function graphs() {
if ($xml_array != false) {
$html_dq_header = "";
+ $snmp_query_indexes = array();
+ reset($xml_array["fields"]);
while (list($field_name, $field_array) = each($xml_array["fields"])) {
if ($field_array["direction"] == "input") {
- $i++;
-
$raw_data = db_fetch_assoc("select field_value,snmp_index from host_snmp_cache where host_id=" . $host["id"] . " and field_name='$field_name' and snmp_query_id=" . $snmp_query["id"]);
/* don't even both to display the column if it has no data */
@@ -632,15 +634,14 @@ function graphs() {
$html_dq_header