wip: add an option to display powershell

This commit is contained in:
garnier-quentin 2020-01-27 11:07:46 +01:00
parent f023213020
commit 7315fe1dda
23 changed files with 568 additions and 420 deletions

View File

@ -32,23 +32,24 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{result} !~ /Success/i' },
"mailbox:s" => { name => 'mailbox', },
"password:s" => { name => 'password', },
"no-trust-ssl" => { name => 'no_trust_ssl', },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical', default => '%{result} !~ /Success/i' },
'mailbox:s' => { name => 'mailbox' },
'password:s' => { name => 'password' },
'no-trust-ssl' => { name => 'no_trust_ssl' },
});
return $self;
}
@ -80,23 +81,39 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::activesyncmailbox::get_powershell(remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password},
no_ps => $self->{option_results}->{no_ps},
no_trust_ssl => $self->{option_results}->{no_trust_ssl}
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::activesyncmailbox::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password},
no_trust_ssl => $self->{option_results}->{no_trust_ssl}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -149,6 +166,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -32,29 +32,30 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"no-mailflow" => { name => 'no_mailflow', },
"no-mapi" => { name => 'no_mapi', },
"no-copystatus" => { name => 'no_copystatus', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"ps-database-filter:s" => { name => 'ps_database_filter', },
"ps-database-test-filter:s" => { name => 'ps_database_test_filter', },
"warning-mapi:s" => { name => 'warning_mapi', },
"critical-mapi:s" => { name => 'critical_mapi', default => '%{mapi_result} !~ /Success/i' },
"warning-mailflow:s" => { name => 'warning_mailflow', },
"critical-mailflow:s" => { name => 'critical_mailflow', default => '%{mailflow_result} !~ /Success/i' },
"warning-copystatus:s" => { name => 'warning_copystatus', },
"critical-copystatus:s" => { name => 'critical_copystatus', default => '%{copystatus_indexstate} !~ /Healthy/i' },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'no-mailflow' => { name => 'no_mailflow' },
'no-mapi' => { name => 'no_mapi' },
'no-copystatus' => { name => 'no_copystatus' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'ps-database-filter:s' => { name => 'ps_database_filter' },
'ps-database-test-filter:s' => { name => 'ps_database_test_filter' },
'warning-mapi:s' => { name => 'warning_mapi' },
'critical-mapi:s' => { name => 'critical_mapi', default => '%{mapi_result} !~ /Success/i' },
'warning-mailflow:s' => { name => 'warning_mailflow' },
'critical-mailflow:s' => { name => 'critical_mailflow', default => '%{mailflow_result} !~ /Success/i' },
'warning-copystatus:s' => { name => 'warning_copystatus' },
'critical-copystatus:s' => { name => 'critical_copystatus', default => '%{copystatus_indexstate} !~ /Healthy/i' },
});
return $self;
}
@ -78,24 +79,41 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::databases::get_powershell(remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_mailflow => $self->{option_results}->{no_mailflow},
no_ps => $self->{option_results}->{no_ps},
no_mapi => $self->{option_results}->{no_mapi},
no_copystatus => $self->{option_results}->{no_copystatus},
filter_database => $self->{option_results}->{ps_database_filter},
filter_database_test => $self->{option_results}->{ps_database_test_filter});
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::databases::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_mailflow => $self->{option_results}->{no_mailflow},
no_mapi => $self->{option_results}->{no_mapi},
no_copystatus => $self->{option_results}->{no_copystatus},
filter_database => $self->{option_results}->{ps_database_filter},
filter_database_test => $self->{option_results}->{ps_database_test_filter}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -164,6 +182,10 @@ Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
Print powershell output.
=item B<--ps-display>
Display powershell script.
=item B<--ps-database-filter>
Filter database (only wilcard '*' can be used. In Powershell).

View File

