diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 6a37a9c9b1..d83e211a82 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -138,6 +138,7 @@ function execution_time(){ return "Normal Status   The execution time is correct. For a more extensive information of this data consult the Execution Time graph"; } + function get_logs_size($file){ $file_name = '/var'. $file .''; $size_server_log = filesize($file_name); @@ -149,9 +150,9 @@ function get_status_logs($path){ $status_server_log = ""; $size_server_log = get_logs_size($path); if ($size_server_log <= 10240){ - $status_server_log = "Normal Status   You have less than 10 MB of logs"; + $status_server_log = "Normal Status   You have less than 10 MB of logs"; }else{ - $status_server_log = "Warning Status   You have more than 10 MB of logs"; + $status_server_log = "Warning Status   You have more than 10 MB of logs"; } return $status_server_log; } @@ -161,9 +162,9 @@ function percentage_modules_per_agent(){ $total_modules = db_get_value_sql ('SELECT count(*) FROM tagente_modulo'); $average_modules_per_agent = $total_modules / $total_agents; if($average_modules_per_agent <= 40){ - $status_average_modules = "Normal Status   The average of modules per agent is less than 40 percent"; + $status_average_modules = "Normal Status   The average of modules per agent is less than 40 percent"; }else{ - $status_average_modules = "Warning Status  The average of modules per agent is more than 40 percent. You can have performance problems"; + $status_average_modules = "Warning Status  The average of modules per agent is more than 40 percent. You can have performance problems"; } return $status_average_modules; } @@ -174,9 +175,9 @@ function license_capacity(){ $status_license_capacity = ""; $current_count = db_get_value_sql ('SELECT count(*) FROM tagente'); if ($current_count > $license_limit * 90 /100){ - $status_license_capacity = "Warning Status   The license capacity is more than 90 percent"; + $status_license_capacity = "Warning Status   The license capacity is more than 90 percent"; }else{ - $status_license_capacity = "Normal Status   The license capacity is less than 90 percent"; + $status_license_capacity = "Normal Status   The license capacity is less than 90 percent"; } return $status_license_capacity; } @@ -195,12 +196,12 @@ function interval_average_of_network_modules(){ $average_time= (int) $total_module_interval_time / $total_network_modules; if($average_time < 180 ){ - $status_average_modules = "Warning Status   The system has a lot of load and a very fine configuration is required"; + $status_average_modules = "Warning Status   The system has a lot of load and a very fine configuration is required"; }else{ - $status_average_modules = "Normal Status   The system has an acceptable charge"; + $status_average_modules = "Normal Status   The system has an acceptable charge"; } if ($average_time == 0) - $status_average_modules = "Normal Status   The system has no load"; + $status_average_modules = "Normal Status   The system has no load"; return $status_average_modules; } @@ -208,9 +209,9 @@ $attachment_total_files = count(glob($config['homedir']."/attachment/{*.*}",GLOB function files_attachment_folder($total_files){ if($total_files <= 700){ - $status_total_files = "Normal Status   The attachment folder has less than 700 files."; + $status_total_files = "Normal Status   The attachment folder has less than 700 files."; }else{ - $status_total_files = "Warning Status   The attachment folder has more than 700 files."; + $status_total_files = "Warning Status   The attachment folder has more than 700 files."; } return $status_total_files; } @@ -218,14 +219,21 @@ function files_attachment_folder($total_files){ $tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos'); function status_tagente_datos($tagente_datos_size){ - if ($tagente_datos_size <=3000){ - $tagente_datos_size = "Normal Status   The tagente_datos table has less than 3000 data."; + if ($tagente_datos_size <=3000000){ + $tagente_datos_size = "Normal Status   The tagente_datos table has an acceptable amount of data."; }else{ - $tagente_datos_size = "Warning Status   The tagente_datos table has more than 3000 data. A historical database is recommended."; + $tagente_datos_size = "Warning Status   The tagente_datos table has too much data. A historical database is recommended."; } return $tagente_datos_size; } +function status_values($val_rec, $val){ + if ($val_rec <= $val) + return $val . " (current value) Normal Status"; + else + return $val . " (current value) Warning Status"; +} + $tables_fragmentation=db_get_sql ("SELECT (data_free/(index_length+data_length)) as frag_ratio from information_schema.tables where DATA_FREE > 0 and table_name='tagente_datos' and table_schema='pandora'"); $db_size=db_get_all_rows_sql("SELECT table_schema, @@ -245,28 +253,30 @@ $path_console_logs ="/www/html/pandora_console/pandora_console.log"; $innodb_log_file_size_min_rec_value = "64M"; $innodb_log_buffer_size_min_rec_value = "16M"; $innodb_flush_log_at_trx_commit_min_rec_value = 0; -$query_cache_limit_min_rec_value = "2M"; -$max_allowed_packet_min_rec_value = "32M"; -$sort_buffer_size_min_rec_value = "32K"; -$join_buffer_size_min_rec_value = "265K"; +$query_cache_limit_min_rec_value = 2; +$max_allowed_packet_min_rec_value = 32; +$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'"); +$sort_buffer_size_min_rec_value = 32; +$join_buffer_size_min_rec_value = 265; $query_cache_type_min_rec_value = "ON"; -$query_cache_size_min_rec_value = "24M"; -$innodb_lock_wait_timeout_max_rec_value = "120 seconds"; +$query_cache_size_min_rec_value = 24; +$innodb_lock_wait_timeout_max_rec_value = 120; $tables_fragmentation_max_rec_value = 10; -$thread_cache_size_max_rec_value = "8M"; -$thread_stack_min_rec_value = "256K"; -$max_connections_max_rec_value = "150"; -$key_buffer_size_min_rec_value = "256K"; -$read_buffer_size_min_rec_value = "32K"; -$read_rnd_buffer_size_min_rec_value = "32K"; -$query_cache_min_res_unit_min_rec_value = "2K"; +$thread_cache_size_max_rec_value = 8; +$thread_stack_min_rec_value = 256; +$max_connections_max_rec_value = 150; +$key_buffer_size_min_rec_value = 256; +$read_buffer_size_min_rec_value = 32; +$read_rnd_buffer_size_min_rec_value = 32; +$query_cache_min_res_unit_min_rec_value = 2; +$innodb_file_per_table_min_rec_value = 0; function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation){ $status_tables_frag = ""; if($tables_fragmentation > $tables_fragmentation_max_rec_value) - $status_tables_frag = "Warning Status   The fragmentation tables is higher than recommended. You should defragment them."; + $status_tables_frag = "Warning Status   The fragmentation tables is higher than recommended. You should defragment them."; else - $status_tables_frag = "Normal Status   The fragmentation tables is correct."; + $status_tables_frag = "Normal Status   The fragmentation tables is correct."; return $status_tables_frag; } @@ -536,29 +546,46 @@ switch ($config["dbtype"]) { WHERE \"key\" = 'current_update'", "Current Update #"); break; } - +$innodb_log_file_size =db_get_value_sql ("SELECT @@innodb_log_file_size")/1048576; +$innodb_log_buffer_size =db_get_value_sql("SELECT @@innodb_log_buffer_size")/1048576; +$innodb_flush_log_at_trx_commit =db_get_value_sql("SELECT @@innodb_flush_log_at_trx_commit"); +$max_allowed_packet =db_get_value_sql("SELECT @@max_allowed_packet")/1048576; +$innodb_buffer_pool_size = db_get_value_sql("SELECT @@innodb_buffer_pool_size")/1024; +$sort_buffer_size =number_format(db_get_value_sql("SELECT @@sort_buffer_size")/1024, 2); +$join_buffer_size =db_get_value_sql("SELECT @@join_buffer_size")/1024; +$query_cache_type =db_get_value_sql("SELECT @@query_cache_type"); +$query_cache_size =db_get_value_sql("SELECT @@query_cache_size")/1048576; +$query_cache_limit =db_get_value_sql("SELECT @@query_cache_limit")/1048576; +$innodb_lock_wait_timeout =db_get_value_sql("SELECT @@innodb_lock_wait_timeout"); +$thread_cache_size =db_get_value_sql("SELECT @@thread_cache_size"); +$thread_stack =db_get_value_sql("SELECT @@thread_stack")/1024; +$max_connections =db_get_value_sql("SELECT @@max_connections"); +$key_buffer_size =db_get_value_sql("SELECT @@key_buffer_size")/1024; +$read_buffer_size =db_get_value_sql("SELECT @@read_buffer_size")/1024; +$read_rnd_buffer_size =db_get_value_sql("SELECT @@read_rnd_buffer_size")/1024; +$query_cache_min_res_unit =db_get_value_sql("SELECT @@query_cache_min_res_unit")/1024; +$innodb_file_per_table = db_get_value_sql("SELECT @@innodb_file_per_table"); echo "