enh windows pending reboot output (#1222)

This commit is contained in:
Colin Gagnaire 2018-11-14 16:42:33 +01:00 committed by GitHub
parent fcd236755f
commit 3990a6b52a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,7 +42,7 @@ sub custom_status_threshold {
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
@ -56,7 +56,13 @@ sub custom_status_threshold {
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'Reboot Pending : ' . $self->{result_values}->{RebootPending};
my $msg = sprintf('Reboot Pending: %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}->{WindowsUpdate},
$self->{result_values}->{CBServicing},
$self->{result_values}->{CCMClientSDK},
$self->{result_values}->{PendFileRename},
$self->{result_values}->{PendComputerRename});
return $msg;
}
@ -67,6 +73,8 @@ sub custom_status_calc {
$self->{result_values}->{RebootPending} = $options{new_datas}->{$self->{instance} . '_RebootPending'};
$self->{result_values}->{WindowsUpdate} = $options{new_datas}->{$self->{instance} . '_WindowsUpdate'};
$self->{result_values}->{CCMClientSDK} = $options{new_datas}->{$self->{instance} . '_CCMClientSDK'};
$self->{result_values}->{PendComputerRename} = $options{new_datas}->{$self->{instance} . '_PendComputerRename'};
$self->{result_values}->{PendFileRename} = $options{new_datas}->{$self->{instance} . '_PendFileRename'};
return 0;
}
@ -79,7 +87,7 @@ sub set_counters {
$self->{maps_counters}->{pendingreboot} = [
{ label => 'status', , threshold => 0, set => {
key_values => [ { name => 'CBServicing' }, { name => 'RebootPending' }, { name => 'WindowsUpdate' },
{ name => 'CCMClientSDK' } ],
{ name => 'CCMClientSDK' }, { name => 'PendComputerRename' }, { name => 'PendFileRename' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
@ -191,12 +199,14 @@ Print powershell output.
=item B<--warning-status>
Set warning threshold for status (Default: '%{RebootPending} =~ /true/i').
Can used special variables like: %{RebootPending}, %{CBServicing}, %{WindowsUpdate}, %{CCMClientSDK}.
Can used special variables like: %{RebootPending}, %{WindowsUpdate}, %{CBServicing}, %{CCMClientSDK},
%{PendFileRename}, %{PendComputerRename}.
=item B<--critical-status>
Set critical threshold for status (Default: '').
Can used special variables like: %{RebootPending}, %{CBServicing}, %{WindowsUpdate}, %{CCMClientSDK}.
Can used special variables like: %{RebootPending}, %{WindowsUpdate}, %{CBServicing}, %{CCMClientSDK},
%{PendFileRename}, %{PendComputerRename}.
=back