+ 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
1 changed files with 7 additions and 2 deletions

View File

@ -40,6 +40,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::misc;
use Win32;
sub new {
my ($class, %options) = @_;
@ -50,7 +51,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"domain:s" => { name => 'domain', },
"workstation:s" => { name => 'workstation', default => '%COMPUTERNAME%' },
"workstation:s" => { name => 'workstation' },
"timeout:s" => { name => 'timeout', default => 30 },
});
@ -67,7 +68,11 @@ sub netdom {
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 .= ' ' . $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},
timeout => $self->{option_results}->{timeout},