diff --git a/nagios.pl b/nagios.pl index 6c8a13f..94578d9 100644 --- a/nagios.pl +++ b/nagios.pl @@ -72,8 +72,10 @@ # my %opt_fields; -GetOptions("field=s%" => \%opt_fields); +my $opt_proxy; +GetOptions("field=s%" => \%opt_fields, "proxy=s" => \$opt_proxy); +print STDERR $opt_proxy; # # DO THINGS @@ -100,6 +102,9 @@ my $ua = LWP::UserAgent->new; $ua->timeout(15); +# set proxy +$ua->proxy (['http', 'https'], $opt_proxy) if (defined($opt_proxy)); + my $req = POST("https://${opt_domain}/services/hooks/nagios?token=${opt_token}", \%event); my $s = $req->as_string;