Merge pull request #7 from centreon/master

Merge from master
This commit is contained in:
Sims24 2016-01-27 13:07:01 +01:00
commit 76e61851ac
3 changed files with 34 additions and 9 deletions

View File

@ -264,6 +264,9 @@ sub run {
#Busy Ticks: 462350 #Busy Ticks: 462350
#Idle Ticks: 388743630 #Idle Ticks: 388743630
#Raid Group ID: 0 #Raid Group ID: 0
# Add a "\n" for the end.
$response .= "\n";
while ($response =~ /^Bus\s+(\S+)\s+Enclosure\s+(\S+)\s+Disk\s+(\S+)(.*?)\n\n/msgi) { while ($response =~ /^Bus\s+(\S+)\s+Enclosure\s+(\S+)\s+Disk\s+(\S+)(.*?)\n\n/msgi) {
my $disk_instance = "$1_$2_$3"; my $disk_instance = "$1_$2_$3";
my $values = $4; my $values = $4;
@ -319,7 +322,6 @@ sub run {
$critical = $self->{perfdata}->get_perfdata_for_output(label => $maps_counters->{$_}->{thresholds}->{$name}->{label}) if ($maps_counters->{$_}->{thresholds}->{$name}->{exit_value} eq 'critical'); $critical = $self->{perfdata}->get_perfdata_for_output(label => $maps_counters->{$_}->{thresholds}->{$name}->{label}) if ($maps_counters->{$_}->{thresholds}->{$name}->{exit_value} eq 'critical');
} }
$self->{output}->output_add(long_msg => "Disk '$disk_instance':$long_msg");
$self->{output}->perfdata_add(label => $_ . '_' . $disk_instance, unit => $maps_counters->{$_}->{unit}, $self->{output}->perfdata_add(label => $_ . '_' . $disk_instance, unit => $maps_counters->{$_}->{unit},
value => sprintf($maps_counters->{$_}->{perfdata}, $value_check), value => sprintf($maps_counters->{$_}->{perfdata}, $value_check),
warning => $warning, warning => $warning,
@ -327,6 +329,7 @@ sub run {
min => 0); min => 0);
} }
$self->{output}->output_add(long_msg => "Disk '$disk_instance':$long_msg");
$exit = $self->{output}->get_most_critical(status => [ @exits ]); $exit = $self->{output}->get_most_critical(status => [ @exits ]);
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) { if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(severity => $exit,

View File

@ -181,7 +181,7 @@ sub run_global {
short_msg => "${prefix_output}${short_msg}${suffix_output}" short_msg => "${prefix_output}${short_msg}${suffix_output}"
); );
} else { } else {
$self->{output}->output_add(short_msg => "${prefix_output}${long_msg}${suffix_output}"); $self->{output}->output_add(short_msg => "${prefix_output}${long_msg}${suffix_output}") if ($long_msg ne '');
} }
} }

View File

@ -67,7 +67,24 @@ sub run {
$self->{sql}->connect(); $self->{sql}->connect();
my $query; my $query;
if ($self->{sql}->is_version_minimum(version => '9')) { if ($self->{sql}->is_version_minimum(version => '11')) {
$query = q{
SELECT
tum.tablespace_name "Tablespace",
t.status "Status",
t.contents "Type",
t.extent_management "Extent Mgmt",
tum.used_space*t.block_size bytes,
tum.tablespace_size*t.block_size bytes_max
FROM
DBA_TABLESPACE_USAGE_METRICS tum
INNER JOIN
dba_tablespaces t on tum.tablespace_name=t.tablespace_name
WHERE
t.contents<>'UNDO'
OR (t.contents='UNDO' AND t.tablespace_name =(SELECT value FROM v$parameter WHERE name='undo_tablespace'))
};
} elsif ($self->{sql}->is_version_minimum(version => '9')) {
$query = q{ $query = q{
SELECT SELECT
a.tablespace_name "Tablespace", a.tablespace_name "Tablespace",
@ -274,7 +291,12 @@ sub run {
$status = lc $status; $status = lc $status;
$type = lc $type; $type = lc $type;
my ($percent_used, $percent_free, $used, $free, $size); my ($percent_used, $percent_free, $used, $free, $size);
if ((!defined($bytes_max)) || ($bytes_max == 0)) { if ($self->{sql}->is_version_minimum(version => '11')) {
$percent_used = $bytes / $bytes_max * 100;
$size = $bytes_max;
$free = $bytes_max - $bytes;
$used = $bytes;
} elsif ((!defined($bytes_max)) || ($bytes_max == 0)) {
$percent_used = ($bytes - $bytes_free) / $bytes * 100; $percent_used = ($bytes - $bytes_free) / $bytes * 100;
$size = $bytes; $size = $bytes;
$free = $bytes_free; $free = $bytes_free;