0) { foreach ($snmp_queries as $snmp_query) { db_execute("replace into host_snmp_query (host_id,snmp_query_id) values ($host_id," . $snmp_query["snmp_query_id"] . ")"); /* recache snmp data */ data_query($host_id, $snmp_query["snmp_query_id"]); } } $graph_templates = db_fetch_assoc("select graph_template_id from host_template_graph where host_template_id=" . $_POST["host_template_id"]); if (sizeof($graph_templates) > 0) { foreach ($graph_templates as $graph_template) { db_execute("replace into host_graph (host_id,graph_template_id) values ($host_id," . $graph_template["graph_template_id"] . ")"); } } } } if ((is_error_message()) || ($_POST["host_template_id"] != $_POST["_host_template_id"])) { header("Location: host.php?action=edit&id=" . (empty($host_id) ? $_POST["id"] : $host_id)); }else{ header("Location: host.php"); } } } /* ------------------- Data Query Functions ------------------- */ function host_reload_query() { data_query($_GET["host_id"], $_GET["id"]); } function host_remove_query() { db_execute("delete from host_snmp_cache where snmp_query_id=" . $_GET["id"] . " and host_id=" . $_GET["host_id"]); db_execute("delete from host_snmp_query where snmp_query_id=" . $_GET["id"] . " and host_id=" . $_GET["host_id"]); } function host_remove_gt() { db_execute("delete from host_graph where graph_template_id=" . $_GET["id"] . " and host_id=" . $_GET["host_id"]); } /* --------------------- Host Functions --------------------- */ function host_remove() { global $config; if ((read_config_option("remove_verification") == "on") && (!isset($_GET["confirm"]))) { include("./include/top_header.php"); form_confirm("Are You Sure?", "Are you sure you want to delete the host '" . db_fetch_cell("select description from host where id=" . $_GET["id"]) . "'?", "host.php", "host.php?action=remove&id=" . $_GET["id"]); include("./include/bottom_footer.php"); exit; } if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) { db_execute("delete from host where id=" . $_GET["id"]); db_execute("delete from host_graph where host_id=" . $_GET["id"]); db_execute("delete from host_snmp_query where host_id=" . $_GET["id"]); db_execute("delete from host_snmp_cache where host_id=" . $_GET["id"]); db_execute("update data_local set host_id=0 where host_id=" . $_GET["id"]); db_execute("update graph_local set host_id=0 where host_id=" . $_GET["id"]); } } function host_edit() { global $colors, $paths, $fields_host_edit; display_output_messages(); if (!empty($_GET["id"])) { $host = db_fetch_row("select * from host where id=" . $_GET["id"]); $header_label = "[edit: " . $host["description"] . "]"; }else{ $header_label = "[new]"; } if (!empty($host["id"])) { ?>
()
SNMP Information
SNMP not in use\n"; }else{ $snmp_system = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.1.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]); if ($snmp_system == "") { print "SNMP error\n"; }else{ $snmp_uptime = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.3.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]); $snmp_hostname = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.5.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]); print "System: $snmp_system
\n"; print "Uptime: $snmp_uptime
\n"; print "Hostname: $snmp_hostname
\n"; } } ?>
*">Create Graphs for this Host

Polling Hosts $header_label", "98%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array("form_name" => "chk"), "fields" => inject_form_variables($fields_host_edit, (isset($host) ? $host : array())) )); end_box(); if ((isset($_GET["display_dq_details"])) && (isset($_SESSION["debug_log"]["data_query"]))) { start_box("Data Query Debug Information", "98%", $colors["header"], "3", "center", ""); print "" . debug_log_return("data_query") . ""; end_box(); } if (!empty($host["id"])) { start_box("Associated Data Queries", "98%", $colors["header"], "3", "center", ""); print ""; DrawMatrixHeaderItem("Data Query Name",$colors["header_text"],1); DrawMatrixHeaderItem("Debugging",$colors["header_text"],1); DrawMatrixHeaderItem("Status",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print ""; $selected_data_queries = db_fetch_assoc("select snmp_query.id, snmp_query.name from snmp_query,host_snmp_query where snmp_query.id=host_snmp_query.snmp_query_id and host_snmp_query.host_id=" . $_GET["id"] . " order by snmp_query.name"); $i = 0; if (sizeof($selected_data_queries) > 0) { foreach ($selected_data_queries as $item) { $i++; /* get status information for this data query */ $num_dq_items = sizeof(db_fetch_assoc("select snmp_index from host_snmp_cache where host_id=" . $_GET["id"] . " and snmp_query_id=" . $item["id"])); $num_dq_rows = sizeof(db_fetch_assoc("select snmp_index from host_snmp_cache where host_id=" . $_GET["id"] . " and snmp_query_id=" . $item["id"] . " group by snmp_index")); $status = "success"; ?> ) (&host_id=">Verbose Query) Success" : "Fail");?> [ Item, Row] Reload Data Query  Delete Data Query Association No associated data queries."; } ?> ">
Add Data Query:   
Associated Graph Templates", "98%", $colors["header"], "3", "center", ""); print ""; DrawMatrixHeaderItem("Graph Template Name",$colors["header_text"],1); DrawMatrixHeaderItem("Status",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print ""; $selected_graph_templates = db_fetch_assoc("select graph_templates.id, graph_templates.name from graph_templates,host_graph where graph_templates.id=host_graph.graph_template_id and host_graph.host_id=" . $_GET["id"] . " order by graph_templates.name"); $i = 0; if (sizeof($selected_graph_templates) > 0) { foreach ($selected_graph_templates as $item) { $i++; /* get status information for this graph template */ $is_being_graphed = (sizeof(db_fetch_assoc("select id from graph_local where graph_template_id=" . $item["id"] . " and host_id=" . $_GET["id"])) > 0) ? true : false; ?> ) Is Being Graphed (Edit)" : "Not Being Graphed");?> Delete Graph Template Association No associated graph templates."; } ?> ">
Add Graph Template:   
Polling Hosts", "98%", $colors["header"], "3", "center", "host.php?action=edit"); print ""; DrawMatrixHeaderItem("Description",$colors["header_text"],1); DrawMatrixHeaderItem("Hostname",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print ""; $hosts = db_fetch_assoc("select id,hostname,description from host order by description"); $i = 0; if (sizeof($hosts) > 0) { foreach ($hosts as $host) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> "> ">Delete  No Hosts"; } end_box(); } ?>