annotate doc/connect_with_mon/bottledash.alert @ 24:7d431b779512

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