comparison doc/connect_with_mon/bottledash.alert @ 11:7a573ec679a6

added more files, can now display charts a bit
author sean
date Tue, 04 Aug 2015 14:23:53 +0200
parents
children 7d431b779512
comparison
equal deleted inserted replaced
10:d71f39618d6f 11:7a573ec679a6
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 #STD
25 use Getopt::Std;
26
27 #get LWP functionallity
28 use LWP::UserAgent;
29
30 #alert-status propbably? every Mon-alert uses that
31 getopts ("s:g:h:t:l:u");
32
33 #Creates a new LWP-use-agent
34 my $ua = LWP::UserAgent->new;
35
36 #defines the server-Endpoint. Usually the bottledash-server
37 my $server_endpoint = "http://<IP_des_Bottledash_servers>:8080/updown";
38
39 #determinates if the altert is an upalert or a "down"-alert
40 $ALERT = $opt_u ? "UPALERT" : "ALERT";
41
42 # set custom HTTP request header fields
43 my $req = HTTP::Request->new(POST => $server_endpoint);
44 $req->header('content-type' => 'application/json');
45 $req->header('x-auth-token' => 'kfksj48sdfj4jd9d');
46
47 # add POST data to HTTP request body
48 my $post_data = '{ "server": $ALERT, "status": $opt_u }';
49 $req->content($post_data);
50
51 #every-alert uses that. Dont know what that is
52 while (<STDIN>) {
53 print;
54 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)