diff --git a/centreon-plugins/apps/protocols/http/mode/jsoncontent.pm b/centreon-plugins/apps/protocols/http/mode/jsoncontent.pm index 6c2166ded..a87e14d50 100644 --- a/centreon-plugins/apps/protocols/http/mode/jsoncontent.pm +++ b/centreon-plugins/apps/protocols/http/mode/jsoncontent.pm @@ -64,10 +64,10 @@ sub new { "username:s" => { name => 'username' }, "password:s" => { name => 'password' }, "proxyurl:s" => { name => 'proxyurl' }, - "expected-string:s" => { name => 'expected_string' }, "header:s@" => { name => 'header' }, + "get-param:s@" => { name => 'get_param' }, "timeout:s" => { name => 'timeout', default => 10 }, - "ssl:s" => { name => 'ssl', }, + "ssl:s" => { name => 'ssl', }, "warning-numeric:s" => { name => 'warning_numeric' }, "critical-numeric:s" => { name => 'critical_numeric' }, @@ -137,6 +137,23 @@ sub check_options { } } } + $self->{get_params} = {}; + if (defined($self->{option_results}->{get_param})) { + foreach (@{$self->{option_results}->{get_param}}) { + if (/^([^=]+)={0,1}(.*)$/) { + my $key = $1; + my $value = defined($2) ? $2 : 1; + if (defined($self->{get_params}->{$key})) { + if (ref($self->{get_params}->{$key}) ne 'ARRAY') { + $self->{get_params}->{$key} = [ $self->{get_params}->{$key} ]; + } + push @{$self->{get_params}->{$key}}, $value; + } else { + $self->{get_params}->{$key} = $value; + } + } + } + } } sub load_request { @@ -261,7 +278,8 @@ sub run { $self->load_request(); my $timing0 = [gettimeofday]; - $self->{json_response} = centreon::plugins::httplib::connect($self, headers => $self->{headers}, method => $self->{method}, query_form_post => $self->{json_request}); + $self->{json_response} = centreon::plugins::httplib::connect($self, headers => $self->{headers}, method => $self->{method}, + query_form_get => $self->{get_params}, query_form_post => $self->{json_request}); my $timeelapsed = tv_interval ($timing0, [gettimeofday]); $self->{output}->output_add(long_msg => $self->{json_response}); @@ -424,9 +442,13 @@ Threshold for HTTP timeout (Default: 10) Specify SSL version (example : 'sslv3', 'tlsv1'...) +=item B<--get-param> + +Set GET params (Multiple option. Example: --get-param='key=value') + =item B<--header> -Set HTTP headers (Multiple option) +Set HTTP headers (Multiple option. Example: --header='Content-Type: xxxxx') =back diff --git a/centreon-plugins/apps/protocols/http/mode/soapcontent.pm b/centreon-plugins/apps/protocols/http/mode/soapcontent.pm index d0a8342d9..9c3d93654 100644 --- a/centreon-plugins/apps/protocols/http/mode/soapcontent.pm +++ b/centreon-plugins/apps/protocols/http/mode/soapcontent.pm @@ -64,10 +64,9 @@ sub new { "username:s" => { name => 'username' }, "password:s" => { name => 'password' }, "proxyurl:s" => { name => 'proxyurl' }, - "expected-string:s" => { name => 'expected_string' }, "header:s@" => { name => 'header' }, "timeout:s" => { name => 'timeout', default => 10 }, - "ssl:s" => { name => 'ssl', }, + "ssl:s" => { name => 'ssl', }, "warning-numeric:s" => { name => 'warning_numeric' }, "critical-numeric:s" => { name => 'critical_numeric' }, diff --git a/centreon-plugins/centreon/common/smcli/mode/healthstatus.pm b/centreon-plugins/centreon/common/smcli/mode/healthstatus.pm index c0d8897e5..dc41f4b91 100644 --- a/centreon-plugins/centreon/common/smcli/mode/healthstatus.pm +++ b/centreon-plugins/centreon/common/smcli/mode/healthstatus.pm @@ -63,7 +63,7 @@ sub run { my ($self, %options) = @_; my $smcli = $options{custom}; - my $response = $smcli->execute_command(cmd => $self->{option_results}->{storage_command}); + my $response = $smcli->execute_command(cmd => $self->{option_results}->{storage_command}); # IBM smcli: Storage Subsystem health status = optimal. # Dell smcli: Storage array health status = optimal.