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