WIP: Automonitoring. Installation monitor

This commit is contained in:
Calvo 2023-07-05 10:09:48 +02:00
parent 538a2b90b7
commit 5f7efb92b8
1 changed files with 18 additions and 7 deletions

View File

@ -6446,19 +6446,19 @@ sub pandora_installation_monitoring($$) {
undef $module;
# General info about queries
my $select = get_db_value($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_select');
my $insert = get_db_value($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_insert');
my $update = get_db_value($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_update');
my $replace = get_db_value($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_replace');
my $delete = get_db_value($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_delete');
my $select = get_db_single_row($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_select');
my $insert = get_db_single_row($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_insert');
my $update = get_db_single_row($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_update');
my $replace = get_db_single_row($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_replace');
my $delete = get_db_single_row($dbh, 'SHOW /*!50000 GLOBAL */ STATUS WHERE Variable_name= ?', 'Com_delete');
my $data_size = get_db_value($dbh, 'SELECT SUM(data_length)/(1024*1024) FROM information_schema.TABLES');
my $index_size = get_db_value($dbh, 'SELECT SUM(index_length)/(1024*1024) FROM information_schema.TABLES');
my $writes = $insert + $update + $replace + $delete;
my $writes = $insert->{'Value'} + $update->{'Value'} + $replace->{'Value'} + $delete->{'Value'} ;
# Mysql Questions - Reads
$module->{'name'} = "mysql_questions_reads";
$module->{'description'} = 'MySQL: Questions - Reads (#): Number of read questions';
$module->{'data'} = $select;
$module->{'data'} = $select->{'Value'};
$module->{'unit'} = 'qu';
push(@modules, $module);
undef $module;
@ -6491,6 +6491,17 @@ sub pandora_installation_monitoring($$) {
push(@modules, $module);
undef $module;
# Mysql process list
my $command = 'mysql -u '.$pa_config->{'dbuser'}.' -p"'.$pa_config->{'dbpass'}.'" -e "show processlist"';
print Dumper($command);
my $process_list = `$command 2>$DEVNULL`;
$module->{'name'} = 'mysql_transactions_list';
$module->{'description'} = 'MySQL: Transactions list';
$module->{'data'} = '<![CDATA['.$process_list.']]>';
$module->{'type'} = 'generic_data_string';
push(@modules, $module);
undef $module;
# Build xml modules.
foreach my $module_data (@modules) {
$xml_output .=" <module>";