mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-04-08 17:06:05 +02:00
enh(teams notification): Modify the URI build
Modify how the URI is build to avoid setting '&' in macros Refs: MON-155920
This commit is contained in:
parent
e1a8097161
commit
84f3a4a410
@ -42,11 +42,11 @@ sub new {
|
||||
|
||||
if (!defined($options{noptions})) {
|
||||
$options{options}->add_options(arguments => {
|
||||
'teams-workflow:s' => { name => 'teams_workflow' },
|
||||
'teams-workflow-params:s@' => { name => 'teams_workflow_params'},
|
||||
'port:s' => { name => 'port' },
|
||||
'proto:s' => { name => 'proto' },
|
||||
'timeout:s' => { name => 'timeout' }
|
||||
'teams-workflow:s' => { name => 'teams_workflow' },
|
||||
'teams-workflow-params:s' => { name => 'teams_workflow_params'},
|
||||
'port:s' => { name => 'port' },
|
||||
'proto:s' => { name => 'proto' },
|
||||
'timeout:s' => { name => 'timeout' }
|
||||
});
|
||||
}
|
||||
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
||||
@ -70,11 +70,11 @@ sub set_options {
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{teams_workflow} = (defined($self->{option_results}->{teams_workflow})) ? $self->{option_results}->{teams_workflow} : '';
|
||||
$self->{teams_workflow} = (defined($self->{option_results}->{teams_workflow})) ? $self->{option_results}->{teams_workflow} : '';
|
||||
$self->{teams_workflow_params} = (defined($self->{option_results}->{teams_workflow_params})) ? $self->{option_results}->{teams_workflow_params} : '';
|
||||
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
|
||||
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
|
||||
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;
|
||||
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
|
||||
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
|
||||
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;
|
||||
|
||||
if ($self->{teams_workflow} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify the --teams-workflow option.');
|
||||
@ -114,7 +114,7 @@ sub teams_post_notification {
|
||||
|
||||
my $encoded_data = JSON::XS->new->utf8->encode($options{json_request});
|
||||
my $full_url = $self->{teams_workflow} . '?';
|
||||
foreach (@{$self->{teams_workflow_params}}) {
|
||||
foreach (split(/,/, $self->{teams_workflow_params})) {
|
||||
$full_url .= $_ . '&';
|
||||
}
|
||||
|
||||
@ -150,7 +150,9 @@ Define the Workflow URL (required).
|
||||
|
||||
=item B<--teams-workflow-params>
|
||||
|
||||
Define the Workflow URL parameters (required).
|
||||
Define the Workflow URL parameters separated by commas (required).
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=notification::microsoft::office365::teams::plugin --mode=alert --custommode=workflowapi --teams-workflow='https://url.logic.azure.com:443/workflows/workflowId/triggers/manual/paths/invoke' --teams-workflow-params='api-version=2023-11-01,sp=%2Ftriggers%2Fmanual%2Frunsv=1.0,sig=sigId'
|
||||
|
||||
=item B<--port>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user