/** * 删除 */ function delete($id) { parent::check_privilege(''); if ($id) { //检查该数据是否是回收站数据 $this->webserver->delete($id); redirect(site_url('webserver/index')); } }
/** * 保存选项 */ public function save() { parent::check_privilege(); if (isset($_POST['submit']) && $_POST['submit'] == 'save') { $post = $_POST; foreach ($post as $key => $val) { $data['value'] = $val; $this->settings->update($data, $key); } redirect(site_url('settings/index/save')); } }
public function bigtable_chart() { parent::check_privilege(); $server_id = $this->uri->segment(3); $server_id = !empty($server_id) ? $server_id : "0"; $table_name = $this->uri->segment(4); $table_name = !empty($table_name) ? $table_name : ""; //表增长趋势图表 $chart_reslut = array(); for ($i = 0; $i < 30; $i++) { $timestamp = time() - 3600 * 24 * 30 + 3600 * 24 * $i; $time = date('Ymd', $timestamp); //echo $time.'<br/>'; $chart_reslut[$i]['time'] = date('Y-m-d', $timestamp); $dbdata = $this->mysql->get_bigtable_chart_record($server_id, $table_name, $time); $chart_reslut[$i]['table_size'] = !empty($dbdata['table_size']) ? $dbdata['table_size'] : '0'; } $data['chart_reslut'] = $chart_reslut; //print_r($chart_reslut); $data['cur_server_id'] = $server_id; $data['cur_table_name'] = $table_name; $data["cur_server"] = $this->server->get_servers($server_id); $this->layout->view('mysql/bigtable_chart', $data); }
/** * 彻底删除 */ function forever_delete($id) { parent::check_privilege(); if ($id) { $this->user->delete($id); redirect(site_url('user/index')); } }
public function chart() { parent::check_privilege(''); $server_id = $this->uri->segment(3); $server_id = !empty($server_id) ? $server_id : "0"; $begin_time = $this->uri->segment(4); $begin_time = !empty($begin_time) ? $begin_time : "30"; $time_span = $this->uri->segment(5); $time_span = !empty($time_span) ? $time_span : "min"; //饼状图表 $data = array(); //线性图表 $chart_reslut = array(); for ($i = $begin_time; $i >= 0; $i--) { $timestamp = time() - 60 * $i; $time = date('YmdHi', $timestamp); $has_record = $this->oracle->check_has_record($server_id, $time); if ($has_record) { $chart_reslut[$i]['time'] = date('Y-m-d H:i', $timestamp); $dbdata = $this->oracle->get_status_chart_record($server_id, $time); $chart_reslut[$i]['session_total'] = $dbdata['session_total']; $chart_reslut[$i]['session_actives'] = $dbdata['session_actives']; $chart_reslut[$i]['session_waits'] = $dbdata['session_waits']; $chart_reslut[$i]['processes'] = $dbdata['processes']; $chart_reslut[$i]['session_logical_reads_persecond'] = $dbdata['session_logical_reads_persecond']; $chart_reslut[$i]['physical_reads_persecond'] = $dbdata['physical_reads_persecond']; $chart_reslut[$i]['physical_writes_persecond'] = $dbdata['physical_writes_persecond']; $chart_reslut[$i]['physical_read_io_requests_persecond'] = $dbdata['physical_read_io_requests_persecond']; $chart_reslut[$i]['physical_write_io_requests_persecond'] = $dbdata['physical_write_io_requests_persecond']; $chart_reslut[$i]['db_block_changes_persecond'] = $dbdata['db_block_changes_persecond']; $chart_reslut[$i]['os_cpu_wait_time'] = $dbdata['os_cpu_wait_time']; $chart_reslut[$i]['logons_persecond'] = $dbdata['logons_persecond']; $chart_reslut[$i]['logons_current'] = $dbdata['logons_current']; $chart_reslut[$i]['opened_cursors_persecond'] = $dbdata['opened_cursors_persecond']; $chart_reslut[$i]['opened_cursors_current'] = $dbdata['opened_cursors_current']; $chart_reslut[$i]['user_commits_persecond'] = $dbdata['user_commits_persecond']; $chart_reslut[$i]['user_rollbacks_persecond'] = $dbdata['user_rollbacks_persecond']; $chart_reslut[$i]['user_calls_persecond'] = $dbdata['user_calls_persecond']; } } $data['chart_reslut'] = $chart_reslut; //print_r($chart_reslut); $chart_option = array(); if ($time_span == 'min') { $chart_option['formatString'] = '%H:%M'; } else { if ($time_span == 'hour') { $chart_option['formatString'] = '%H:%M'; } else { if ($time_span == 'day') { $chart_option['formatString'] = '%m/%d %H:%M'; } } } $data['chart_option'] = $chart_option; $data['begin_time'] = $begin_time; $data['cur_nav'] = 'chart_index'; $data["server"] = $servers = $this->server->get_total_record_usage(); $data['cur_server_id'] = $server_id; $data["cur_server"] = $this->server->get_servers($server_id); $this->layout->view('oracle/chart', $data); }
public function memory_chart() { parent::check_privilege(); $server_id = $this->uri->segment(3); $server_id = !empty($server_id) ? $server_id : "0"; $begin_time = $this->uri->segment(4); $begin_time = !empty($begin_time) ? $begin_time : "60"; $time_span = $this->uri->segment(5); $time_span = !empty($time_span) ? $time_span : "hour"; //图表 $chart_reslut = array(); for ($i = $begin_time; $i >= 0; $i--) { $timestamp = time() - 60 * $i; $time = date('YmdHi', $timestamp); $has_record = $this->mongodb->check_has_record($server_id, $time); if ($has_record) { $chart_reslut[$i]['time'] = date('Y-m-d H:i', $timestamp); $dbdata = $this->mongodb->get_status_chart_record($server_id, $time); $chart_reslut[$i]['mem_resident'] = $dbdata['mem_resident']; $chart_reslut[$i]['mem_virtual'] = $dbdata['mem_virtual']; $chart_reslut[$i]['mem_mapped'] = $dbdata['mem_mapped']; $chart_reslut[$i]['mem_mappedWithJournal'] = $dbdata['mem_mappedWithJournal']; } } $data['chart_reslut'] = $chart_reslut; $chart_option = array(); if ($time_span == 'hour') { $chart_option['formatString'] = '%H:%M'; } else { if ($time_span == 'day') { $chart_option['formatString'] = '%m/%d %H:%M'; } } $data['chart_option'] = $chart_option; $data['begin_time'] = $begin_time; $data['cur_server_id'] = $server_id; $data["cur_server"] = $this->server->get_servers($server_id); $this->layout->view('mongodb/memory_chart', $data); }
public function replication() { parent::check_privilege(); $datalist = $this->redis->get_replication_total_record(); if (empty($_GET["search"])) { $datalist = get_redis_replication_tree($datalist); } $setval["role"] = isset($_GET["role"]) ? $_GET["role"] : ""; $setval["order"] = isset($_GET["order"]) ? $_GET["order"] : ""; $setval["order_type"] = isset($_GET["order_type"]) ? $_GET["order_type"] : ""; $data["setval"] = $setval; $data['datalist'] = $datalist; $this->layout->view("redis/replication", $data); }
/** * 批量添加 */ function batch_add() { parent::check_privilege(); /* * 提交批量添加后处理 */ $data['error_code'] = 0; if (isset($_POST['submit']) && $_POST['submit'] == 'batch_add') { for ($n = 1; $n <= 10; $n++) { $host = $this->input->post('host_' . $n); $port = $this->input->post('port_' . $n); $password = $this->input->post('password_' . $n); $tags = $this->input->post('tags_' . $n); if (!empty($host) && !empty($port) && !empty($tags)) { $data['error_code'] = 0; $data = array('host' => $host, 'port' => $port, 'password' => $password, 'tags' => $tags, 'monitor' => $this->input->post('monitor_' . $n), 'send_mail' => $this->input->post('send_mail_' . $n), 'send_sms' => $this->input->post('send_sms_' . $n), 'alarm_connected_clients' => $this->input->post('alarm_connected_clients_' . $n), 'alarm_command_processed' => $this->input->post('alarm_command_processed_' . $n), 'alarm_blocked_clients' => $this->input->post('alarm_blocked_clients_' . $n)); $this->servers->insert($data); } } redirect(site_url('servers_redis/index')); } $this->layout->view("servers_redis/batch_add", $data); }
/** * 批量添加 */ function batch_add() { parent::check_privilege(); /* * 提交批量添加后处理 */ $data['error_code'] = 0; if (isset($_POST['submit']) && $_POST['submit'] == 'batch_add') { for ($n = 1; $n <= 10; $n++) { $host = $this->input->post('host_' . $n); $port = $this->input->post('port_' . $n); $username = $this->input->post('username_' . $n); $password = $this->input->post('password_' . $n); $tags = $this->input->post('tags_' . $n); $dsn = $this->input->post('dsn_' . $n); if (!empty($host) && !empty($port) && !empty($username) && !empty($password) && !empty($dsn) && !empty($tags)) { $data['error_code'] = 0; $data = array('host' => $host, 'port' => $port, 'username' => $username, 'password' => $password, 'tags' => $tags, 'dsn' => $dsn, 'monitor' => $this->input->post('monitor_' . $n), 'send_mail' => $this->input->post('send_mail_' . $n), 'send_sms' => $this->input->post('send_sms_' . $n), 'alarm_session_total' => $this->input->post('alarm_session_total_' . $n), 'alarm_session_actives' => $this->input->post('alarm_session_actives_' . $n), 'alarm_session_waits' => $this->input->post('alarm_session_waits_' . $n), 'alarm_tablespace' => $this->input->post('alarm_tablespace_' . $n)); $this->servers->insert($data); } } redirect(site_url('servers_oracle/index')); } $this->layout->view("servers_oracle/batch_add", $data); }
/** * 彻底删除 */ function forever_delete($id) { parent::check_privilege('application/trash'); if ($id) { //检查该数据是否是回收站数据 $record = $this->app->get_record_by_id($id); $is_delete = $record['is_delete']; if ($is_delete == 1) { $this->app->delete($id); } redirect(site_url('application/trash')); } }
/** * 彻底删除 */ function forever_delete($id) { parent::check_privilege(); if ($id) { //检查该数据是否是回收站数据 $record = $this->machine_room->get_record_by_id($id); if ($record) { $this->machine_room->delete($id); } redirect(site_url('machine_room/index')); } }
public function chart() { parent::check_privilege(); $host = $this->uri->segment(3); $host = !empty($host) ? $host : ""; $begin_time = $this->uri->segment(4); $begin_time = !empty($begin_time) ? $begin_time : "30"; $time_span = $this->uri->segment(5); $time_span = !empty($time_span) ? $time_span : "min"; //连接数图表 $chart_reslut = array(); for ($i = $begin_time; $i >= 0; $i--) { $timestamp = time() - 60 * $i; $time = date('YmdHi', $timestamp); $has_record = $this->os->check_has_record($host, $time); if ($has_record) { $chart_reslut[$i]['time'] = date('Y-m-d H:i', $timestamp); $dbdata = $this->os->get_os_chart_record($host, $time); $chart_reslut[$i]['process'] = $dbdata['process']; $chart_reslut[$i]['load_1'] = $dbdata['load_1']; $chart_reslut[$i]['load_5'] = $dbdata['load_5']; $chart_reslut[$i]['load_15'] = $dbdata['load_15']; $chart_reslut[$i]['cpu_user_time'] = $dbdata['cpu_user_time']; $chart_reslut[$i]['cpu_system_time'] = $dbdata['cpu_system_time']; $chart_reslut[$i]['cpu_idle_time'] = $dbdata['cpu_idle_time']; $chart_reslut[$i]['mem_usage_rate'] = $dbdata['mem_usage_rate']; $chart_reslut[$i]['disk_io_reads_total'] = $dbdata['disk_io_reads_total']; $chart_reslut[$i]['disk_io_writes_total'] = $dbdata['disk_io_writes_total']; $chart_reslut[$i]['net_in_bytes_total'] = $dbdata['net_in_bytes_total']; $chart_reslut[$i]['net_out_bytes_total'] = $dbdata['net_out_bytes_total']; } } $data['chart_reslut'] = $chart_reslut; $chart_option = array(); if ($time_span == 'min') { $chart_option['formatString'] = '%H:%M'; } else { if ($time_span == 'hour') { $chart_option['formatString'] = '%H:%M'; } else { if ($time_span == 'day') { $chart_option['formatString'] = '%m/%d %H:%M'; } } } $data['chart_option'] = $chart_option; $data['begin_time'] = $begin_time; $data['cur_host'] = $host; $data['last_record'] = $this->os->get_last_record($host); $data['diskinfo'] = $this->os->get_disk_record($host); $this->layout->view('os/chart', $data); }
/** * 更新角色授权 */ public function update_user_role() { parent::check_privilege(); $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : ''; $role_ids = !empty($_POST['role_id']) ? $_POST['role_id'] : ''; /* * 提交后处理 */ $data['error_code'] = ''; if (isset($_POST['submit']) && $_POST['submit'] == 'auth_user_role') { $result = $this->auth->update_user_role($user_id, $role_ids); if ($result === true) { redirect(site_url('/auth/index/user_id/' . $user_id . '/0')); } else { redirect(site_url('/auth/index/user_id/' . $user_id . '/1')); } } }
/** * 批量添加 */ function batch_add() { parent::check_privilege(); /* * 提交批量添加后处理 */ $data['error_code'] = 0; if (isset($_POST['submit']) && $_POST['submit'] == 'batch_add') { for ($n = 1; $n <= 10; $n++) { $host = $this->input->post('host_' . $n); $port = $this->input->post('port_' . $n); $username = $this->input->post('username_' . $n); $password = $this->input->post('password_' . $n); $tags = $this->input->post('tags_' . $n); if (!empty($host) && !empty($port) && !empty($username) && !empty($password) && !empty($tags)) { $data['error_code'] = 0; $data = array('host' => $host, 'port' => $port, 'username' => $username, 'password' => $password, 'tags' => $tags, 'monitor' => $this->input->post('monitor_' . $n), 'send_mail' => $this->input->post('send_mail_' . $n), 'send_sms' => $this->input->post('send_sms_' . $n), 'alarm_threads_connected' => $this->input->post('alarm_threads_connected_' . $n), 'alarm_threads_running' => $this->input->post('alarm_threads_running_' . $n), 'alarm_threads_waits' => $this->input->post('alarm_threads_waits_' . $n), 'alarm_repl_status' => $this->input->post('alarm_repl_status_' . $n), 'alarm_repl_delay' => $this->input->post('alarm_repl_delay_' . $n)); $this->servers->insert($data); } } redirect(site_url('servers_mysql/index')); } $this->layout->view("servers_mysql/batch_add", $data); }
/** * 批量添加 */ function batch_add() { parent::check_privilege(); /* * 提交批量添加后处理 */ $data['error_code'] = 0; if (isset($_POST['submit']) && $_POST['submit'] == 'batch_add') { for ($n = 1; $n <= 10; $n++) { $host = $this->input->post('host_' . $n); $community = $this->input->post('community_' . $n); $tags = $this->input->post('tags_' . $n); if (!empty($host) && !empty($community) && !empty($tags)) { $data['error_code'] = 0; $data = array('host' => $this->input->post('host'), 'community' => $this->input->post('community'), 'tags' => $this->input->post('tags'), 'monitor' => $this->input->post('monitor'), 'send_mail' => $this->input->post('send_mail'), 'send_sms' => $this->input->post('send_sms'), 'send_mail_to_list' => $this->input->post('send_mail_to_list'), 'send_sms_to_list' => $this->input->post('send_sms_to_list'), 'alarm_os_process' => $this->input->post('alarm_os_process'), 'alarm_os_load' => $this->input->post('alarm_os_load'), 'alarm_os_cpu' => $this->input->post('alarm_os_cpu'), 'alarm_os_network' => $this->input->post('alarm_os_network'), 'alarm_os_disk' => $this->input->post('alarm_os_disk'), 'alarm_os_memory' => $this->input->post('alarm_os_memory')); $this->servers->insert($data); } } redirect(site_url('servers_os/index')); } $this->layout->view("servers_os/batch_add", $data); }