enh sccm plugin database replication status mode
This commit is contained in:
parent
f290b91682
commit
80def357a1
|
@ -29,6 +29,38 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold)
|
||||||
use centreon::common::powershell::sccm::databasereplicationstatus;
|
use centreon::common::powershell::sccm::databasereplicationstatus;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
|
my %map_link_status = (
|
||||||
|
1 => 'Degraded',
|
||||||
|
2 => 'Active',
|
||||||
|
3 => 'Failed',
|
||||||
|
);
|
||||||
|
my %map_status = (
|
||||||
|
100 => 'SITE_INSTALLING',
|
||||||
|
105 => 'SITE_INSTALL_COMPLETE',
|
||||||
|
110 => 'INACTIVE',
|
||||||
|
115 => 'INITIALIZING',
|
||||||
|
120 => 'MAINTENANCE_MODE',
|
||||||
|
125 => 'ACTIVE',
|
||||||
|
130 => 'DETACHING',
|
||||||
|
135 => 'READY_TO_DETACH',
|
||||||
|
199 => 'STATUS_UNKNOWN',
|
||||||
|
200 => 'SITE_RECOVERED',
|
||||||
|
205 => 'SITE_PREPARE_FOR_RECOVERY',
|
||||||
|
210 => 'SITE_PREPARED_FOR_RECOVERY',
|
||||||
|
215 => 'REPLCONFIG_REINITIALIZING',
|
||||||
|
220 => 'REPLCONFIG_REINITIALIZED',
|
||||||
|
225 => 'RECOVERY_IN_PROGRESS',
|
||||||
|
230 => 'RECOVERING_DELTAS',
|
||||||
|
250 => 'RECOVERY_RETRY',
|
||||||
|
255 => 'RECOVERY_FAILED',
|
||||||
|
);
|
||||||
|
my %map_type = (
|
||||||
|
0 => 'Unknown',
|
||||||
|
1 => 'SECONDARY',
|
||||||
|
2 => 'PRIMARY',
|
||||||
|
4 => 'CAS',
|
||||||
|
);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
@ -90,7 +122,7 @@ sub set_counters {
|
||||||
];
|
];
|
||||||
$self->{maps_counters}->{sites} = [
|
$self->{maps_counters}->{sites} = [
|
||||||
{ label => 'site-status', threshold => 0, set => {
|
{ label => 'site-status', threshold => 0, set => {
|
||||||
key_values => [ { name => 'SiteType' }, { name => 'SiteStatus' }, { name => 'SiteToSiteGlobalState' },
|
key_values => [ { name => 'SiteType' }, { name => 'SiteStatus' }, { name => '' },
|
||||||
{ name => 'SiteToSiteGlobalSyncTime' } ],
|
{ name => 'SiteToSiteGlobalSyncTime' } ],
|
||||||
closure_custom_calc => $self->can('custom_site_status_calc'),
|
closure_custom_calc => $self->can('custom_site_status_calc'),
|
||||||
closure_custom_output => $self->can('custom_site_status_output'),
|
closure_custom_output => $self->can('custom_site_status_output'),
|
||||||
|
@ -167,19 +199,19 @@ sub manage_selection {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{global}->{LinkStatus} = $decoded->{LinkStatus};
|
$self->{global}->{LinkStatus} = $map_link_status{$decoded->{LinkStatus}};
|
||||||
|
|
||||||
$self->{sites}->{$decoded->{Site1}} = {
|
$self->{sites}->{$decoded->{Site1}} = {
|
||||||
display => $decoded->{Site1},
|
display => $decoded->{Site1},
|
||||||
SiteType => $decoded->{SiteType1},
|
SiteType => $map_type{$decoded->{SiteType1}},
|
||||||
SiteStatus => $decoded->{Site1Status},
|
SiteStatus => $map_status{$decoded->{Site1Status}},
|
||||||
SiteToSiteGlobalState => $decoded->{Site1ToSite2GlobalState},
|
SiteToSiteGlobalState => $decoded->{Site1ToSite2GlobalState},
|
||||||
SiteToSiteGlobalSyncTime => $decoded->{Site1ToSite2GlobalSyncTime},
|
SiteToSiteGlobalSyncTime => $decoded->{Site1ToSite2GlobalSyncTime},
|
||||||
};
|
};
|
||||||
$self->{sites}->{$decoded->{Site2}} = {
|
$self->{sites}->{$decoded->{Site2}} = {
|
||||||
display => $decoded->{Site2},
|
display => $decoded->{Site2},
|
||||||
SiteType => $decoded->{SiteType2},
|
SiteType => $map_type{$decoded->{SiteType2}},
|
||||||
SiteStatus => $decoded->{Site2Status},
|
SiteStatus => $map_status{$decoded->{Site2Status}},
|
||||||
SiteToSiteGlobalState => $decoded->{Site2ToSite1GlobalState},
|
SiteToSiteGlobalState => $decoded->{Site2ToSite1GlobalState},
|
||||||
SiteToSiteGlobalSyncTime => $decoded->{Site2ToSite1GlobalSyncTime},
|
SiteToSiteGlobalSyncTime => $decoded->{Site2ToSite1GlobalSyncTime},
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,13 +50,11 @@ Try {
|
||||||
New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" | Out-Null
|
New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" | Out-Null
|
||||||
CD "SCCMDrive:\"
|
CD "SCCMDrive:\"
|
||||||
|
|
||||||
$CMObject = Get-CMSite
|
$CMObject = Get-CMDatabaseReplicationStatus
|
||||||
|
|
||||||
CD "C:\"
|
CD "C:\"
|
||||||
Remove-PSDrive -Name SCCMDrive
|
Remove-PSDrive -Name SCCMDrive
|
||||||
|
|
||||||
$CMObject = Get-CMDatabaseReplicationStatus
|
|
||||||
|
|
||||||
$returnObject = New-Object -TypeName PSObject
|
$returnObject = New-Object -TypeName PSObject
|
||||||
Add-Member -InputObject $returnObject -MemberType NoteProperty -Name "LinkStatus" -Value $CMObject.LinkStatus
|
Add-Member -InputObject $returnObject -MemberType NoteProperty -Name "LinkStatus" -Value $CMObject.LinkStatus
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue