aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-02 17:33:42 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-02 17:33:42 +0100
commit10141ed04af966ee280dcea1d733e0b036127afc (patch)
tree21dd6e4f4ece87288424fce7fdb866378c0edc5b
parent25b32914b72a5f709eca773f3511cc89c2e710c2 (diff)
parentf07c5705d4ec82f4ba851409d4a92a9f66820df8 (diff)
merge
-rw-r--r--Makefile51
-rw-r--r--[-rwxr-xr-x]bin/mauveconsole2
-rw-r--r--[-rwxr-xr-x]bin/mauvesend0
-rw-r--r--[-rwxr-xr-x]bin/mauveserver55
-rw-r--r--debian/mauvealert-server.install2
-rw-r--r--etc/mauveserver.conf (renamed from mauveserver.conf)0
-rw-r--r--heartbeat_hammer.sh2
-rw-r--r--lib/mauve/alert.rb18
-rw-r--r--lib/mauve/configuration_builders/logger.rb3
-rw-r--r--lib/mauve/mauve_time.rb2
-rw-r--r--lib/mauve/processor.rb6
-rw-r--r--lib/mauve/sender.rb2
-rw-r--r--lib/mauve/timer.rb2
-rw-r--r--lib/mauve/web_interface.rb6
-rw-r--r--static/javascript/mauve_utils.js242
-rw-r--r--static/stylesheets/bytemark.css9
-rw-r--r--static/stylesheets/mauve.css20
-rw-r--r--test/tc_mauve_configuration_builders_server.rb16
-rw-r--r--test/test_mauve.rb (renamed from test/ts_mauve.rb)5
-rw-r--r--views/_navbar.haml4
-rw-r--r--views/alerts.haml23
21 files changed, 349 insertions, 121 deletions
diff --git a/Makefile b/Makefile
index 7144d18..2ce411c 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,8 @@
#
##
+OPENBSD_SETUP_FLAGS = --prefix=/usr/local --installdirs=site --ruby-path=/usr/local/bin/ruby18 --mandir=\$$prefix/man/man1 --siteruby=\$$libdir/ruby/site_ruby --siterubyver=\$$siteruby/1.8
+
all: man man/mauvesend.1 man/mauveserver.1 man/mauveconsole.1
man:
@@ -13,6 +15,53 @@ man/%.1: bin/%
clean:
$(RM) -r man
+ # Theoretically this will clean up the shebang munging done by the openbsd_tarball task below.
+ if [ -e ./setup.rb ] ; then \
+ ruby ./setup.rb distclean ; \
+ ruby ./setup.rb config ; \
+ ruby ./setup.rb setup ; \
+ ruby ./setup.rb clean ; \
+ fi
+ $(RM) -r tmp
+
+distclean: clean
+ if [ -e ./setup.rb ] ; then ruby ./setup.rb distclean ; fi
+ $(RM) setup.rb
+ $(RM) -r OpenBSD
+
+test: setup.rb
+ ruby ./setup.rb test
+
+setup.rb: /usr/lib/ruby/1.8/setup.rb
+ ln -sf /usr/lib/ruby/1.8/setup.rb .
+
+OpenBSD: OpenBSD/sha256sums
+
+OpenBSD/sha256sums: OpenBSD/ruby-mauvealert.tar.gz OpenBSD/ruby-protobuf.tar.gz
+ #
+ # rejig sha256sum to openbsd sha256
+ #
+ cd OpenBSD && sha256sum * | sed -e 's/\([^ ]\+\) \(.*\)$$/SHA256 (\2) = \1/' > sha256
+ gpg --clearsign OpenBSD/sha256sum
+
+OpenBSD/ruby-mauvealert.tar.gz: all setup.rb
+ mkdir -p tmp/ruby-mauvealert
+ ruby ./setup.rb config ${OPENBSD_SETUP_FLAGS}
+ ruby ./setup.rb setup
+ ruby ./setup.rb install --prefix=tmp/ruby-mauvealert
+ mkdir -p OpenBSD
+ tar -C tmp/ruby-mauvealert -czvf $@ .
+
+OpenBSD/ruby-protobuf.tar.gz:
+ mkdir -p tmp/ruby-protobuf-source
+ git clone https://github.com/macks/ruby-protobuf.git tmp/ruby-protobuf-source
+ cd tmp/ruby-protobuf-source && git checkout -b v0.4.5
+ ln -sf /usr/lib/ruby/1.8/setup.rb tmp/ruby-protobuf-source/
+ cd tmp/ruby-protobuf-source && ruby ./setup.rb config ${OPENBSD_SETUP_FLAGS}
+ cd tmp/ruby-protobuf-source && ruby ./setup.rb setup
+ cd tmp/ruby-protobuf-source && ruby ./setup.rb install --prefix=../ruby-protobuf
+ mkdir -p OpenBSD
+ tar -C tmp/ruby-protobuf -czvf $@ .
-.PHONY: all clean
+.PHONY: all clean openbsd_tarball test distclean
diff --git a/bin/mauveconsole b/bin/mauveconsole
index c2d145f..b1f9e65 100755..100644
--- a/bin/mauveconsole
+++ b/bin/mauveconsole
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby1.8
+#! /usr/bin/ruby1.8
# NAME
# mauveconsole -- Ruby console to query the mauvealert server directly
#
diff --git a/bin/mauvesend b/bin/mauvesend
index 42229eb..42229eb 100755..100644
--- a/bin/mauvesend
+++ b/bin/mauvesend
diff --git a/bin/mauveserver b/bin/mauveserver
index 50e1465..0f9ebac 100755..100644
--- a/bin/mauveserver
+++ b/bin/mauveserver
@@ -34,18 +34,6 @@
# Patrick J Cherry <patrick@bytemark.co.uk>
#
-def error(msg)
- STDERR.print "*** Error: #{msg}\n"
- STDERR.print "*** For help, type: #{$0} -h\n"
-
- if msg.respond_to?("backtrace")
- STDERR.print "*** Backtrace:\n"
- STDERR.print msg.backtrace.join("\n")+"\n"
- end
-
- exit 1
-end
-
help = manual = verbose = version = test = false
while arg = ARGV.pop
case arg
@@ -95,6 +83,32 @@ puts "#{$0}: version "+Mauve::VERSION if version
exit 0 if help or version or manual
+require 'log4r'
+
+#
+# Initial logger -- gets detroyed later.
+#
+logger = Log4r::Logger.new 'Mauve'
+outputter = Log4r::StderrOutputter.new("initial")
+outputter.formatter = Log4r::PatternFormatter.new( :pattern => "%d [ %6.6l ] [ %12.12c ] %m" )
+outputter.level = verbose ? Log4r::DEBUG : Log4r::INFO
+logger.outputters << outputter
+
+def error(msg)
+ logger = Log4r::Logger.new 'Mauve'
+ logger.error
+ logger.error "*** Error: #{msg}\n"
+ logger.error "*** For help, type: #{$0} -h\n"
+
+ if msg.respond_to?("backtrace")
+ logger.debug "*** Backtrace:\n"
+ logger.debug msg.backtrace.join("\n")+"\n"
+ end
+
+ exit 1
+end
+
+
begin
eval "Proc.new { |a,&b| }"
rescue SyntaxError => no_blocks_with_procs
@@ -119,11 +133,11 @@ require 'mauve/configuration_builders'
begin
Mauve::Configuration.current = Mauve::ConfigurationBuilder.load(configuration_file)
rescue StandardError => ex
- error (verbose ? ex : ex.to_s)
+ error ex
end
if test
- puts "*** Configuration looks OK!"
+ logger.info "*** Configuration looks OK!"
exit 0
end
@@ -132,7 +146,7 @@ end
Mauve::Server.instance.logger.warn "#{sig} signal received. Restarting."
Mauve::Server.instance.stop
- #
+ #
# Reload configuration
#
begin
@@ -167,6 +181,7 @@ end
l.outputters.delete(old)
end
+ old.flush
old.close
Mauve::Server.instance.logger.info "Opened #{new.filename}."
@@ -183,8 +198,16 @@ end
end
begin
+ if outputter and logger.outputters.include?(outputter)
+ logger.debug "Closing initial outputter"
+ logger.outputters.delete(outputter)
+ outputter.flush
+ outputter.close
+ end
+
+ logger.info "This is mauve #{Mauve::VERSION}"
Mauve::Server.instance.start
rescue StandardError => ex
- error (verbose ? ex : ex.to_s)
+ error ex
end
diff --git a/debian/mauvealert-server.install b/debian/mauvealert-server.install
index bc3f0f8..1449c30 100644
--- a/debian/mauvealert-server.install
+++ b/debian/mauvealert-server.install
@@ -32,5 +32,5 @@ lib/rack-flash.rb usr/lib/ruby/1.8/
lib/sinatra-partials.rb usr/lib/ruby/1.8/
static usr/share/mauvealert
views usr/share/mauvealert
-mauveserver.conf etc/mauvealert/
+etc/mauveserver.conf etc/mauvealert/
diff --git a/mauveserver.conf b/etc/mauveserver.conf
index 4baec0a..4baec0a 100644
--- a/mauveserver.conf
+++ b/etc/mauveserver.conf
diff --git a/heartbeat_hammer.sh b/heartbeat_hammer.sh
index 33cbc29..12b74bc 100644
--- a/heartbeat_hammer.sh
+++ b/heartbeat_hammer.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-PRE="ruby -I lib bin/mauvesend localhost"
+PRE="ruby -I lib bin/mauvesend [::1]"
F=60
S=10
n=$*
diff --git a/lib/mauve/alert.rb b/lib/mauve/alert.rb
index 6bde73a..027cc8c 100644
--- a/lib/mauve/alert.rb
+++ b/lib/mauve/alert.rb
@@ -91,7 +91,10 @@ module Mauve
end
alias to_s inspect
-
+
+ #
+ # This is to stop datamapper inserting duff dates into the database.
+ #
def check_dates
bad_dates = self.attributes.find_all do |key, value|
value.is_a?(DateTime) and not (DateTime.new(2000,1,1,0,0,0)..DateTime.new(2020,1,1,0,0,0)).include?(value)
@@ -225,8 +228,6 @@ module Mauve
end
end
- logger.info "#{self.inspect} updated." unless @attributes_before_save.empty?
-
true
end
@@ -296,6 +297,7 @@ module Mauve
raise! if (will_unacknowledge_at and will_unacknowledge_at.to_time <= MauveTime.now) or
(will_raise_at and will_raise_at.to_time <= MauveTime.now)
clear! if will_clear_at && will_clear_at.to_time <= MauveTime.now
+ logger.info("Polled #{self.inspect}")
end
@@ -388,13 +390,13 @@ module Mauve
#
# Receive an AlertUpdate buffer from the wire.
#
- def receive_update(update, reception_time = MauveTime.now)
+ def receive_update(update, reception_time = MauveTime.now, ip_source="network")
update = Proto::AlertUpdate.parse_from_string(update) unless update.kind_of?(Proto::AlertUpdate)
alerts_updated = []
- logger.debug("Alert update received from wire: #{update.inspect.split("\n").join(" ")}")
+ # logger.debug("Alert update received from wire: #{update.inspect.split("\n").join(" ")}")
#
# Transmission time helps us determine any time offset
@@ -508,6 +510,12 @@ module Mauve
else
alert_db.clear!
end
+
+ #
+ # Record the fact we received an update.
+ #
+ logger.info("Received update from #{ip_source} for #{alert_db.inspect}")
+
end
# If this is a complete replacement update, find the other alerts
diff --git a/lib/mauve/configuration_builders/logger.rb b/lib/mauve/configuration_builders/logger.rb
index a1d0388..3f60dfe 100644
--- a/lib/mauve/configuration_builders/logger.rb
+++ b/lib/mauve/configuration_builders/logger.rb
@@ -48,7 +48,7 @@ module Mauve
is_builder "outputter", LoggerOutputter
def builder_setup
- @result = Log4r::Logger.new('Mauve')
+ @result = Log4r::Logger['Mauve'] || Log4r::Logger.new('Mauve')
@default_format = nil
@default_level = Log4r::RootLogger.instance.level
end
@@ -92,6 +92,7 @@ module Mauve
end
result.outputters << outputter
+# result.outputter.write("Created logger")
end
end
end
diff --git a/lib/mauve/mauve_time.rb b/lib/mauve/mauve_time.rb
index 79fa4f3..812b0e2 100644
--- a/lib/mauve/mauve_time.rb
+++ b/lib/mauve/mauve_time.rb
@@ -21,7 +21,7 @@ class DateTime
end
def in_x_hours(*args)
- self.to_s_human(*args)
+ self.to_time.in_x_hours(*args)
end
end
diff --git a/lib/mauve/processor.rb b/lib/mauve/processor.rb
index f5e8fac..059ca15 100644
--- a/lib/mauve/processor.rb
+++ b/lib/mauve/processor.rb
@@ -43,9 +43,9 @@ module Mauve
Timer.instance.freeze if Timer.instance.alive? and !Timer.instance.frozen?
- logger.debug("Got #{data.inspect} from #{client.inspect}")
+ # logger.debug("Got #{data.inspect} from #{client.inspect}")
- ip_source = "#{client[3]}:#{client[1]}"
+ ip_source = "#{client[3]}"
update = Proto::AlertUpdate.new
begin
@@ -62,7 +62,7 @@ module Mauve
logger.debug "Update #{update.transmission_id} sent at #{update.transmission_time} from "+
"'#{update.source}'@#{ip_source} alerts #{update.alert.length}"
- Alert.receive_update(update, received_at)
+ Alert.receive_update(update, received_at, ip_source)
rescue Protobuf::InvalidWireType,
NotImplementedError,
diff --git a/lib/mauve/sender.rb b/lib/mauve/sender.rb
index 8194180..ef06d0f 100644
--- a/lib/mauve/sender.rb
+++ b/lib/mauve/sender.rb
@@ -108,7 +108,7 @@ module Mauve
#
# Must have a source, so default to hostname if user doesn't care
- update.source ||= `hostname -f`.chomp
+ update.source ||= Socket.gethostname
#
# Make sure all alerts default to "-r now"
diff --git a/lib/mauve/timer.rb b/lib/mauve/timer.rb
index 8533451..1c8c37c 100644
--- a/lib/mauve/timer.rb
+++ b/lib/mauve/timer.rb
@@ -49,7 +49,7 @@ module Mauve
#
# La la la nothing to do.
#
- logger.info("Next to notify: #{next_to_notify} -- snoozing until #{next_to_notify.due_at}")
+ logger.info("Next to notify: #{next_to_notify} #{next_to_notify.is_a?(AlertChanged) ? "(reminder)" : "(heartbeat)"} -- snoozing until #{next_to_notify.due_at.iso8601}")
sleep_loops = ((next_to_notify.due_at - MauveTime.now).to_f / 0.1).round.to_i
end
diff --git a/lib/mauve/web_interface.rb b/lib/mauve/web_interface.rb
index 4bb9517..9369ee3 100644
--- a/lib/mauve/web_interface.rb
+++ b/lib/mauve/web_interface.rb
@@ -103,11 +103,12 @@ EOF
# Uh-oh.. Intruder alert!
#
ok_urls = %w(/ /login /logout)
+ no_redirect_urls = %w(/ajax)
unless ok_urls.include?(request.path_info)
flash['error'] = "You must be logged in to access that page."
status 403
- redirect "/login?next_page=#{request.path_info}"
+ redirect "/login?next_page=#{request.path_info}" unless no_redirect_urls.any?{|u| /^#{u}/ =~ request.path_info }
end
end
end
@@ -230,7 +231,7 @@ EOF
end
end
- flash["errors"] = "Failed to acknowledge #{failed.length} alerts." if failed.length > 0
+ flash["error"] = "Failed to acknowledge #{failed.length} alerts." if failed.length > 0
flash["notice"] = "Successfully acknowledged #{succeeded.length} alerts" if succeeded.length > 0
redirect "/alerts/raised"
@@ -267,7 +268,6 @@ EOF
get '/ajax/time_to_s_human/:seconds' do
content_type :text
-
secs = params[:seconds].to_i
Time.at(secs).to_s_human
end
diff --git a/static/javascript/mauve_utils.js b/static/javascript/mauve_utils.js
index 45a651d..cd0d52b 100644
--- a/static/javascript/mauve_utils.js
+++ b/static/javascript/mauve_utils.js
@@ -3,62 +3,234 @@ function updateDate() {
//
// Date.getTime() returns *milliseconds*
//
- var this_date = workoutDate( $('#n_hours').val(), $('#type_hours').val() );
- $('#ack_until_text').html("(until "+humanDate(this_date)+")");
- $('#ack_until').val(this_date.getTime()/1000);
+ var this_date = workoutDate( $( '#n_hours' ).val(), $( '#type_hours' ).val() );
+ $( '#ack_until' ).val( this_date.getTime()/1000 );
+
+ //
+ // Use a asynchronous ajax convert a date to a human string. NB Date.getTime()
+ // returns *milliseconds*
+ //
+ $.ajax( {
+ url: '/ajax/time_to_s_human/'+this_date.getTime()/1000,
+ timeout: 1000,
+ success: function( data ) { $( '#ack_until_text' ).html( "( until "+data+" )" ); },
+ error: function( a,b,c ) { $( '#ack_until_text' ).html( "( until "+this_date.toString()+" )" ); }
+ } );
return false;
}
-function workoutDate(h, t) {
- var new_date = null;
+function workoutDate( h, type ) {
- h = new Number(h);
- h = ( h > 300 ? 300 : h );
+ n = new Number( h );
+ n *= 3600 * 1000;
- //
- // Use a synchronous ajax request to fetch the date. Note that
- // Date.getTime() returns milliseconds..
+ if ( type == null ) {
+ type = "wallclock" ;
+ }
+
+ var step = 3600 * 1000;
//
- $.ajax({
- url: '/ajax/time_in_x_hours/'+h+"/"+t,
- async: false,
- success: function(data) { new_date = new Date ( new Number(data) * 1000 ); }
- });
+ // Get the time now, in milliseconds
+ //
+ var d = new Date();
+ var t = d.getTime();
+ //
+ // Can't ack longer than a week
+ //
+ var maxDate = new Date( d.getTime() + 1000 * 86400 * 8 )
- return new_date;
-}
+ //
+ // Work out how much time to subtract now
+ //
+ while ( n >= 0 && t < maxDate.getTime() ) {
+ //
+ // If we're currently OK, and we won't be OK after the next step ( or
+ // vice-versa ) decrease step size, and try again
+ //
+ if ( doTimeTest( t, type ) != doTimeTest( t+step, type ) ) {
+ //
+ // Unless we're on the smallest step, try a smaller one.
+ //
+ if ( step > 1000 ) {
+ step /= 60;
+
+ } else {
+ if ( doTimeTest( t, type ) ) n -= step;
+ t += step;
+
+ //
+ // Set the step size back to an hour
+ //
+ step = 3600*1000;
+ }
-function humanDate(d) {
- var new_date = null;
+ continue;
+ }
- if ( d == null ) {
- d = new Date();
+ //
+ // Decrease the time by the step size if we're currently OK.
+ //
+ if ( doTimeTest( t, type ) ) n -= step;
+ t += step;
}
- //
- // Use a synchronous ajax convert a date to a human string. NB Date.getTime()
- // returns *milliseconds*
//
- $.ajax({
- url: '/ajax/time_to_s_human/'+d.getTime()/1000,
- async: false,
- success: function(data) { new_date = data; }
- });
+ // Substract any overshoot.
+ //
+ if ( n < 0 ) t += n;
- return new_date;
+ //
+ // Make sure we can't ack alerts too far in the future.
+ //
+ return ( t > maxDate.getTime() ? maxDate : new Date( t ) );
}
-function fetchDetail(a) {
+function fetchDetail( a ) {
// Use a synchronous ajax request to fetch the date.
- $.get('/ajax/alerts_table_alert_detail/'+a,
- function(data) {
- $('#tr_summary_'+a).after(data);
+ $.get( '/ajax/alerts_table_alert_detail/'+a,
+ function( data ) {
+ $( '#tr_summary_'+a ).after( data );
// Only fetch the data once.
- $('#a_detail_'+a).attr("onclick",null).click(function() { $('#tr_detail_'+a).toggle(); return false; });
+ $( '#a_detail_'+a ).attr( "onclick",null ).click( function() { $( '#tr_detail_'+a ).toggle(); return false; } );
+ } );
+
+ return false;
+}
+
+//
+// This expects its arguments as a time in milliseconds, and a type of "working", "daytime", or something else.
+//
+function doTimeTest( t, type ) {
+
+ var d = new Date( t );
+ var r = false;
+
+ switch ( type ) {
+ case "working":
+ r = ( d.getDay() > 0 && d.getDay() < 6 &&
+ ( ( d.getHours() >= 9 && d.getHours() <= 16 ) ||
+ ( d.getHours() == 8 && d.getMinutes() >= 30 )
+ ) );
+ break;
+
+ case "daytime":
+ r = ( d.getHours() >= 8 && d.getHours() <= 21 );
+ break;
+
+ default:
+ r = true;
+ }
+
+ return r;
+}
+
+
+//
+// Updates the alerts table
+//
+function updateAlertsTable(alert_type, group_by) {
+
+ //
+ // Do nothing if there is a checked box.
+ //
+ if ( $('input.alert:checked').length ) {
+ return false;
+ }
+
+ $.ajax( {
+ url: '/ajax/alerts_table/'+alert_type+'/'+group_by,
+ timeout: 5000,
+ success: function( data ) {
+ if ( "" == data || null == data ) {
+ showError("No data returned by web server when updating alerts table.", "updateAlertsTable");
+ } else {
+ $('#alerts_table').replaceWith(data);
+ clearError("updateAlertsTable");
+ updateAlertCounts();
+ }
+ },
+ error: function( a,b,c ) {
+ if ( "timeout" == b ) {
+ showError("Web server timed out when updating alerts table.", "updateAlertsTable");
+ } else {
+ showError("Got "+a.status+" "+a.statusText+" when updating alerts table.", "updateAlertsTable");
+ }
+ },
+ });
+
+ return false;
+}
+
+//
+// Updates the alerts title tag
+//
+function updateAlertCounts() {
+ $.ajax( {
+ url: '/ajax/alert_counts',
+ timeout: 5000,
+ success: function(counts) {
+ if ( "" == counts || null == counts) {
+ showError("No data returned by web server when updating alert counts.", "updateAlertCounts");
+ } else {
+ $('#count_raised').html(counts[0]+counts[1]+counts[2]+"");
+ $('#count_ackd').html(counts[3]+"");
+ $('#count_cleared').html(counts[4]+"");
+ $('title').html("Mauve: [ "+counts[0]+" / "+counts[1]+" / "+counts[2]+" ] Alerts");
+ clearError("updateAlertCounts");
+ }
+ },
+ error: function( a,b,c ) {
+ if ( "timeout" == b ) {
+ showError("Web server timed out when updating alert counts.", "updateAlertCounts");
+ } else {
+ showError("Got "+a.status+" "+a.statusText+" when updating alert counts.", "updateAlertCounts");
+ }
+ },
});
return false;
}
+
+//
+//
+//
+function showError(text, func) {
+
+ if ( null == text || "" == text ) return false;
+
+
+ // We need to add the p element.
+ if ( 0 == $('div.flash.error p#'+func).length ) {
+ // ugh.. standard DOM stuff.
+ var p = document.createElement('p');
+ p.setAttribute("id",func);
+ $('div.flash.error').append(p);
+ }
+
+ $('p#'+func).html(text);
+ // Show the error box
+ $('div.flash.error').fadeIn(2000);
+
+ return false;
+}
+
+function clearError(func) {
+ //
+ // Remove the element if it exists.
+ //
+ if ( $('div.flash.error p#'+func).length ) {
+ $('div.flash.error p#'+func).remove();
+ }
+
+ if ( $('div.flash.error').contents().length == 0 ) {
+ $('div.flash.error').hide();
+ }
+
+ return false;
+}
+
+
+
diff --git a/static/stylesheets/bytemark.css b/static/stylesheets/bytemark.css
index e4a14cb..365d3aa 100644
--- a/static/stylesheets/bytemark.css
+++ b/static/stylesheets/bytemark.css
@@ -64,10 +64,15 @@ h2 a {
h3, th {
font-weight: bold;
- font-size: small;
+ font-size: normal;
background-color: #E4E4E4;
color: black;
}
+
+th {
+ font-size: small;
+}
+
h3 {
padding: 3px 5px;
margin: 5px 5px 0px 5px;
@@ -96,7 +101,7 @@ div#navbar {
margin: -5px -5px 5px -5px;
padding-left: 15px;
background-color: #666;
- font-size: 14px;
+ font-size: small;
}
div#navbar ul {
diff --git a/static/stylesheets/mauve.css b/static/stylesheets/mauve.css
index b0764db..50f5da3 100644
--- a/static/stylesheets/mauve.css
+++ b/static/stylesheets/mauve.css
@@ -46,20 +46,6 @@ tr.detail {
border-top-width: thin;
}
-div.error {
- border: #c66dff medium solid;
- background-color: #e0b0ff;
-}
-
-div.notice {
- border: #c66dff medium solid;
- background-color: #e0b0ff;
-}
-
-div.error p, div.notice p {
- background-color: transparent;
-}
-
.hidden {
display: none;
}
@@ -78,18 +64,18 @@ div.notice {
background-image: url('/images/information.png');
}
-div.notice, div.error {
+div.flash {
margin: 5px 5px 0px;
padding: 0px;
padding-left: 20px;
color: black;
- font-size: 12px;
+ font-size: large;
background-position: 5px;
background-repeat: no-repeat;
min-height: 20px;
}
-div.error p, div.notice p {
+div.flash p {
background-color: transparent;
}
diff --git a/test/tc_mauve_configuration_builders_server.rb b/test/tc_mauve_configuration_builders_server.rb
index 4330610..270c046 100644
--- a/test/tc_mauve_configuration_builders_server.rb
+++ b/test/tc_mauve_configuration_builders_server.rb
@@ -53,8 +53,8 @@ EOF
assert_equal(detail, h.detail)
assert_equal(summary, h.summary)
assert_equal(destination, h.destination)
- assert_equal(raise_after, h.raise_at)
- assert_equal(send_every, h.sleep_interval)
+ assert_equal(raise_after, h.raise_after)
+ assert_equal(send_every, h.poll_every)
end
def test_web_interface_params
@@ -94,14 +94,14 @@ server {
listener {
ip "#{ip}"
port #{port}
- sleep_interval #{sleep_interval}
+ poll_every #{sleep_interval}
}
}
EOF
assert_nothing_raised { Mauve::ConfigurationBuilder.parse(config) }
u = Mauve::UDPServer.instance
- assert_equal(sleep_interval, u.sleep_interval)
+ assert_equal(sleep_interval, u.poll_every)
assert_equal(IPAddr.new(ip), u.ip)
assert_equal(port, u.port)
end
@@ -111,14 +111,14 @@ EOF
config=<<EOF
server {
notifier {
- sleep_interval #{sleep_interval}
+ poll_every #{sleep_interval}
}
}
EOF
assert_nothing_raised { Mauve::ConfigurationBuilder.parse(config) }
n = Mauve::Notifier.instance
- assert_equal(sleep_interval, n.sleep_interval)
+ assert_equal(sleep_interval, n.poll_every)
end
def test_processor_params
@@ -129,7 +129,7 @@ EOF
server {
processor {
transmission_cache_expire_time #{transmission_cache_expire_time}
- sleep_interval #{sleep_interval}
+ poll_every #{sleep_interval}
}
}
EOF
@@ -137,7 +137,7 @@ EOF
assert_nothing_raised { Mauve::ConfigurationBuilder.parse(config) }
pr = Mauve::Processor.instance
assert_equal(transmission_cache_expire_time, pr.transmission_cache_expire_time)
- assert_equal(sleep_interval, pr.sleep_interval)
+ assert_equal(sleep_interval, pr.poll_every)
end
end
diff --git a/test/ts_mauve.rb b/test/test_mauve.rb
index 27284a6..e3df469 100644
--- a/test/ts_mauve.rb
+++ b/test/test_mauve.rb
@@ -1,5 +1,8 @@
-$:.unshift "../lib"
+%w(. ..).each do |path|
+ libdir = File.join(path,"lib")
+ $:.unshift libdir if File.directory?(libdir)
+end
require 'test/unit'
diff --git a/views/_navbar.haml b/views/_navbar.haml
index 5df4991..aa2b5f5 100644
--- a/views/_navbar.haml
+++ b/views/_navbar.haml
@@ -26,5 +26,5 @@
%div{:class => ["flash", klass]}
:textile
#{flash[klass]}
- :javascript
- $(document).ready(function () { $('div.flash').delay(1000).fadeOut(2000);});
+ - else
+ %div{:class => ["flash", klass], :style => "display: none"}
diff --git a/views/alerts.haml b/views/alerts.haml
index aedbc72..54bfff7 100644
--- a/views/alerts.haml
+++ b/views/alerts.haml
@@ -7,25 +7,6 @@
.notice#alerts_table
%p No alerts to display.
:javascript
- $(document).ready( function() {
- $.PeriodicalUpdater({
- url: '/ajax/alerts_table/#{@alert_type}/#{@group_by}',
- minTimeout: 10000,
- maxTimeout: 30000,
- }, function(alerts_table, success, xhr, handle){
- $('#alerts_table').replaceWith(alerts_table);
- });
- $.PeriodicalUpdater({
- url: '/ajax/alert_counts',
- minTimeout: 10000,
- maxTimeout: 30000,
- }, function(alert_counts, success, xhr, handle){
- var counts = jQuery.parseJSON( alert_counts );
- $('#count_raised').html(counts[0]+counts[1]+counts[2]);
- $('#count_ackd').html(counts[3]);
- $('#count_cleared').html(counts[4]);
- return false;
- });
-
- });
+ // Do the magic updates..
+ setInterval("updateAlertsTable('#{@alert_type}','#{@group_by}');", 30000)