Пример #1
0
    }
} else {
    $obj_id = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo '<div class="container">' . K_NEWLINE;
echo '<div class="tceformbox">' . K_NEWLINE;
echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_editor">' . K_NEWLINE;
echo F_select_datacenter($dcn_id);
echo F_select_suite($dcn_id, $sts_id, $suite_data);
echo F_select_rack($dcn_id, $sts_id, $rck_id, $rack_data, $rack_pos, $rack_name);
echo F_select_object($dcn_id, $sts_id, $rck_id, $obj_id);
echo '<div class="row" style="margin-bottom:10px;"><hr /></div>' . K_NEWLINE;
// *** GET OBJECT DATA
if ($obj_id > 0) {
    $object_data = F_get_object_data($obj_id, $ilo, $capacity);
    // *** ILO STATUS AND BUTTONS
    if (isset($ilo['ip']) and isset($ilo['user']) and isset($ilo['password'])) {
        $ilo_data = '';
        // send one ping with the deadline, and if it succeeds continue with ipmitool
        $base_ilo_command = 'ping -c 1 -w 2 ' . escapeshellarg($ilo['ip']) . ' >/dev/null 2>&1';
        $base_ilo_command .= ' && ipmitool -I lanplus -H ' . escapeshellarg($ilo['ip']) . ' -U ' . escapeshellarg($ilo['user']) . ' -P ' . escapeshellarg($ilo['password']);
        // execute ILO command
        if (isset($_REQUEST['ilo_identify'])) {
            exec($base_ilo_command . ' chassis identify 30');
        }
        if ($userlevel >= K_AUTH_ILO and isset($_REQUEST['confirmupdate']) and $_REQUEST['confirmupdate'] == 1) {
            if (isset($_REQUEST['ilo_shutdown'])) {
                exec($base_ilo_command . ' chassis power soft');
            } elseif (isset($_REQUEST['ilo_power_off'])) {
                exec($base_ilo_command . ' chassis power off');
Пример #2
0
/**
 * Returns object ILO data (if available).
 * @param $obj_id (int) Object ID.
 * @return array with ILO information (IP, user, password)
 */
function F_get_object_ilo_info($obj_id)
{
    global $l, $db;
    require_once '../config/tce_config.php';
    if (empty($obj_id)) {
        return false;
    }
    F_get_object_data($obj_id, $ilo);
    if (isset($ilo['ip']) and isset($ilo['user']) and isset($ilo['password'])) {
        return $ilo;
    }
    return array();
}