mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
Fix #1599
This commit is contained in:
parent
71781cc540
commit
b6ba85a853
@ -34,18 +34,19 @@ sub new {
|
|||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'config:s' => { name => 'config' },
|
||||||
"config:s" => { name => 'config' },
|
'language:s' => { name => 'language', default => 'en' },
|
||||||
"language:s" => { name => 'language', default => 'en' },
|
'dfsr' => { name => 'dfsr' },
|
||||||
"dfsr" => { name => 'dfsr' },
|
'noeventlog' => { name => 'noeventlog' },
|
||||||
"noeventlog" => { name => 'noeventlog' },
|
'nomachineaccount' => { name => 'nomachineaccount' },
|
||||||
"nomachineaccount" => { name => 'nomachineaccount' },
|
'timeout:s' => { name => 'timeout', default => 30 },
|
||||||
"timeout:s" => { name => 'timeout', default => 30 },
|
});
|
||||||
});
|
|
||||||
$self->{os_is2003} = 0;
|
$self->{os_is2003} = 0;
|
||||||
$self->{os_is2008} = 0;
|
$self->{os_is2008} = 0;
|
||||||
$self->{os_is2012} = 0;
|
$self->{os_is2012} = 0;
|
||||||
|
$self->{os_is2016} = 0;
|
||||||
|
|
||||||
$self->{msg} = { global => undef, ok => undef, warning => undef, critical => undef };
|
$self->{msg} = { global => undef, ok => undef, warning => undef, critical => undef };
|
||||||
return $self;
|
return $self;
|
||||||
@ -71,12 +72,15 @@ sub check_version {
|
|||||||
# 5.1, 5.2 => XP/2003
|
# 5.1, 5.2 => XP/2003
|
||||||
# 6.0, 6.1 => Vista/7/2008
|
# 6.0, 6.1 => Vista/7/2008
|
||||||
# 6.2, 6.3 => 2012
|
# 6.2, 6.3 => 2012
|
||||||
|
# 10.0 => 2016, 2019
|
||||||
if ($ver_major == 5 && ($ver_minor == 1 || $ver_minor == 2)) {
|
if ($ver_major == 5 && ($ver_minor == 1 || $ver_minor == 2)) {
|
||||||
$self->{os_is2003} = 1;
|
$self->{os_is2003} = 1;
|
||||||
} elsif ($ver_major == 6 && ($ver_minor == 0 || $ver_minor == 1)) {
|
} elsif ($ver_major == 6 && ($ver_minor == 0 || $ver_minor == 1)) {
|
||||||
$self->{os_is2008} = 1;
|
$self->{os_is2008} = 1;
|
||||||
} elsif ($ver_major == 6 && ($ver_minor == 2 || $ver_minor == 3)) {
|
} elsif ($ver_major == 6 && ($ver_minor == 2 || $ver_minor == 3)) {
|
||||||
$self->{os_is2012} = 1;
|
$self->{os_is2012} = 1;
|
||||||
|
} elsif ($ver_major == 10 && $ver_minor == 0) {
|
||||||
|
$self->{os_is2016} = 1;
|
||||||
} else {
|
} else {
|
||||||
$self->{output}->output_add(severity => 'UNKNOWN',
|
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||||
short_msg => 'OS version ' . $ver_major . '.' . $ver_minor . ' not managed.');
|
short_msg => 'OS version ' . $ver_major . '.' . $ver_minor . ' not managed.');
|
||||||
@ -135,19 +139,21 @@ sub dcdiag {
|
|||||||
my $dcdiag_cmd = 'dcdiag /test:services /test:replications /test:advertising /test:fsmocheck /test:ridmanager';
|
my $dcdiag_cmd = 'dcdiag /test:services /test:replications /test:advertising /test:fsmocheck /test:ridmanager';
|
||||||
$dcdiag_cmd .= ' /test:machineaccount' if (!defined($self->{option_results}->{nomachineaccount}));
|
$dcdiag_cmd .= ' /test:machineaccount' if (!defined($self->{option_results}->{nomachineaccount}));
|
||||||
$dcdiag_cmd .= ' /test:frssysvol' if ($self->{os_is2003} == 1);
|
$dcdiag_cmd .= ' /test:frssysvol' if ($self->{os_is2003} == 1);
|
||||||
$dcdiag_cmd .= ' /test:sysvolcheck' if ($self->{os_is2008} == 1 || $self->{os_is2012} == 1);
|
$dcdiag_cmd .= ' /test:sysvolcheck' if ($self->{os_is2008} == 1 || $self->{os_is2012} == 1 || $self->{os_is2016} == 1);
|
||||||
|
|
||||||
if (!defined($self->{option_results}->{noeventlog})) {
|
if (!defined($self->{option_results}->{noeventlog})) {
|
||||||
$dcdiag_cmd .= ' /test:frsevent /test:kccevent' if ($self->{os_is2003} == 1);
|
$dcdiag_cmd .= ' /test:frsevent /test:kccevent' if ($self->{os_is2003} == 1);
|
||||||
$dcdiag_cmd .= ' /test:frsevent /test:kccevent' if (($self->{os_is2008} == 1 || $self->{os_is2012} == 1) && !defined($self->{option_results}->{dfsr}));
|
$dcdiag_cmd .= ' /test:frsevent /test:kccevent' if (($self->{os_is2008} == 1 || $self->{os_is2012} == 1 || $self->{os_is2016} == 1) && !defined($self->{option_results}->{dfsr}));
|
||||||
$dcdiag_cmd .= ' /test:dfsrevent /test:kccevent' if (($self->{os_is2008} == 1 || $self->{os_is2012} == 1) && defined($self->{option_results}->{dfsr}));
|
$dcdiag_cmd .= ' /test:dfsrevent /test:kccevent' if (($self->{os_is2008} == 1 || $self->{os_is2012} == 1 || $self->{os_is2016} == 1) && defined($self->{option_results}->{dfsr}));
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
|
my ($stdout) = centreon::plugins::misc::windows_execute(
|
||||||
timeout => $self->{option_results}->{timeout},
|
output => $self->{output},
|
||||||
command => $dcdiag_cmd,
|
timeout => $self->{option_results}->{timeout},
|
||||||
command_path => undef,
|
command => $dcdiag_cmd,
|
||||||
command_options => undef);
|
command_path => undef,
|
||||||
|
command_options => undef
|
||||||
|
);
|
||||||
|
|
||||||
my $match = 0;
|
my $match = 0;
|
||||||
while ($stdout =~ /$self->{msg}->{global}/imsg) {
|
while ($stdout =~ /$self->{msg}->{global}/imsg) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user