Mercurial > bottledash > bottledash
comparison doc/connect_with_mon/bottledash.alert @ 32:a957a56bb694
release zur abgabe
author | sean |
---|---|
date | Sun, 23 Aug 2015 21:52:33 +0200 |
parents | a43fa30655e9 |
children |
comparison
equal
deleted
inserted
replaced
31:a43fa30655e9 | 32:a957a56bb694 |
---|---|
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 # | 22 # |
23 # the argument passed to the script should be the service-name in the | 23 # the argument passed to the script should be the service-name in the |
24 # dash.conf from the bottledash-configuration | 24 # dash.conf from the bottledash-configuration |
25 | 25 |
26 #!/usr/bin/perl | |
27 use LWP::UserAgent; | 26 use LWP::UserAgent; |
28 use Getopt::Std; | 27 use Getopt::Std; |
29 | 28 |
30 getopts ("S:s:g:h:t:l:f:u"); | 29 getopts ("S:s:g:h:t:l:f:u"); |
31 | 30 |
32 $ALERT = $opt_u ? "UPALERT" : "ALERT"; | 31 $ALERT = $opt_u ? "UPALERT" : "ALERT"; |
33 | 32 |
34 my $server_endpoint = "http://localhost:8000/updown"; | 33 my $server_endpoint = "http://localhost:8080/updown"; |
35 my $ua = LWP::UserAgent->new; | 34 my $ua = LWP::UserAgent->new; |
36 my $req = HTTP::Request->new(POST => $server_endpoint); | 35 my $req = HTTP::Request->new(POST => $server_endpoint); |
37 $req->header('content-type' => 'x-www-form-urlencoded'); | 36 $req->header('content-type' => 'x-www-form-urlencoded'); |
38 my $post_data = "service=@ARGV&status=$ALERT"; | 37 my $post_data = "service=@ARGV&status=$ALERT"; |
39 $req->content($post_data); | 38 $req->content($post_data); |