fix(exchange): missing db in list-databases + mapi result (#3030)

This commit is contained in:
qgarnier 2021-08-09 16:18:21 +02:00 committed by GitHub
parent da067dea43
commit 275dd21ebc
3 changed files with 14 additions and 3 deletions

View File

@ -27,7 +27,7 @@ use warnings;
use centreon::plugins::misc; use centreon::plugins::misc;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
use centreon::common::powershell::exchange::databases; use centreon::common::powershell::exchange::databases;
use apps::microsoft::exchange::local::mode::resources::types qw($copystatus_contentindexstate); use apps::microsoft::exchange::local::mode::resources::types qw($copystatus_contentindexstate $mapi_result);
use JSON::XS; use JSON::XS;
sub custom_mailflow_latency_perfdata { sub custom_mailflow_latency_perfdata {
@ -335,6 +335,8 @@ sub manage_selection {
$db->{mounted} = $db->{mounted} =~ /True|1/i ? 1 : 0; $db->{mounted} = $db->{mounted} =~ /True|1/i ? 1 : 0;
$db->{copystatus_indexstate} = $copystatus_contentindexstate->{ $db->{copystatus_indexstate} } $db->{copystatus_indexstate} = $copystatus_contentindexstate->{ $db->{copystatus_indexstate} }
if (defined($db->{copystatus_indexstate})); if (defined($db->{copystatus_indexstate}));
$db->{mapi_result} = $mapi_result->{ $db->{mapi_result} }
if (defined($db->{mapi_result}));
$self->{databases}->{ $db->{database} . ':' . $db->{server} } = { $self->{databases}->{ $db->{database} . ':' . $db->{server} } = {
database => $db->{database}, database => $db->{database},

View File

@ -27,11 +27,12 @@ use Exporter;
our $queue_status; our $queue_status;
our $queue_delivery_type; our $queue_delivery_type;
our $copystatus_contentindexstate; our $copystatus_contentindexstate;
our $mapi_result;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT_OK = qw( our @EXPORT_OK = qw(
$queue_status $queue_delivery_type $queue_status $queue_delivery_type
$copystatus_contentindexstate $copystatus_contentindexstate $mapi_result
); );
$queue_status = { $queue_status = {
@ -87,4 +88,12 @@ $copystatus_contentindexstate = {
10 => 'DiskUnavailable' 10 => 'DiskUnavailable'
}; };
$mapi_result = {
0 => 'Undefined',
1 => 'Success',
2 => 'Failure',
3 => 'MdbMoved',
4 => 'StoreNotRunning'
};
1; 1;

View File

@ -95,7 +95,7 @@ Foreach ($DB in $MountedDB) {
$ps .= ' $ps .= '
# Test Mapi Connectivity # Test Mapi Connectivity
$MapiResult = test-mapiconnectivity -Database $DB.Name $MapiResult = test-mapiconnectivity -Database $DB.Name
$item.mapi_result = $MapiResult.Result $item.mapi_result = $MapiResult.Result.Value.value__
'; ';
} }