Category: Monitoring

Sending Pushover notifications via PERL

April 23, 2018 by richardvk

Filed under Monitoring

Last modified April 23, 2018

#!/usr/bin/perl use strict; use LWP::UserAgent; my $s = scalar(@ARGV); exit if ($s!=2); my ($message, $recipient_list) = @ARGV; my @recipients = split(‘,’,$recipient_list); foreach my $recipient(@recipients) { _send_msg($message, $recipient); } sub _send_msg($message, $recipient) { my ($m, $r) = @_; print “Sending: ‘$m’, $r\n”; LWP::UserAgent->new()->post( “https://api.pushover.net/1/messages.json”, [ “token” => “<your_token>”, “user” => $r, “message” => $m ]); }