mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
fix threads-connected mysql for old version
This commit is contained in:
parent
e6ccb8fe97
commit
d820b9319e
@ -84,15 +84,26 @@ sub manage_selection {
|
|||||||
$self->{output}->add_option_msg(short_msg => "MySQL version '" . $self->{sql}->{version} . "' is not supported (need version >= '5.x').");
|
$self->{output}->add_option_msg(short_msg => "MySQL version '" . $self->{sql}->{version} . "' is not supported (need version >= '5.x').");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$options{sql}->query(query => q{
|
|
||||||
SELECT 'max_connections' as name, @@GLOBAL.max_connections as value
|
|
||||||
UNION
|
|
||||||
SELECT VARIABLE_NAME as name, VARIABLE_VALUE as value fROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_connected'
|
|
||||||
});
|
|
||||||
my $infos = {};
|
my $infos = {};
|
||||||
while (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
if ($options{sql}->is_version_minimum(version => '5.1.12')) {
|
||||||
$infos->{lc($name)} = $value;
|
$options{sql}->query(query => q{
|
||||||
|
SELECT 'max_connections' as name, @@GLOBAL.max_connections as value
|
||||||
|
UNION
|
||||||
|
SELECT VARIABLE_NAME as name, VARIABLE_VALUE as value FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_connected'
|
||||||
|
});
|
||||||
|
while (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
||||||
|
$infos->{lc($name)} = $value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$options{sql}->query(query => q{SELECT 'max_connections' as name, @@GLOBAL.max_connections as value});
|
||||||
|
if (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
||||||
|
$infos->{lc($name)} = $value
|
||||||
|
}
|
||||||
|
$options{sql}->query(query => q{SHOW /*!50000 global */ STATUS LIKE 'Threads_connected'});
|
||||||
|
if (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
||||||
|
$infos->{lc($name)} = $value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(keys %$infos) == 0) {
|
if (scalar(keys %$infos) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user