sean@11: #!/usr/bin/perl sean@11: # sean@11: # sean@11: # Sean Engelhardt, sean.engelhardt@intevation.de sean@11: # sean@11: # sean@11: # Copyright (C) 2015, Intevation sean@11: # sean@11: # This program is free software; you can redistribute it and/or modify sean@11: # it under the terms of the GNU General Public License as published by sean@11: # the Free Software Foundation; either version 2 of the License, or sean@11: # (at your option) any later version. sean@11: # sean@11: # This program is distributed in the hope that it will be useful, sean@11: # but WITHOUT ANY WARRANTY; without even the implied warranty of sean@11: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the sean@11: # GNU General Public License for more details. sean@11: # sean@11: # You should have received a copy of the GNU General Public License sean@11: # along with this program; if not, write to the Free Software sean@11: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA sean@11: # sean@11: sean@24: #!/usr/bin/perl sean@24: use LWP::UserAgent; sean@11: use Getopt::Std; sean@11: sean@24: getopts ("S:s:g:h:t:l:f:u"); sean@11: sean@11: $ALERT = $opt_u ? "UPALERT" : "ALERT"; sean@24: $SERVICE = $opt_g; sean@11: sean@24: my $server_endpoint = "http://localhost:8000/updown"; sean@24: my $ua = LWP::UserAgent->new; sean@24: my $req = HTTP::Request->new(POST => $server_endpoint); sean@24: $req->header('content-type' => 'x-www-form-urlencoded'); sean@24: my $post_data = "service=$SERVICE&status=$ALERT"; sean@24: $req->content($post_data); sean@24: my $resp = $ua->request($req);