# HG changeset patch # User sean # Date 1439476486 -7200 # Node ID 7d431b77951248e83380bf251a719963731ebe16 # Parent f63737665ac5fd0dbefa2c1e7dd8abf0bba49a75 working connection with MON diff -r f63737665ac5 -r 7d431b779512 dash.py --- a/dash.py Thu Aug 13 13:14:00 2015 +0200 +++ b/dash.py Thu Aug 13 16:34:46 2015 +0200 @@ -179,7 +179,7 @@ logger.info('------- new alert --------') logger.info('Service : ' + str(service)) logger.info('Status : ' + str(status)) - log_tile_status() + # log_tile_status() return "thanks for informing bottledash! :: " + str(service) + " is " + str(status) + " !" diff -r f63737665ac5 -r 7d431b779512 doc/connect_with_mon/bottledash.alert --- a/doc/connect_with_mon/bottledash.alert Thu Aug 13 13:14:00 2015 +0200 +++ b/doc/connect_with_mon/bottledash.alert Thu Aug 13 16:34:46 2015 +0200 @@ -21,34 +21,19 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#STD +#!/usr/bin/perl +use LWP::UserAgent; use Getopt::Std; -#get LWP functionallity -use LWP::UserAgent; - -#alert-status propbably? every Mon-alert uses that -getopts ("s:g:h:t:l:u"); +getopts ("S:s:g:h:t:l:f:u"); -#Creates a new LWP-use-agent -my $ua = LWP::UserAgent->new; - -#defines the server-Endpoint. Usually the bottledash-server -my $server_endpoint = "http://: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'); +$SERVICE = $opt_g; -# 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 () { - print; -} \ No newline at end of file +my $server_endpoint = "http://localhost:8000/updown"; +my $ua = LWP::UserAgent->new; +my $req = HTTP::Request->new(POST => $server_endpoint); +$req->header('content-type' => 'x-www-form-urlencoded'); +my $post_data = "service=$SERVICE&status=$ALERT"; +$req->content($post_data); +my $resp = $ua->request($req); diff -r f63737665ac5 -r 7d431b779512 views/bottledash_view.tpl --- a/views/bottledash_view.tpl Thu Aug 13 13:14:00 2015 +0200 +++ b/views/bottledash_view.tpl Thu Aug 13 16:34:46 2015 +0200 @@ -140,7 +140,7 @@ function check_server_state_loop() { for (var i = 0; i < mon_tile_ips.length; i++) { var state = check_server_state(mon_tile_ips[i]) - if (state == "up") { + if (state == "UPALERT" || state == "UP") { set_mon_tile_status(mon_tile_ips[i], "active") } else { set_mon_tile_status(mon_tile_ips[i], "dead")