annotate doc/connect_with_mon/bottledash.alert @ 29:140c9023df7a

added important default servers
author sean
date Fri, 14 Aug 2015 15:32:57 +0200
parents 7d431b779512
children a43fa30655e9
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 #
29
140c9023df7a added important default servers
sean
parents: 24
diff changeset
23 # the argument passed to the script should be the service-name in the
140c9023df7a added important default servers
sean
parents: 24
diff changeset
24 # dash.conf from the bottledash-configuration
11
7a573ec679a6 added more files, can now display charts a bit
sean
parents:
diff changeset
25
24
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
26 #!/usr/bin/perl
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
27 use LWP::UserAgent;
11
7a573ec679a6 added more files, can now display charts a bit
sean
parents:
diff changeset
28 use Getopt::Std;
7a573ec679a6 added more files, can now display charts a bit
sean
parents:
diff changeset
29
24
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
30 getopts ("S:s:g:h:t:l:f:u");
11
7a573ec679a6 added more files, can now display charts a bit
sean
parents:
diff changeset
31
7a573ec679a6 added more files, can now display charts a bit
sean
parents:
diff changeset
32 $ALERT = $opt_u ? "UPALERT" : "ALERT";
29
140c9023df7a added important default servers
sean
parents: 24
diff changeset
33 $SERVICE = @ARGV;
11
7a573ec679a6 added more files, can now display charts a bit
sean
parents:
diff changeset
34
24
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
35 my $server_endpoint = "http://localhost:8000/updown";
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
36 my $ua = LWP::UserAgent->new;
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
37 my $req = HTTP::Request->new(POST => $server_endpoint);
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
38 $req->header('content-type' => 'x-www-form-urlencoded');
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
39 my $post_data = "service=$SERVICE&status=$ALERT";
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
40 $req->content($post_data);
7d431b779512 working connection with MON
sean
parents: 11
diff changeset
41 my $resp = $ua->request($req);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)