mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 08:04:36 +02:00
+ Ref #634 : add proxy options
This commit is contained in:
parent
c48978ff56
commit
fdcd7d46f2
@ -26,7 +26,6 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::http;
|
use centreon::plugins::http;
|
||||||
use JSON;
|
use JSON;
|
||||||
use Data::Dumper;
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
@ -39,6 +38,8 @@ sub new {
|
|||||||
"hostname:s" => { name => 'hostname' },
|
"hostname:s" => { name => 'hostname' },
|
||||||
"port:s" => { name => 'port', default => 443 },
|
"port:s" => { name => 'port', default => 443 },
|
||||||
"proto:s" => { name => 'proto', default => 'https' },
|
"proto:s" => { name => 'proto', default => 'https' },
|
||||||
|
"proxyurl:s" => { name => 'proxyurl' },
|
||||||
|
"proxypac:s" => { name => 'proxypac' },
|
||||||
"username:s" => { name => 'username' },
|
"username:s" => { name => 'username' },
|
||||||
"password:s" => { name => 'password' },
|
"password:s" => { name => 'password' },
|
||||||
"phonenumber:s" => { name => 'phonenumber' },
|
"phonenumber:s" => { name => 'phonenumber' },
|
||||||
@ -56,7 +57,6 @@ sub check_options {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->SUPER::init(%options);
|
$self->SUPER::init(%options);
|
||||||
|
|
||||||
if ((!defined($self->{option_results}->{username}) && !defined($self->{option_results}->{password}))) {
|
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}->add_option_msg(short_msg => "You need to set --username= and --password= option");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -78,7 +78,6 @@ sub check_options {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$self->{http}->set_options(%{$self->{option_results}});
|
$self->{http}->set_options(%{$self->{option_results}});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
@ -94,7 +93,7 @@ sub run {
|
|||||||
sender="$self->{option_results}->{sender}"
|
sender="$self->{option_results}->{sender}"
|
||||||
>
|
>
|
||||||
<message>
|
<message>
|
||||||
<text>$self->{option_results}->{message}</text>
|
<text><![CDATA[$self->{option_results}->{message}]]></text>
|
||||||
<to>$self->{option_results}->{phonenumber}</to>
|
<to>$self->{option_results}->{phonenumber}</to>
|
||||||
</message>
|
</message>
|
||||||
</push>
|
</push>
|
||||||
@ -108,10 +107,8 @@ END_MESSAGE
|
|||||||
$self->{output}->output_add(short_msg => 'push_id : ' . $response);
|
$self->{output}->output_add(short_msg => 'push_id : ' . $response);
|
||||||
$self->{output}->display(force_ignore_perfdata => 1);
|
$self->{output}->display(force_ignore_perfdata => 1);
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
@ -134,6 +131,14 @@ Port used by HighSMS API. (Default: 443)
|
|||||||
|
|
||||||
Specify http or https protocol. (Default: https)
|
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>
|
=item B<--username>
|
||||||
|
|
||||||
Specify username for API authentification.
|
Specify username for API authentification.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user