Exemplo n.º 1
0
function thold_device_action_execute($action)
{
    global $config;
    if ($action != 'thold') {
        return $action;
    }
    include_once $config['base_path'] . '/plugins/thold/thold_functions.php';
    $selected_items = unserialize(stripslashes($_POST['selected_items']));
    for ($i = 0; $i < count($selected_items); $i++) {
        input_validate_input_number($selected_items[$i]);
        autocreate($selected_items[$i]);
    }
    return $action;
}
Exemplo n.º 2
0
    $_SESSION["graph_return"] = $_SERVER["HTTP_REFERER"];
}
switch ($_REQUEST['action']) {
    case 'save':
        save_thold();
        if (isset($_SESSION["graph_return"])) {
            $return_to = $_SESSION["graph_return"];
            unset($_SESSION["graph_return"]);
            kill_session_var("graph_return");
            header('Location: ' . $return_to);
        } else {
            include_once $config['include_path'] . '/top_header.php';
        }
        break;
    case 'autocreate':
        $c = autocreate($hostid);
        if ($c == 0) {
            $_SESSION['thold_message'] = '<font size=-1>Either No Templates or Threshold(s) Already Exists - No thresholds were created.</font>';
        }
        raise_message('thold_created');
        if (isset($_SESSION["graph_return"])) {
            $return_to = $_SESSION["graph_return"];
            unset($_SESSION["graph_return"]);
            kill_session_var("graph_return");
            header('Location: ' . $return_to);
        } else {
            header('Location: ../../graphs_new.php?host_id=' . $hostid);
        }
        exit;
        break;
    case 'disable':
Exemplo n.º 3
0
function thold_cli_autocreate_host($id)
{
    $id = intval($id);
    if ($id < 1) {
        return;
    }
    echo "Auto Creating Thresholds for Device #{$id}\n";
    autocreate($id);
    if (isset($_SESSION['thold_message'])) {
        echo strip_tags(str_replace(array('<br>', 'Created threshold'), array("\n", '     Created threshold'), $_SESSION['thold_message']));
    }
}
Exemplo n.º 4
0
     break;
 case 'save':
     $id = save_thold();
     if (isset($_SESSION['data_return'])) {
         $return_to = $_SESSION['data_return'];
         unset($_SESSION['data_return']);
         kill_session_var('data_return');
         header('Location: ' . $return_to);
     } elseif ($id) {
         header('Location: thold.php?action=edit&header=false&id=' . $id);
     } else {
         header('Location: thold.php');
     }
     break;
 case 'autocreate':
     $c = autocreate(get_filter_request_var('host_id'));
     if ($c == 0) {
         $_SESSION['thold_message'] = '<font size=-1>' . __('Either No Templates or Threshold(s) Already Exists - No thresholds were created.') . '</font>';
     }
     raise_message('thold_message');
     if (isset($_SESSION['data_return'])) {
         $return_to = $_SESSION['data_return'];
         unset($_SESSION['data_return']);
         kill_session_var('data_return');
         header('Location: ' . $return_to);
     } else {
         header('Location: ' . $config['url_path'] . 'graphs_new.php?header=false&host_id=' . get_request_var('host_id'));
     }
     break;
 case 'disable':
     thold_threshold_disable(get_filter_request_var('id'));
Exemplo n.º 5
0
function thold_api_device_new($save)
{
    global $config;
    include_once $config['base_path'] . '/plugins/thold/thold_functions.php';
    if (read_config_option('thold_autocreate') == 'on') {
        if (!empty($save['id'])) {
            autocreate($save['id']);
        }
    }
    return $save;
}