wip: add an option to display powershell
This commit is contained in:
parent
f023213020
commit
7315fe1dda
|
@ -31,30 +31,31 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -79,29 +80,45 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::activesyncmailbox::check($self, stdout => $stdout, mailbox => $self->{option_results}->{mailbox});
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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.
|
||||
|
@ -177,4 +198,4 @@ By default, SSL certificate validy is not checked.
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -31,36 +31,37 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning_mapi', 'critical_mapi', 'warning_mailflow', 'critical_mailflow', 'warning_copystatus', 'critical_copystatus')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -77,30 +78,47 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::databases::check($self, stdout => $stdout);
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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).
|
||||
|
@ -204,4 +226,4 @@ Can used special variables like: %{copystatus_indexstate}, %{database}, %{server
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -31,21 +31,22 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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', },
|
||||
'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;
|
||||
|
@ -53,7 +54,7 @@ sub new {
|
|||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -78,29 +79,44 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::imapmailbox::check($self, stdout => $stdout, mailbox => $self->{option_results}->{mailbox});
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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.
|
||||
|
|
|
@ -31,20 +31,20 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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.
|
||||
|
@ -156,4 +162,4 @@ Filter database (only wilcard '*' can be used. In Powershell).
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -31,28 +31,29 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -73,28 +74,43 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::mapimailbox::check($self, stdout => $stdout, mailbox => $self->{option_results}->{mailbox});
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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.
|
||||
|
@ -162,4 +182,4 @@ Set the mailbox to check (Required).
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -31,21 +31,22 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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 => '%{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;
|
||||
|
@ -53,7 +54,7 @@ sub new {
|
|||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -74,29 +75,44 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::outlookwebservices::check($self, stdout => $stdout, mailbox => $self->{option_results}->{mailbox});
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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.
|
||||
|
|
|
@ -31,31 +31,32 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -84,30 +85,46 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::owamailbox::check($self, stdout => $stdout, mailbox => $self->{option_results}->{mailbox});
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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.
|
||||
|
@ -187,4 +208,4 @@ By default, SSL certificate validy is not checked.
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -31,27 +31,28 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -68,27 +69,42 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::queues::check($self, stdout => $stdout);
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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.
|
||||
|
|
|
@ -31,27 +31,28 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -68,27 +69,42 @@ 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();
|
||||
}
|
||||
centreon::common::powershell::exchange::2010::replicationhealth::check($self, stdout => $stdout);
|
||||
|
||||
|
||||
$self->{output}->display();
|
||||
$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.
|
||||
|
@ -152,4 +172,4 @@ Can used special variables like: %{result}, %{server}, %{isvalid}, %{check}
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -31,27 +31,28 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
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;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
foreach (('warning', 'critical')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{data}->{$1}/g;
|
||||
|
@ -68,22 +69,37 @@ 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.
|
||||
|
@ -152,4 +172,4 @@ Can used special variables like: %{servicesrunning}, %{servicesnotrunning}, %{ro
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -27,14 +27,10 @@ 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 .= '
|
||||
try {
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
@ -56,7 +52,7 @@ Foreach ($result in $results) {
|
|||
exit 0
|
||||
';
|
||||
|
||||
return centreon::plugins::misc::powershell_encoded($ps);
|
||||
return $ps;
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -65,9 +61,11 @@ 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});
|
||||
while ($options{stdout} =~ /\[scenario=(.*?)\]\[result=(.*?)\]\[latency=(.*?)\]\[\[error=(.*?)\]\]/msg) {
|
||||
|
@ -120,4 +118,4 @@ __END__
|
|||
|
||||
Method to check Exchange 2010 activesync on a specific mailbox.
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -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 {
|
||||
|
@ -312,4 +309,4 @@ __END__
|
|||
|
||||
Method to check Exchange 2010 databases.
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
@ -110,4 +106,4 @@ __END__
|
|||
|
||||
Method to list Exchange 2010 databases.
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -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 {
|
||||
|
@ -104,4 +100,4 @@ __END__
|
|||
|
||||
Method to check Exchange 2010 mapi connection on a specific mailbox.
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
@ -120,4 +116,4 @@ __END__
|
|||
|
||||
Method to check Exchange 2010 owa connection on a specific mailbox.
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -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"
|
||||
|
@ -125,4 +121,4 @@ __END__
|
|||
|
||||
Powershell commands
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
@ -110,4 +106,4 @@ __END__
|
|||
|
||||
Method to check Exchange 2010 services running or not running.
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
|
@ -25,7 +25,7 @@ use warnings;
|
|||
|
||||
sub escape_jsonstring {
|
||||
my (%options) = @_;
|
||||
|
||||
|
||||
my $ps = q{
|
||||
function Escape-JSONString($str) {
|
||||
if ($str -eq $null) {return ""}
|
||||
|
|
|
@ -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__
|
||||
|
||||
|
|
Loading…
Reference in New Issue