mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-24 06:05:17 +02:00
Merge pull request #2399 from UrBnW/winversion
enh(windows) Output Windows version
This commit is contained in:
commit
04f0994a82
@ -110,7 +110,10 @@ Try {
|
|||||||
$SCCM = $null
|
$SCCM = $null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$WindowsVersion = (Get-WmiObject -class Win32_OperatingSystem).Caption;
|
||||||
|
|
||||||
$item = @{
|
$item = @{
|
||||||
|
WindowsVersion = $WindowsVersion;
|
||||||
CBServicing = $CBSRebootPend;
|
CBServicing = $CBSRebootPend;
|
||||||
WindowsUpdate = $WUAURebootReq;
|
WindowsUpdate = $WUAURebootReq;
|
||||||
CCMClientSDK = $SCCM;
|
CCMClientSDK = $SCCM;
|
||||||
|
@ -33,8 +33,8 @@ sub custom_status_output {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'Reboot Pending: %s [Windows Update: %s][Component Based Servicing: %s][SCCM Client: %s][File Rename Operations: %s][Computer Name Change: %s]',
|
"'%s': reboot pending is %s [Windows Update: %s][Component Based Servicing: %s][SCCM Client: %s][File Rename Operations: %s][Computer Name Change: %s]",
|
||||||
$self->{result_values}->{RebootPending},
|
$self->{result_values}->{WindowsVersion},
|
||||||
$self->{result_values}->{WindowsUpdate},
|
$self->{result_values}->{WindowsUpdate},
|
||||||
$self->{result_values}->{CBServicing},
|
$self->{result_values}->{CBServicing},
|
||||||
$self->{result_values}->{CCMClientSDK},
|
$self->{result_values}->{CCMClientSDK},
|
||||||
@ -46,6 +46,7 @@ sub custom_status_output {
|
|||||||
sub custom_status_calc {
|
sub custom_status_calc {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{result_values}->{WindowsVersion} = $options{new_datas}->{$self->{instance} . '_WindowsVersion'};
|
||||||
$self->{result_values}->{CBServicing} = $options{new_datas}->{$self->{instance} . '_CBServicing'};
|
$self->{result_values}->{CBServicing} = $options{new_datas}->{$self->{instance} . '_CBServicing'};
|
||||||
$self->{result_values}->{RebootPending} = $options{new_datas}->{$self->{instance} . '_RebootPending'};
|
$self->{result_values}->{RebootPending} = $options{new_datas}->{$self->{instance} . '_RebootPending'};
|
||||||
$self->{result_values}->{WindowsUpdate} = $options{new_datas}->{$self->{instance} . '_WindowsUpdate'};
|
$self->{result_values}->{WindowsUpdate} = $options{new_datas}->{$self->{instance} . '_WindowsUpdate'};
|
||||||
@ -64,7 +65,7 @@ sub set_counters {
|
|||||||
$self->{maps_counters}->{pendingreboot} = [
|
$self->{maps_counters}->{pendingreboot} = [
|
||||||
{ label => 'status', , threshold => 0, set => {
|
{ label => 'status', , threshold => 0, set => {
|
||||||
key_values => [
|
key_values => [
|
||||||
{ name => 'CBServicing' }, { name => 'RebootPending' }, { name => 'WindowsUpdate' },
|
{ name => 'WindowsVersion' }, { name => 'CBServicing' }, { name => 'RebootPending' }, { name => 'WindowsUpdate' },
|
||||||
{ name => 'CCMClientSDK' }, { name => 'PendComputerRename' }, { name => 'PendFileRename' }
|
{ name => 'CCMClientSDK' }, { name => 'PendComputerRename' }, { name => 'PendFileRename' }
|
||||||
],
|
],
|
||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
@ -145,11 +146,11 @@ sub manage_selection {
|
|||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#{ CBServicing: false, WindowsUpdate: false, CCMClientSDK: null, PendComputerRename: false, PendFileRename: false, PendFileRenVal: null, RebootPending: false }
|
#{ WindowsVersion: "Microsoft Windows 2003 Server", CBServicing: false, WindowsUpdate: false, CCMClientSDK: null, PendComputerRename: false, PendFileRename: false, PendFileRenVal: null, RebootPending: false }
|
||||||
foreach (keys %$decoded) {
|
foreach (keys %$decoded) {
|
||||||
$decoded->{$_} = '-' if (!defined($decoded->{$_}));
|
$decoded->{$_} = '-' if (!defined($decoded->{$_}));
|
||||||
$decoded->{$_} = 'true' if ($decoded->{$_} =~ /true|1/i);
|
$decoded->{$_} = 'true' if ($decoded->{$_} =~ /^(?:true|1)$/i);
|
||||||
$decoded->{$_} = 'false' if ($decoded->{$_} =~ /false|0/i);
|
$decoded->{$_} = 'false' if ($decoded->{$_} =~ /^(?:false|0)$/i);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{pendingreboot} = $decoded;
|
$self->{pendingreboot} = $decoded;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user