Ctor 264 plugin database mysql mode databasesize change the way we calculate the fragmentation rate (#5088)

This commit is contained in:
omercier 2024-07-02 17:20:28 +02:00 committed by GitHub
parent eca3644d59
commit 8065a56f05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 3 deletions

View File

@ -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();
@ -230,7 +243,7 @@ __END__
=head1 MODE
Check MySQL databases size and tables.
Check MySQL/MariaDB databases and tables sizes.
=over 8
@ -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-*>