Merge branch 'master' of https://github.com/centreon/centreon-plugins
This commit is contained in:
commit
65c10eb5b9
|
@ -263,7 +263,7 @@ sub check_memory_enhanced_pool {
|
||||||
instances => [keys %$physical_array],
|
instances => [keys %$physical_array],
|
||||||
instance_regexp => '^(.*)$'
|
instance_regexp => '^(.*)$'
|
||||||
);
|
);
|
||||||
$snmp_result = $self->{snmp}->get_leef(nothing_quit => 1);
|
$snmp_result = $self->{snmp}->get_leef();
|
||||||
foreach (keys %{$self->{memory}}) {
|
foreach (keys %{$self->{memory}}) {
|
||||||
if (defined($snmp_result->{ $oid_entPhysicalName . '.' . $self->{memory}->{$_}->{physical_index} })) {
|
if (defined($snmp_result->{ $oid_entPhysicalName . '.' . $self->{memory}->{$_}->{physical_index} })) {
|
||||||
$self->{memory}->{$_}->{display} =
|
$self->{memory}->{$_}->{display} =
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#
|
||||||
|
# Copyright 2019 Centreon (http://www.centreon.com/)
|
||||||
|
#
|
||||||
|
# Centreon is a full-fledged industry-strength solution that meets
|
||||||
|
# the needs in IT infrastructure and application monitoring for
|
||||||
|
# service performance.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
package database::mysql::dbi;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::dbi);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
sub set_version {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{version} = $self->{instance}->get_info(18); # SQL_DBMS_VER
|
||||||
|
# MariaDB: 5.5.5-10.1.36-MariaDB
|
||||||
|
if ($self->{version} =~ /^(.*.)-(.*?)-MariaDB/i) {
|
||||||
|
$self->{version} = $1;
|
||||||
|
$self->{mariadb_version} = $2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
|
@ -84,15 +84,35 @@ 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.7.6')) {
|
||||||
$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 performance_schema.global_status WHERE VARIABLE_NAME = 'Threads_connected'
|
||||||
|
});
|
||||||
|
while (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
||||||
|
$infos->{lc($name)} = $value;
|
||||||
|
}
|
||||||
|
} elsif ($options{sql}->is_version_minimum(version => '5.1.12')) {
|
||||||
|
$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) {
|
||||||
|
|
|
@ -32,24 +32,25 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
%{$self->{modes}} = (
|
||||||
'connection-time' => 'centreon::common::protocols::sql::mode::connectiontime',
|
'connection-time' => 'centreon::common::protocols::sql::mode::connectiontime',
|
||||||
'databases-size' => 'database::mysql::mode::databasessize',
|
'databases-size' => 'database::mysql::mode::databasessize',
|
||||||
'innodb-bufferpool-hitrate' => 'database::mysql::mode::innodbbufferpoolhitrate',
|
'innodb-bufferpool-hitrate' => 'database::mysql::mode::innodbbufferpoolhitrate',
|
||||||
'long-queries' => 'database::mysql::mode::longqueries',
|
'long-queries' => 'database::mysql::mode::longqueries',
|
||||||
'myisam-keycache-hitrate' => 'database::mysql::mode::myisamkeycachehitrate',
|
'myisam-keycache-hitrate' => 'database::mysql::mode::myisamkeycachehitrate',
|
||||||
'open-files' => 'database::mysql::mode::openfiles',
|
'open-files' => 'database::mysql::mode::openfiles',
|
||||||
'qcache-hitrate' => 'database::mysql::mode::qcachehitrate',
|
'qcache-hitrate' => 'database::mysql::mode::qcachehitrate',
|
||||||
'queries' => 'database::mysql::mode::queries',
|
'queries' => 'database::mysql::mode::queries',
|
||||||
'replication-master-slave' => 'database::mysql::mode::replicationmasterslave',
|
'replication-master-slave' => 'database::mysql::mode::replicationmasterslave',
|
||||||
'replication-master-master' => 'database::mysql::mode::replicationmastermaster',
|
'replication-master-master' => 'database::mysql::mode::replicationmastermaster',
|
||||||
'slow-queries' => 'database::mysql::mode::slowqueries',
|
'slow-queries' => 'database::mysql::mode::slowqueries',
|
||||||
'sql' => 'centreon::common::protocols::sql::mode::sql',
|
'sql' => 'centreon::common::protocols::sql::mode::sql',
|
||||||
'sql-string' => 'centreon::common::protocols::sql::mode::sqlstring',
|
'sql-string' => 'centreon::common::protocols::sql::mode::sqlstring',
|
||||||
'tables-size' => 'database::mysql::mode::tablessize',
|
'tables-size' => 'database::mysql::mode::tablessize',
|
||||||
'threads-connected' => 'database::mysql::mode::threadsconnected',
|
'threads-connected' => 'database::mysql::mode::threadsconnected',
|
||||||
'uptime' => 'database::mysql::mode::uptime',
|
'uptime' => 'database::mysql::mode::uptime',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$self->{sql_modes}{dbi} = 'database::mysql::dbi';
|
||||||
$self->{sql_modes}{mysqlcmd} = 'database::mysql::mysqlcmd';
|
$self->{sql_modes}{mysqlcmd} = 'database::mysql::mysqlcmd';
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
|
Loading…
Reference in New Issue