@ -33,19 +33,20 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{result} !~ /Success/i' },
"mailbox:s" => { name => 'mailbox', },
"password:s" => { name => 'password', },
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical', default => '%{result} !~ /Success/i' },
'mailbox:s' => { name => 'mailbox' },
'password:s' => { name => 'password' },
});
return $self;
@ -79,23 +80,38 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::imapmailbox::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password},
no_ps => $self->{option_results}->{no_ps},
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::imapmailbox::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -148,6 +164,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -32,19 +32,19 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"ps-database-filter:s" => { name => 'ps_database_filter', },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-database-filter:s' => { name => 'ps_database_filter' },
});
return $self;
}
@ -56,11 +56,13 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::listdatabases::get_powershell(remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_ps => $self->{option_results}->{no_ps},
filter_database => $self->{option_results}->{ps_database_filter});
my $ps = centreon::common::powershell::exchange::2010::listdatabases::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_ps => $self->{option_results}->{no_ps},
filter_database => $self->{option_results}->{ps_database_filter}
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
@ -146,6 +148,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -32,21 +32,22 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{result} !~ /Success/i' },
"mailbox:s" => { name => 'mailbox', },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical', default => '%{result} !~ /Success/i' },
'mailbox:s' => { name => 'mailbox' },
});
return $self;
}
@ -74,22 +75,37 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::mapimailbox::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
mailbox => $self->{option_results}->{mailbox},
no_ps => $self->{option_results}->{no_ps},
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::mapimailbox::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
mailbox => $self->{option_results}->{mailbox}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -142,6 +158,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -33,19 +33,20 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{type} !~ /Success|Information/i' },
"mailbox:s" => { name => 'mailbox', },
"password:s" => { name => 'password', },
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning', },
'critical:s' => { name => 'critical', default => '%{type} !~ /Success|Information/i' },
'mailbox:s' => { name => 'mailbox' },
'password:s' => { name => 'password' },
});
return $self;
@ -75,23 +76,38 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::outlookwebservices::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_ps => $self->{option_results}->{no_ps},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password},
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::outlookwebservices::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -144,6 +160,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -32,24 +32,25 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{result} !~ /Success/i' },
"url:s" => { name => 'url', },
"mailbox:s" => { name => 'mailbox', },
"password:s" => { name => 'password', },
"no-trust-ssl" => { name => 'no_trust_ssl', },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical', default => '%{result} !~ /Success/i' },
'url:s' => { name => 'url' },
'mailbox:s' => { name => 'mailbox' },
'password:s' => { name => 'password' },
'no-trust-ssl' => { name => 'no_trust_ssl' },
});
return $self;
}
@ -85,24 +86,40 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::owamailbox::get_powershell(remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
url => $self->{option_results}->{url},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password},
no_ps => $self->{option_results}->{no_ps},
no_trust_ssl => $self->{option_results}->{no_trust_ssl}
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::owamailbox::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
url => $self->{option_results}->{url},
mailbox => $self->{option_results}->{mailbox},
password => $self->{option_results}->{password},
no_trust_ssl => $self->{option_results}->{no_trust_ssl}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -155,6 +172,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -32,20 +32,21 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{status} !~ /Ready|Active/i' },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical', default => '%{status} !~ /Ready|Active/i' },
});
return $self;
}
@ -69,21 +70,36 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::queues::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_ps => $self->{option_results}->{no_ps},
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::queues::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -136,6 +152,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -32,20 +32,21 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{result} !~ /Passed/i' },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host', },
'remote-user:s' => { name => 'remote_user', },
'remote-password:s' => { name => 'remote_password', },
'no-ps' => { name => 'no_ps', },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only', },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning', },
'critical:s' => { name => 'critical', default => '%{result} !~ /Passed/i' },
});
return $self;
}
@ -69,21 +70,36 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::replicationhealth::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_ps => $self->{option_results}->{no_ps},
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::replicationhealth::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -136,6 +152,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -32,20 +32,21 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"remote-host:s" => { name => 'remote_host', },
"remote-user:s" => { name => 'remote_user', },
"remote-password:s" => { name => 'remote_password', },
"no-ps" => { name => 'no_ps', },
"timeout:s" => { name => 'timeout', default => 50 },
"command:s" => { name => 'command', default => 'powershell.exe' },
"command-path:s" => { name => 'command_path' },
"command-options:s" => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
"ps-exec-only" => { name => 'ps_exec_only', },
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', default => '%{requiredservicesrunning} =~ /True/i and %{servicesnotrunning} ne ""' },
});
$options{options}->add_options(arguments => {
'remote-host:s' => { name => 'remote_host' },
'remote-user:s' => { name => 'remote_user' },
'remote-password:s' => { name => 'remote_password' },
'no-ps' => { name => 'no_ps' },
'timeout:s' => { name => 'timeout', default => 50 },
'command:s' => { name => 'command', default => 'powershell.exe' },
'command-path:s' => { name => 'command_path' },
'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },
'ps-exec-only' => { name => 'ps_exec_only' },
'ps-display' => { name => 'ps_display' },
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical', default => '%{requiredservicesrunning} =~ /True/i and %{servicesnotrunning} ne ""' },
});
return $self;
}
@ -69,21 +70,36 @@ sub check_options {
sub run {
my ($self, %options) = @_;
my $ps = centreon::common::powershell::exchange::2010::services::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password},
no_ps => $self->{option_results}->{no_ps},
);
$self->{option_results}->{command_options} .= " " . $ps;
my ($stdout) = centreon::plugins::misc::windows_execute(output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options});
if (!defined($self->{option_results}->{no_ps})) {
my $ps = centreon::common::powershell::exchange::2010::services::get_powershell(
remote_host => $self->{option_results}->{remote_host},
remote_user => $self->{option_results}->{remote_user},
remote_password => $self->{option_results}->{remote_password}
);
if (defined($self->{option_results}->{ps_display})) {
$self->{output}->output_add(
severity => 'OK',
short_msg => $ps
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
$self->{option_results}->{command_options} .= " " . centreon::plugins::misc::powershell_encoded($ps);
}
my ($stdout) = centreon::plugins::misc::windows_execute(
output => $self->{output},
timeout => $self->{option_results}->{timeout},
command => $self->{option_results}->{command},
command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}
);
if (defined($self->{option_results}->{ps_exec_only})) {
$self->{output}->output_add(severity => 'OK',
short_msg => $stdout);
$self->{output}->output_add(
severity => 'OK',
short_msg => $stdout
);
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
@ -136,6 +152,10 @@ Command path (Default: none).
Command options (Default: '-InputFormat none -NoLogo -EncodedCommand').
=item B<--ps-display>
Display powershell script.
=item B<--ps-exec-only>
Print powershell output.

View File

@ -27,12 +27,8 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
my $no_trust_ssl = (defined($options{no_trust_ssl})) ? '' : '-TrustAnySSLCertificate';
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
$ps .= '
@ -56,7 +52,7 @@ Foreach ($result in $results) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {
@ -65,8 +61,10 @@ sub check {
# Following output:
#[scenario= Options ][result= Failure ][latency= 52,00 ][[error=...]]
$self->{output}->output_add(severity => 'OK',
short_msg => "ActiveSync to '" . $options{mailbox} . "' is ok.");
$self->{output}->output_add(
severity => 'OK',
short_msg => "ActiveSync to '" . $options{mailbox} . "' is ok."
);
my $checked = 0;
$self->{output}->output_add(long_msg => $options{stdout});

View File

@ -27,14 +27,11 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps, no_mailflow, no_mapi
# options: no_mailflow, no_mapi
my $no_mailflow = (defined($options{no_mailflow})) ? 1 : 0;
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
my $no_mapi = (defined($options{no_mapi})) ? 1 : 0;
my $no_copystatus = (defined($options{no_copystatus})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
$ps .= '
@ -108,7 +105,7 @@ Foreach ($DB in $MountedDB) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check_mapi {

View File

@ -27,10 +27,6 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
@ -55,7 +51,7 @@ Foreach ($result in $results) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {

View File

@ -27,10 +27,6 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps, no_mailflow, no_mapi
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
@ -65,7 +61,7 @@ Foreach ($DB in $MountedDB) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub list {

View File

@ -27,10 +27,6 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
@ -48,7 +44,7 @@ Write-Host "[name=" $mapi.Database "][server=" $mapi.Server "][result=" $mapi.Re
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {

View File

@ -27,10 +27,6 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
@ -64,7 +60,7 @@ Foreach ($result in $results) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {

View File

@ -27,12 +27,8 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
my $no_trust_ssl = (defined($options{no_trust_ssl})) ? '' : '-TrustAnySSLCertificate';
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
$ps .= '
@ -56,7 +52,7 @@ Foreach ($result in $results) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {

View File

@ -28,10 +28,6 @@ use centreon::plugins::misc;
#--remote-host --remote-user --remote-password
sub powershell_init {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = '
$culture = new-object "System.Globalization.CultureInfo" "en-us"

View File

@ -27,10 +27,6 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
@ -49,7 +45,7 @@ Foreach ($result in $results) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {

View File

@ -27,10 +27,6 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
@ -49,7 +45,7 @@ Foreach ($result in $results) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {

View File

@ -27,10 +27,6 @@ use centreon::common::powershell::exchange::2010::powershell;
sub get_powershell {
my (%options) = @_;
# options: no_ps
my $no_ps = (defined($options{no_ps})) ? 1 : 0;
return '' if ($no_ps == 1);
my $ps = centreon::common::powershell::exchange::2010::powershell::powershell_init(%options);
@ -51,7 +47,7 @@ Foreach ($result in $results) {
exit 0
';
return centreon::plugins::misc::powershell_encoded($ps);
return $ps;
}
sub check {

View File

@ -316,14 +316,10 @@ sub trim {
}
sub powershell_encoded {
my ($value) = $_[0];
require Encode;
require MIME::Base64;
my $bytes = Encode::encode('utf16LE', $value);
my $script = MIME::Base64::encode_base64($bytes, "\n");
$script =~ s/\n//g;
return $script;
my $bytes = Encode::encode('utf16LE', $_[0]);
return MIME::Base64::encode_base64($bytes, '');
}
sub powershell_escape {
@ -338,8 +334,10 @@ sub powershell_escape {
sub powershell_json_sanitizer {
my (%options) = @_;
centreon::plugins::misc::mymodule_load(output => $options{output}, module => 'JSON::XS',
error_msg => "Cannot load module 'JSON::XS'.");
centreon::plugins::misc::mymodule_load(
output => $options{output}, module => 'JSON::XS',
error_msg => "Cannot load module 'JSON::XS'."
);
foreach my $line (split /\n/, $options{string}) {
eval { JSON::XS->new->utf8->decode($line) };
return $line if (!$@);
@ -522,8 +520,10 @@ sub set_timezone {
return {} if (!defined($options{name}) || $options{name} eq '');
centreon::plugins::misc::mymodule_load(output => $options{output}, module => 'DateTime::TimeZone',
error_msg => "Cannot load module 'DateTime::TimeZone'.");
centreon::plugins::misc::mymodule_load(
output => $options{output}, module => 'DateTime::TimeZone',
error_msg => "Cannot load module 'DateTime::TimeZone'."
);
if (DateTime::TimeZone->is_valid_name($options{name})) {
return { time_zone => DateTime::TimeZone->new(name => $options{name}) };
}
@ -545,4 +545,3 @@ sub uniq {
1;
__END__