Reupload the manuel.montes changes

This commit is contained in:
fermin831 2018-08-13 12:52:01 +02:00
parent 837df1f196
commit 962e793c1b
1 changed files with 78 additions and 51 deletions

View File

@ -138,6 +138,7 @@ function execution_time(){
return "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The execution time is correct. For a more extensive information of this data consult the Execution Time graph</a>";
}
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 = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp You have less than 10 MB of logs</a>";
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have less than 10 MB of logs</a>";
}else{
$status_server_log = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp You have more than 10 MB of logs</a>";
$status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have more than 10 MB of logs</a>";
}
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 = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The average of modules per agent is less than 40 percent</a>";
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The average of modules per agent is less than 40 percent</a>";
}else{
$status_average_modules = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbspThe average of modules per agent is more than 40 percent. You can have performance problems</a>";
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbspThe average of modules per agent is more than 40 percent. You can have performance problems</a>";
}
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 = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp The license capacity is more than 90 percent</a>";
$status_license_capacity = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The license capacity is more than 90 percent</a>";
}else{
$status_license_capacity = "<a class= 'content' style= 'color: green;'>Normal Status</a><a>&nbsp&nbsp The license capacity is less than 90 percent</a>";
$status_license_capacity = "<a style= 'color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The license capacity is less than 90 percent</a>";
}
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 = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp The system has a lot of load and a very fine configuration is required</a>";
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has a lot of load and a very fine configuration is required</a>";
}else{
$status_average_modules = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The system has an acceptable charge</a>";
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has an acceptable charge</a>";
}
if ($average_time == 0)
$status_average_modules = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The system has no load</a>";
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has no load</a>";
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 = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The attachment folder has less than 700 files.</a>";
$status_total_files = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The attachment folder has less than 700 files.</a>";
}else{
$status_total_files = "<a class= 'content' style= 'color: red;'>Warning Status</a><a>&nbsp&nbsp The attachment folder has more than 700 files.</a>";
$status_total_files = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The attachment folder has more than 700 files.</a>";
}
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 = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The tagente_datos table has less than 3000 data.</a>";
if ($tagente_datos_size <=3000000){
$tagente_datos_size = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The tagente_datos table has an acceptable amount of data.</a>";
}else{
$tagente_datos_size = "<a class= 'content' style ='color: red;'>Warning Status</a><a>&nbsp&nbsp The tagente_datos table has more than 3000 data. A historical database is recommended.</a>";
$tagente_datos_size = "<a class= 'content' style ='color: red;text-decoration: none;'>Warning Status</a><a>&nbsp&nbsp The tagente_datos table has too much data. A historical database is recommended.</a>";
}
return $tagente_datos_size;
}
function status_values($val_rec, $val){
if ($val_rec <= $val)
return $val . "<a> (current value)</a><a style ='color: green;text-decoration: none;'> Normal Status</a>";
else
return $val . "<a> (current value)</a><a class= 'content' style ='color: red;text-decoration: none;'> Warning Status</a>";
}
$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 = "<a class= 'content' style ='color: red;'>Warning Status</a><a>&nbsp&nbsp The fragmentation tables is higher than recommended. You should defragment them.</a>";
$status_tables_frag = "<a class= 'content' style ='color: red; text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The fragmentation tables is higher than recommended. You should defragment them.</a>";
else
$status_tables_frag = "<a class= 'content' style ='color: green;'>Normal Status</a><a>&nbsp&nbsp The fragmentation tables is correct.</a>";
$status_tables_frag = "<a style ='color: green; text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The fragmentation tables is correct.</a>";
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 "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("MySQL Performance metrics")."</th></tr>";
render_row_2($innodb_log_file_size_min_rec_value,'InnoDB log file size (minimum recommended value)',db_get_value_sql ("SELECT @@innodb_log_file_size")/1048576 . 'M', 'InnoDB log file size (current value)');
render_row_2($innodb_log_buffer_size_min_rec_value,'InnoDB log buffer size (minimum recommended value)',db_get_value_sql("SELECT @@innodb_log_buffer_size")/1048576 . 'M', 'InnoDB log buffer size (current value)');
render_row_2($innodb_flush_log_at_trx_commit_min_rec_value,'InnoDB flush log at trx-commit (minimum recommended value)',db_get_value_sql("SELECT @@innodb_flush_log_at_trx_commit"), 'InnoDB flush log at trx-commit (current value)');
render_row_2($max_allowed_packet_min_rec_value,'Maximun allowed packet',db_get_value_sql("SELECT @@max_allowed_packet")/1048576 . 'M', 'Maximun allowed packet (current value)');
render_row_2($innodb_buffer_pool_size_min_rec_value . 'M','InnoDB buffer pool size (minimum recommended value)',db_get_value_sql("SELECT @@innodb_buffer_pool_size")/1024 . 'M', 'InnoDB buffer pool size (current value)');
render_row_2($sort_buffer_size_min_rec_value,'Sort buffer size (minimum recommended value)',number_format(db_get_value_sql("SELECT @@sort_buffer_size")/1024, 2) . 'K', 'Sort buffer size (current value)');
render_row_2($join_buffer_size_min_rec_value,'Join buffer size (minimum recommended value)',db_get_value_sql("SELECT @@join_buffer_size")/1024 . 'K', 'Join buffer size (current value)');
render_row_2($query_cache_type_min_rec_value,'Query cache type (recommended value)',db_get_value_sql("SELECT @@query_cache_type"), 'Query cache type (current value)');
render_row_2($query_cache_size_min_rec_value,'Query cache size (minimum recommended value)',db_get_value_sql("SELECT @@query_cache_size")/1048576 . 'M', 'Query cache size (current value)');
render_row_2($query_cache_limit_min_rec_value,'Query cache limit (minimum recommended value)',db_get_value_sql("SELECT @@query_cache_limit")/1048576 . 'M', 'Query cache limit (current value)');
render_row_2($innodb_lock_wait_timeout_max_rec_value ,'InnoDB lock wait timeout (maximum recommended value)',db_get_value_sql("SELECT @@innodb_lock_wait_timeout") . ' seconds', 'InnoDB lock wait timeout (current value)');
render_row_2($thread_cache_size_max_rec_value ,'Thread cache size (maximum recommended value)',db_get_value_sql("SELECT @@thread_cache_size") . 'M', 'Thread cache size (current value)');
render_row_2($thread_stack_min_rec_value ,'Thread stack (minimum recommended value)',db_get_value_sql("SELECT @@thread_stack")/1024 . 'K', 'Thread stack (current value)');
render_row_2($max_connections_max_rec_value ,'Maximun connections (maximum recommended value)',db_get_value_sql("SELECT @@max_connections"), 'Maximum connections (current value)');
render_row_2($key_buffer_size_min_rec_value ,'Key buffer size (minimum recommended value)',db_get_value_sql("SELECT @@key_buffer_size")/1024 . 'K', 'Key buffer size (current value)');
render_row_2($read_buffer_size_min_rec_value ,'Read buffer size (minimum recommended value)',db_get_value_sql("SELECT @@read_buffer_size")/1024 . 'K', 'Read buffer size (current value)');
render_row_2($read_rnd_buffer_size_min_rec_value ,'Read rnd-buffer size (minimum recommended value)',db_get_value_sql("SELECT @@read_rnd_buffer_size")/1024 . 'K', 'Read rnd-buffer size (current value)');
render_row_2($query_cache_min_res_unit_min_rec_value ,'Query cache min-res-unit (minimum recommended value)',db_get_value_sql("SELECT @@query_cache_min_res_unit")/1024 . 'K', 'Query cache min-res-unit (current value)');
render_row(db_get_value_sql("SELECT @@innodb_file_per_table"), 'InnoDB file per table');
render_row($innodb_log_file_size.status_values($innodb_log_file_size_min_rec_value,$innodb_log_file_size),'InnoDB log file size ', 'InnoDB log file size ');
render_row($innodb_log_buffer_size.status_values($innodb_log_buffer_size_min_rec_value,$innodb_log_buffer_size),'InnoDB log buffer size ', 'InnoDB log buffer size ');
render_row($innodb_flush_log_at_trx_commit.status_values($innodb_flush_log_at_trx_commit_min_rec_value,$innodb_flush_log_at_trx_commit), 'InnoDB flush log at trx-commit ','InnoDB flush log at trx-commit ');
render_row($max_allowed_packet.status_values($max_allowed_packet_min_rec_value,$max_allowed_packet), 'Maximun allowed packet ','Maximun allowed packet ');
render_row($innodb_buffer_pool_size .status_values($innodb_buffer_pool_size_min_rec_value,$innodb_buffer_pool_size), 'InnoDB buffer pool size ','InnoDB buffer pool size ');
render_row($sort_buffer_size.status_values($sort_buffer_size_min_rec_value,$sort_buffer_size), 'Sort buffer size ','Sort buffer size ');
render_row($join_buffer_size.status_values($join_buffer_size_min_rec_value,$join_buffer_size), 'Join buffer size ','Join buffer size ');
render_row($query_cache_type.status_values($query_cache_type_min_rec_value,$query_cache_type), 'Query cache type ', 'Query cache type ');
render_row($query_cache_size.status_values($query_cache_size_min_rec_value,$query_cache_size), 'Query cache size ','Query cache size ');
render_row($query_cache_limit.status_values($query_cache_limit_min_rec_value,$query_cache_limit), 'Query cache limit ','Query cache limit ');
render_row($innodb_lock_wait_timeout.status_values($innodb_lock_wait_timeout_max_rec_value,$innodb_lock_wait_timeout), 'InnoDB lock wait timeout ','InnoDB lock wait timeout ');
render_row($thread_cache_size.status_values($thread_cache_size_max_rec_value,$thread_cache_size), 'Thread cache size ','Thread cache size ');
render_row($thread_stack .status_values($thread_stack_min_rec_value,$thread_stack), 'Thread stack ','Thread stack ');
render_row($max_connections.status_values($max_connections_max_rec_value,$max_connections), 'Maximum connections ','Maximun connections ');
render_row($key_buffer_size .status_values($key_buffer_size_min_rec_value,$key_buffer_size), 'Key buffer size ','Key buffer size ');
render_row($read_buffer_size.status_values($read_buffer_size_min_rec_value,$read_buffer_size), 'Read buffer size ','Read buffer size ');
render_row($read_rnd_buffer_size.status_values($read_rnd_buffer_size_min_rec_value,$read_rnd_buffer_size), 'Read rnd-buffer size ','Read rnd-buffer size ');
render_row($query_cache_min_res_unit.status_values($query_cache_min_res_unit_min_rec_value,$query_cache_min_res_unit), 'Query cache min-res-unit ','Query cache min-res-unit ');
render_row($innodb_file_per_table.status_values($innodb_file_per_table_min_rec_value,$innodb_file_per_table), 'InnoDB file per table ','InnoDB file per table ');
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__("Tables fragmentation in the PandoraFMS database")."</th></tr>";
@ -628,7 +655,7 @@ $agent_id= db_get_value_sql ("SELECT id_agente FROM tagente WHERE nombre = '$ser
'agent_module_id' => $id_module['id_agente_modulo'],
'period' => SECONDS_1MONTH,
'date' => time() ,
'height' => '200'
'height' => '150'
);
render_row(grafico_modulo_sparse ($params),"Graph of the " . $id_module['nombre']." module.");
}