Skip to content

Commit

Permalink
Ctor 264 plugin database mysql mode databasesize change the way we ca…
Browse files Browse the repository at this point in the history
…lculate the fragmentation rate (centreon#5088)
  • Loading branch information
omercier authored Jul 2, 2024
1 parent eca3644 commit 8065a56
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/database/mysql/mode/databasessize.pm
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,20 @@ sub manage_selection {
$innodb_per_table = 1 if ($value =~ /on/i);

$options{sql}->query(
query => q{SELECT table_schema, table_name, engine, data_free, data_length+index_length as data_used, (DATA_FREE / (DATA_LENGTH+INDEX_LENGTH)) as TAUX_FRAG FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND engine IN ('InnoDB', 'MyISAM')}
query => q{
SELECT
table_schema,
table_name,
engine,
data_free,
data_length + index_length as data_used,
DATA_FREE / (DATA_LENGTH + INDEX_LENGTH + DATA_FREE) as TAUX_FRAG
FROM
information_schema.tables
WHERE
table_type = 'BASE TABLE'
AND engine IN ('InnoDB', 'MyISAM')
}
);
my $result = $options{sql}->fetchall_arrayref();

Expand Down Expand Up @@ -230,7 +243,7 @@ __END__
=head1 MODE
Check MySQL databases size and tables.
Check MySQL/MariaDB databases and tables sizes.
=over 8
Expand All @@ -240,7 +253,7 @@ Filter the databases to monitor with a regular expression.
=item B<--filter-table>
Filter table name (can be a regexp).
Filter tables by name (can be a regexp).
=item B<--warning-*> B<--critical-*>
Expand Down

0 comments on commit 8065a56

Please sign in to comment.