perllwp-useragentpushover

"Invalid Argument" Message when sending post for Pushover API


we're currently using pushover, to send messages to our Servicedesk, when our Monitoring finds Errors within our systems.

Our system collects the data, creates a message, and then sends the needed arguments to a perl script:

use LWP::UserAgent;
use Getopt::Std;

my %opts=();

my $curPath=$ENV{PATH};
$ENV{PATH} = $curPath.";Perl_Path";


getopts('t:u:m:p:', \%opts) or abort("No options given\n"); 

if (defined $opts{t}) {
  $APP_TOKEN=$opts{t};
}
if (defined $opts{u}) {
  $USER_KEY=$opts{u};
}
if (defined $opts{m}) {
  $MESSAGE=$opts{m};
}
if (defined $opts{p}) {
  $PRIO=$opts{p};
}

my $ua=LWP::UserAgent->new(timeout => 10);
my $response = $ua->post( 
  "https://api.pushover.net/1/messages.json", [
  "token" => "$APP_TOKEN",
  "user" => "$USER_KEY",
  "message" => "$MESSAGE",
  "priority" => "$PRIO"
]);

if ($response->is_success) {
    print $response->decoded_content;
}
else {
    die "HERE: ".$response->status_line;
}

This seemingly worked fine until yesterday when our servicedesk noticed, that no message were send anymore.

By executing the script with a dummy message, I reveive the following Error Message after the script dies:

Here: 500 can't connect to api.pushover.net:443 <invalid argument>

I have tried contacting pushover, but they have not been quite as helpful as I hoped they would be. As we didnt change anything about the way we send those messages, I presume something pushover did caused this problem.

Does anybody know why LWP::Useragent might send "invalid Argument" messages? Since I can't seem to find a lot of information online. We did open our firewalls for 2 IPs to be accessed for this, but replacing the hostname with those IP Addresses instead brought up the following Error:

Here: 500 can't connect to api.pushover.net:443 <Bad File Descriptor>

Edit: We are using a strawberry perl Installation for Windows

I kindly ask for advice on a fix for this problem. Thank you in advance.


Solution

  • IT seems that Pushover migrated their API to different IP addresses in order to counteract a DDoS attack on it.

    Since our firewall was only configured to allow traffic to the old addresses, our System was unable to send messages to the IP.

    Why LWP::Useragent flagged this as "invalid arguments" is currently beyond me, but the problem at hand is currently solved.