예제 #1
0
파일: host.php 프로젝트: MrWnn/cacti
function host_remove()
{
    global $config;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_request('id'));
    /* ==================================================== */
    if (read_config_option('deletion_verification') == 'on' && !isset($_REQUEST['confirm'])) {
        top_header();
        form_confirm('Are You Sure?', "Are you sure you want to delete the host <strong>'" . htmlspecialchars(db_fetch_cell_prepared('SELECT description FROM host WHERE id = ?', array($_REQUEST['id']))) . "'</strong>?", htmlspecialchars('host.php'), htmlspecialchars('host.php?action=remove&id=' . $_REQUEST['id']));
        bottom_footer();
        exit;
    }
    if (read_config_option('deletion_verification') == '' || isset($_REQUEST['confirm'])) {
        api_device_remove($_REQUEST['id']);
    }
}
예제 #2
0
			}
			/* delete graphs/data sources tied to this device */
			if (!$debug) {
				api_data_source_remove_multi($data_sources_to_act_on);
				api_graph_remove_multi($graphs_to_act_on);
			}
			echo __("Removing device and all resources for device id ") . $item["id"];
		} else {
			/* leave graphs and data_sources in place, but disable the data sources */
			if (!$debug) {
				api_data_source_disable_multi($data_sources_to_act_on);
			}
			echo __("Removing device but keeping resources for device id ") . $item["id"];
		}

		api_device_remove($item["id"]);

		if (is_error_message()) {
			echo __(". ERROR: Failed to remove this device") . "\n";
		} else {
			echo __(". Success - removed device id: ") . ($item["id"]) . "\n";
		}
	}
}else{
	display_help($me);
	exit(0);
}

function display_help($me) {
	echo "Remove Device Script 1.0" . ", " . __("Copyright 2004-2010 - The Cacti Group") . "\n";
	echo __("A simple command line utility to remove a device from Cacti") . "\n\n";
예제 #3
0
     if ($delete_graphs) {
         // code copied & pasted from version 0.8.8a
         // cacti/site/lib/host.php and cacti/site/graphs.php
         // unfortunately no api function for this yet
         $graphs = db_fetch_assoc("select\n\t\t\tgraph_local.id as local_graph_id\n\t\t\tfrom graph_local\n\t\t\twhere graph_local.host_id=" . $host_id);
         if (sizeof($graphs) > 0) {
             foreach ($graphs as $graph) {
                 $data_sources = array_rekey(db_fetch_assoc("SELECT data_template_data.local_data_id\n\t\t\t\t\tFROM (data_template_rrd, data_template_data, graph_templates_item)\n\t\t\t\t\tWHERE graph_templates_item.task_item_id=data_template_rrd.id\n\t\t\t\t\tAND data_template_rrd.local_data_id=data_template_data.local_data_id\n\t\t\t\t\tAND graph_templates_item.local_graph_id=" . $graph["local_graph_id"] . "\n\t\t\t\t\tAND data_template_data.local_data_id > 0"), "local_data_id", "local_data_id");
                 if (sizeof($data_sources)) {
                     api_data_source_remove_multi($data_sources);
                 }
                 api_graph_remove($graph["local_graph_id"]);
             }
         }
     }
     api_device_remove($host_id);
     if (host_id($ip, 1)) {
         die("Failed to remove hostname {$ip}");
     }
     exit(0);
     /*
     case "get-device":
     	echo host_id($ip);
     	exit(0);
     */
 /*
 case "get-device":
 	echo host_id($ip);
 	exit(0);
 */
 case "get-graph-templates":
예제 #4
0
파일: host.php 프로젝트: songchin/Cacti
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 <strong>'" . db_fetch_cell("select description from host where id=" . $_GET["id"]) . "'</strong>?", "host.php", "host.php?action=remove&id=" . $_GET["id"]);
		include("./include/bottom_footer.php");
		exit;
	}

	if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) {
		api_device_remove($_GET["id"]);
	}
}
예제 #5
0
파일: host.php 프로젝트: songchin/Cacti
function host_remove()
{
    global $config;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var("id"));
    /* ==================================================== */
    if (read_config_option("deletion_verification") == "on" && !isset($_GET["confirm"])) {
        include "./include/top_header.php";
        form_confirm("Are You Sure?", "Are you sure you want to delete the host <strong>'" . db_fetch_cell("select description from host where id=" . $_GET["id"]) . "'</strong>?", "host.php", "host.php?action=remove&id=" . $_GET["id"]);
        include "./include/bottom_footer.php";
        exit;
    }
    if (read_config_option("deletion_verification") == "" || isset($_GET["confirm"])) {
        api_device_remove($_GET["id"]);
    }
}
예제 #6
0
function host_remove()
{
    global $config;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var("id"));
    /* ==================================================== */
    /* modify for multi user start */
    if (!check_host($_GET["id"])) {
        access_denied();
    }
    /* modify for multi user end */
    if (read_config_option("deletion_verification") == "on" && !isset($_GET["confirm"])) {
        include "./include/top_header.php";
        form_confirm("Are You Sure?", "Are you sure you want to delete the host <strong>'" . htmlspecialchars(db_fetch_cell("select description from host where id=" . $_GET["id"])) . "'</strong>?", htmlspecialchars("host.php"), htmlspecialchars("host.php?action=remove&id=" . $_GET["id"]));
        include "./include/bottom_footer.php";
        exit;
    }
    if (read_config_option("deletion_verification") == "" || isset($_GET["confirm"])) {
        api_device_remove($_GET["id"]);
    }
}
예제 #7
0
파일: devices.php 프로젝트: songchin/Cacti
function host_remove()
{
    if (read_config_option("remove_verification") == "on" && !isset($_GET["confirm"])) {
        require_once CACTI_BASE_PATH . "/include/top_header.php";
        form_confirm(_("Are You Sure?"), _("Are you sure you want to delete the host <strong>'") . db_fetch_cell("select description from host where id=" . $_GET["id"]) . "'</strong>?", "devices.php", "devices.php?action=remove&id=" . $_GET["id"]);
        require_once CACTI_BASE_PATH . "/include/bottom_footer.php";
        exit;
    }
    if (read_config_option("remove_verification") == "" || isset($_GET["confirm"])) {
        api_device_remove($_GET["id"]);
    }
}
예제 #8
0
function device_remove() {
	global $config;

	/* ================= input validation ================= */
	input_validate_input_number(get_request_var("id"));
	/* ==================================================== */

	if ((read_config_option("deletion_verification") == CHECKED) && (!isset($_GET["confirm"]))) {
		include(CACTI_BASE_PATH . "/include/top_header.php");
		form_confirm(__("Are You Sure?"), __("Are you sure you want to delete the device") . " <strong>'" . db_fetch_cell("select description from device where id=" . $_GET["id"]) . "'</strong>?", "devices.php", "devices.php?action=remove&id=" . $_GET["id"]);
		include(CACTI_BASE_PATH . "/include/bottom_footer.php");
		exit;
	}

	if ((read_config_option("deletion_verification") == "") || (isset($_GET["confirm"]))) {
		api_device_remove(get_request_var("id"));
	}
}