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 |
| Add Data Query: |
| Add Graph Template: |