diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/connect_with_mon/bottledash.alert	Tue Aug 04 14:23:53 2015 +0200
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+#
+#
+# Sean Engelhardt, sean.engelhardt@intevation.de
+#
+#
+#    Copyright (C) 2015, Intevation
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+#STD
+use Getopt::Std;
+
+#get LWP functionallity
+use LWP::UserAgent;
+
+#alert-status propbably? every Mon-alert uses that
+getopts ("s:g:h:t:l:u");
+
+#Creates a new LWP-use-agent
+my $ua = LWP::UserAgent->new;
+
+#defines the server-Endpoint. Usually the bottledash-server
+my $server_endpoint = "http://<IP_des_Bottledash_servers>:8080/updown";
+
+#determinates if the altert is an upalert or a "down"-alert
+$ALERT = $opt_u ? "UPALERT" : "ALERT";
+
+# set custom HTTP request header fields
+my $req = HTTP::Request->new(POST => $server_endpoint);
+$req->header('content-type' => 'application/json');
+$req->header('x-auth-token' => 'kfksj48sdfj4jd9d');
+
+# add POST data to HTTP request body
+my $post_data = '{ "server": $ALERT, "status": $opt_u }';
+$req->content($post_data);  
+
+#every-alert uses that. Dont know what that is
+while (<STDIN>) {
+    print;
+}
\ No newline at end of file
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)