From 4714685f558edb0782fa29269539bc5c6fdbb7aa Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Mon, 3 Jun 2019 16:49:11 +0200 Subject: [PATCH 1/3] fix prometheus nodeexporter cpudetailed help --- .../prometheus/exporters/nodeexporter/mode/cpudetailed.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloud/prometheus/exporters/nodeexporter/mode/cpudetailed.pm b/cloud/prometheus/exporters/nodeexporter/mode/cpudetailed.pm index b73882d18..926443bfe 100644 --- a/cloud/prometheus/exporters/nodeexporter/mode/cpudetailed.pm +++ b/cloud/prometheus/exporters/nodeexporter/mode/cpudetailed.pm @@ -320,17 +320,17 @@ Filter on a specific type (Must be a PromQL filter, Default: 'mode=~".*"') =item B<--warning-*> Threshold warning. -Can be: 'node-idle', 'node-wait', 'node-irq', 'node-nice', +Can be: 'node-idle', 'node-wait', 'node-interrupt', 'node-nice', 'node-softirq', 'node-steal', 'node-system', 'node-user', -'cpu-idle', 'cpu-wait', 'cpu-irq', 'cpu-nice', 'cpu-softirq', +'cpu-idle', 'cpu-wait', 'cpu-interrupt', 'cpu-nice', 'cpu-softirq', 'cpu-steal', 'cpu-system', 'cpu-user'. =item B<--critical-*> Threshold critical. -Can be: 'node-idle', 'node-wait', 'node-irq', 'node-nice', +Can be: 'node-idle', 'node-wait', 'node-interrupt', 'node-nice', 'node-softirq', 'node-steal', 'node-system', 'node-user', -'cpu-idle', 'cpu-wait', 'cpu-irq', 'cpu-nice', 'cpu-softirq', +'cpu-idle', 'cpu-wait', 'cpu-interrupt', 'cpu-nice', 'cpu-softirq', 'cpu-steal', 'cpu-system', 'cpu-user'. =item B<--extra-filter> From 9fcba83eb2955d4ff29c14fa5bc069e631aa1a30 Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Mon, 3 Jun 2019 17:36:59 +0200 Subject: [PATCH 2/3] fix sccm plugin --- .../local/mode/databasereplicationstatus.pm | 4 +++ apps/sccm/local/mode/sitestatus.pm | 34 ++++++++++++++----- .../sccm/databasereplicationstatus.pm | 5 ++- centreon/common/powershell/sccm/sitestatus.pm | 5 ++- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/apps/sccm/local/mode/databasereplicationstatus.pm b/apps/sccm/local/mode/databasereplicationstatus.pm index aaf148bb1..7867c1714 100644 --- a/apps/sccm/local/mode/databasereplicationstatus.pm +++ b/apps/sccm/local/mode/databasereplicationstatus.pm @@ -199,6 +199,10 @@ sub manage_selection { $self->{output}->option_exit(); } + if (!defined($decoded->{LinkStatus})) { + $self->{output}->add_option_msg(short_msg => "No database replication"); + $self->{output}->option_exit(); + } $self->{global}->{LinkStatus} = $map_link_status{$decoded->{LinkStatus}}; $self->{sites}->{$decoded->{Site1}} = { diff --git a/apps/sccm/local/mode/sitestatus.pm b/apps/sccm/local/mode/sitestatus.pm index 7024203d2..4ce5c4648 100644 --- a/apps/sccm/local/mode/sitestatus.pm +++ b/apps/sccm/local/mode/sitestatus.pm @@ -161,15 +161,31 @@ sub manage_selection { $self->{output}->option_exit(); } - foreach my $site (@{$decoded}) { - $self->{sites}->{$site->{SiteCode}} = { - display => $site->{SiteCode}, - SiteName => $site->{SiteName}, - Type => $map_type{$site->{Type}}, - Mode => $map_mode{$site->{Mode}}, - Status => $map_status{$site->{Status}}, - SecondarySiteCMUpdateStatus => $site->{SecondarySiteCMUpdateStatus}, - }; + if (ref($decoded) eq "ARRAY") { + foreach my $site (@{$decoded}) { + $self->{sites}->{$site->{SiteCode}} = { + display => $site->{SiteCode}, + SiteName => $site->{SiteName}, + Type => $map_type{$site->{Type}}, + Mode => $map_mode{$site->{Mode}}, + Status => $map_status{$site->{Status}}, + SecondarySiteCMUpdateStatus => $site->{SecondarySiteCMUpdateStatus}, + }; + } + } else { + $self->{sites}->{$decoded->{SiteCode}} = { + display => $decoded->{SiteCode}, + SiteName => $decoded->{SiteName}, + Type => $map_type{$decoded->{Type}}, + Mode => $map_mode{$decoded->{Mode}}, + Status => $map_status{$decoded->{Status}}, + SecondarySiteCMUpdateStatus => $decoded->{SecondarySiteCMUpdateStatus}, + }; + } + + if (scalar(keys %{$self->{sites}}) <= 0) { + $self->{output}->add_option_msg(short_msg => "No sites found."); + $self->{output}->option_exit(); } } diff --git a/centreon/common/powershell/sccm/databasereplicationstatus.pm b/centreon/common/powershell/sccm/databasereplicationstatus.pm index 027102e6c..76aa8d87b 100644 --- a/centreon/common/powershell/sccm/databasereplicationstatus.pm +++ b/centreon/common/powershell/sccm/databasereplicationstatus.pm @@ -44,7 +44,10 @@ $ProgressPreference = "SilentlyContinue" Try { $ErrorActionPreference = "Stop" - $module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" + $module = ${env:ProgramFiles} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" + If (!(Test-Path $module)) { + $module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" + } Import-Module $module New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" | Out-Null diff --git a/centreon/common/powershell/sccm/sitestatus.pm b/centreon/common/powershell/sccm/sitestatus.pm index 99510c358..101fff860 100644 --- a/centreon/common/powershell/sccm/sitestatus.pm +++ b/centreon/common/powershell/sccm/sitestatus.pm @@ -44,7 +44,10 @@ $ProgressPreference = "SilentlyContinue" Try { $ErrorActionPreference = "Stop" - $module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" + $module = ${env:ProgramFiles} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" + If (!(Test-Path $module)) { + $module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" + } Import-Module $module New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" | Out-Null From 16bbc678dd52e4ce14f99b18078c54bd1da417ff Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Mon, 3 Jun 2019 17:39:44 +0200 Subject: [PATCH 3/3] fix indent --- apps/sccm/local/mode/sitestatus.pm | 38 +++++++++---------- .../sccm/databasereplicationstatus.pm | 2 +- centreon/common/powershell/sccm/sitestatus.pm | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/apps/sccm/local/mode/sitestatus.pm b/apps/sccm/local/mode/sitestatus.pm index 4ce5c4648..fb9c6db5d 100644 --- a/apps/sccm/local/mode/sitestatus.pm +++ b/apps/sccm/local/mode/sitestatus.pm @@ -162,26 +162,26 @@ sub manage_selection { } if (ref($decoded) eq "ARRAY") { - foreach my $site (@{$decoded}) { - $self->{sites}->{$site->{SiteCode}} = { - display => $site->{SiteCode}, - SiteName => $site->{SiteName}, - Type => $map_type{$site->{Type}}, - Mode => $map_mode{$site->{Mode}}, - Status => $map_status{$site->{Status}}, - SecondarySiteCMUpdateStatus => $site->{SecondarySiteCMUpdateStatus}, - }; - } + foreach my $site (@{$decoded}) { + $self->{sites}->{$site->{SiteCode}} = { + display => $site->{SiteCode}, + SiteName => $site->{SiteName}, + Type => $map_type{$site->{Type}}, + Mode => $map_mode{$site->{Mode}}, + Status => $map_status{$site->{Status}}, + SecondarySiteCMUpdateStatus => $site->{SecondarySiteCMUpdateStatus}, + }; + } } else { - $self->{sites}->{$decoded->{SiteCode}} = { - display => $decoded->{SiteCode}, - SiteName => $decoded->{SiteName}, - Type => $map_type{$decoded->{Type}}, - Mode => $map_mode{$decoded->{Mode}}, - Status => $map_status{$decoded->{Status}}, - SecondarySiteCMUpdateStatus => $decoded->{SecondarySiteCMUpdateStatus}, - }; - } + $self->{sites}->{$decoded->{SiteCode}} = { + display => $decoded->{SiteCode}, + SiteName => $decoded->{SiteName}, + Type => $map_type{$decoded->{Type}}, + Mode => $map_mode{$decoded->{Mode}}, + Status => $map_status{$decoded->{Status}}, + SecondarySiteCMUpdateStatus => $decoded->{SecondarySiteCMUpdateStatus}, + }; + } if (scalar(keys %{$self->{sites}}) <= 0) { $self->{output}->add_option_msg(short_msg => "No sites found."); diff --git a/centreon/common/powershell/sccm/databasereplicationstatus.pm b/centreon/common/powershell/sccm/databasereplicationstatus.pm index 76aa8d87b..ddf91532a 100644 --- a/centreon/common/powershell/sccm/databasereplicationstatus.pm +++ b/centreon/common/powershell/sccm/databasereplicationstatus.pm @@ -45,7 +45,7 @@ Try { $ErrorActionPreference = "Stop" $module = ${env:ProgramFiles} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" - If (!(Test-Path $module)) { + If (-Not (Test-Path $module)) { $module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" } Import-Module $module diff --git a/centreon/common/powershell/sccm/sitestatus.pm b/centreon/common/powershell/sccm/sitestatus.pm index 101fff860..a63f5f1ee 100644 --- a/centreon/common/powershell/sccm/sitestatus.pm +++ b/centreon/common/powershell/sccm/sitestatus.pm @@ -45,7 +45,7 @@ Try { $ErrorActionPreference = "Stop" $module = ${env:ProgramFiles} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" - If (!(Test-Path $module)) { + If (-Not (Test-Path $module)) { $module = ${env:ProgramFiles(x86)} + "\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1" } Import-Module $module