Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading