+ Ref #634 : add proxy options
This commit is contained in:
parent
ad92ba94ef
commit
0b84ff6b12
|
@ -26,7 +26,6 @@ use strict;
|
|||
use warnings;
|
||||
use centreon::plugins::http;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
@ -39,6 +38,8 @@ sub new {
|
|||
"hostname:s" => { name => 'hostname' },
|
||||
"port:s" => { name => 'port', default => 443 },
|
||||
"proto:s" => { name => 'proto', default => 'https' },
|
||||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
"proxypac:s" => { name => 'proxypac' },
|
||||
"username:s" => { name => 'username' },
|
||||
"password:s" => { name => 'password' },
|
||||
"phonenumber:s" => { name => 'phonenumber' },
|
||||
|
@ -56,7 +57,6 @@ sub check_options {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
|
||||
if ((!defined($self->{option_results}->{username}) && !defined($self->{option_results}->{password}))) {
|
||||
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= option");
|
||||
$self->{output}->option_exit();
|
||||
|
@ -78,7 +78,6 @@ sub check_options {
|
|||
}
|
||||
|
||||
$self->{http}->set_options(%{$self->{option_results}});
|
||||
|
||||
}
|
||||
|
||||
sub run {
|
||||
|
@ -94,7 +93,7 @@ sub run {
|
|||
sender="$self->{option_results}->{sender}"
|
||||
>
|
||||
<message>
|
||||
<text>$self->{option_results}->{message}</text>
|
||||
<text><![CDATA[$self->{option_results}->{message}]]></text>
|
||||
<to>$self->{option_results}->{phonenumber}</to>
|
||||
</message>
|
||||
</push>
|
||||
|
@ -108,10 +107,8 @@ END_MESSAGE
|
|||
$self->{output}->output_add(short_msg => 'push_id : ' . $response);
|
||||
$self->{output}->display(force_ignore_perfdata => 1);
|
||||
$self->{output}->exit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
@ -134,6 +131,14 @@ Port used by HighSMS API. (Default: 443)
|
|||
|
||||
Specify http or https protocol. (Default: https)
|
||||
|
||||
=item B<--proxyurl>
|
||||
|
||||
Proxy URL
|
||||
|
||||
=item B<--proxypac>
|
||||
|
||||
Proxy pac file (can be an url or local file)
|
||||
|
||||
=item B<--username>
|
||||
|
||||
Specify username for API authentification.
|
||||
|
|
Loading…
Reference in New Issue