+ fix netdom activedirectory mode (Fix #65)

This commit is contained in:
garnier-quentin 2015-06-04 14:54:07 +02:00
parent abe5c4dd8d
commit c294d6c18d

View File

@ -40,6 +40,7 @@ use base qw(centreon::plugins::mode);
use strict; use strict;
use warnings; use warnings;
use centreon::plugins::misc; use centreon::plugins::misc;
use Win32;
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
@ -50,7 +51,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"domain:s" => { name => 'domain', }, "domain:s" => { name => 'domain', },
"workstation:s" => { name => 'workstation', default => '%COMPUTERNAME%' }, "workstation:s" => { name => 'workstation' },
"timeout:s" => { name => 'timeout', default => 30 }, "timeout:s" => { name => 'timeout', default => 30 },
}); });
@ -67,7 +68,11 @@ sub netdom {
my $netdom_cmd = 'netdom verify '; my $netdom_cmd = 'netdom verify ';
$netdom_cmd .= ' /Domain:' . $self->{option_results}->{domain} if (defined($self->{option_results}->{domain}) && $self->{option_results}->{domain} ne ''); $netdom_cmd .= ' /Domain:' . $self->{option_results}->{domain} if (defined($self->{option_results}->{domain}) && $self->{option_results}->{domain} ne '');
$netdom_cmd .= ' ' . $self->{option_results}->{workstation}; if (defined($self->{option_results}->{workstation})) {
$netdom_cmd .= ' ' . . $self->{option_results}->{workstation};
} else {
$netdom_cmd .= ' ' . . Win32::NodeName();
}
my ($stdout, $exit_code) = centreon::plugins::misc::windows_execute(output => $self->{output}, my ($stdout, $exit_code) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout}, timeout => $self->{option_results}->{timeout},