From 048f420510370b6276db27da5c4f55620badf6b4 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 2 Aug 2011 16:54:13 +0100 Subject: More interface tweaks. --HG-- rename : mauveserver.conf => etc/mauveserver.conf rename : test/ts_mauve.rb => test/test_mauve.rb --- bin/mauveconsole | 2 +- bin/mauvesend | 0 bin/mauveserver | 0 debian/control | 2 +- debian/mauvealert-server.install | 2 +- etc/mauveserver.conf | 159 +++++++++++++++++++++++++ lib/mauve/sender.rb | 2 +- mauveserver.conf | 159 ------------------------- static/javascript/mauve_utils.js | 2 +- static/stylesheets/bytemark.css | 9 +- static/stylesheets/mauve.css | 20 +--- test/tc_mauve_configuration_builders_server.rb | 16 +-- test/test_mauve.rb | 23 ++++ test/ts_mauve.rb | 20 ---- views/_navbar.haml | 2 - 15 files changed, 205 insertions(+), 213 deletions(-) mode change 100755 => 100644 bin/mauveconsole mode change 100755 => 100644 bin/mauvesend mode change 100755 => 100644 bin/mauveserver create mode 100644 etc/mauveserver.conf delete mode 100644 mauveserver.conf create mode 100644 test/test_mauve.rb delete mode 100644 test/ts_mauve.rb diff --git a/bin/mauveconsole b/bin/mauveconsole old mode 100755 new mode 100644 index c2d145f..b1f9e65 --- 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 old mode 100755 new mode 100644 diff --git a/bin/mauveserver b/bin/mauveserver old mode 100755 new mode 100644 diff --git a/debian/control b/debian/control index 8044acf..5be6038 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Maintainer: Matthew Bloch Uploaders: Patrick J Cherry Section: ruby Priority: optional -Build-Depends: ruby1.8, debhelper, cdbs, rdoc, txt2man, cdbs +Build-Depends: ruby1.8, debhelper, cdbs, rdoc, txt2man, cdbs, libsetup-ruby1.8 Standards-Version: 3.8.0 Package: mauvealert-client 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/etc/mauveserver.conf b/etc/mauveserver.conf new file mode 100644 index 0000000..4baec0a --- /dev/null +++ b/etc/mauveserver.conf @@ -0,0 +1,159 @@ +# Example mauveserver.conf file, based on Bytemark's configuration. +# Probably still needs a bit of improvement and explanation. +# + +# The service which listens for alert messages +# +server { + # + # persistent data store, only sqlite3 supported at the moment + # + database "sqlite3:///var/lib/mauvealert/alerts.db" + + listener { + ip "0.0.0.0" + port 32741 + } + + # default is probably more than enough! + # transmission_id_expire_time 600 + + # few options for web interface, just the TCP port number + web_interface { + ip "0.0.0.0" + port 1288 + document_root "/usr/share/mauvealert" + } +} + +logger { + + default_format "%d [ %6.6l ] [ %12.12c ] %m" + + outputter("file") { + filename "/var/log/mauvealert/mauvealert.log" + trunc false + level Log4r::INFO + } + +# outputter("stdout") { +# level Log4r::DEBUG +# } + +# outputter("email") { +# server "localhost" +# subject "Mauve logger output" +# from "mauvealert@localhost" +# to "boring@localhost" +# domain "localhost" +# level Log4r::WARN +# } + +} + +notification_method("email") { + # + # email address to send from + # + from "mauvealert@" + `hostname`.chomp + + # + # outbound smtp host + # + server "localhost" + + # + # add this to the subject of any emails we send + # + subject_prefix "[mauvealert]" +} + +# How to log into a jabber server +# +# notification_method("xmpp") { +# jid "mauvealert@chat.example.com/boo" +# password "x" +# } + +# How to notify by SMS - we use aql.com, you'll need to write a module +# to use any other provider. +# +# notification_method("sms") { +# provider "AQL" +# +# username "x" +# password "x" +# from "01234567890" +# +# # Maximum number of SMS messages to concatenate for one notification +# max_messages_per_alert 3 +# } + +# Simple default notification preference for root at this machine, at all +# alert levels. You probably want more people, see below for a more complete +# example. +# +person("root") { + all { email("root@localhost") } +} + +# Johnny is the go-to guy for everything on this network, poor Johnny! +# +# person("johnny") { +# +# # Johnny wants waking up 24/7 if anything urgent happens +# urgent { sms("07111222333") } +# +# # Email him for anything that's not urgent +# normal { email("johnny@example.com") } +# +# # Anything else can just be a jabber message, which he might miss. +# # Email instead if he's unavailable/offline - but give it a try if +# # we don't know his status. +# low { xmpp("johnny@example.com.jabber.org", :if_presence => [:available, unknown]) || email("johnny@example.com") } +# +# # SMS messages are expensive, if we're sending more than 5 per minute, +# # tell the user we're going to stop until it slows down. +# suppress_notifications_after 5 => 1.minute +# # In general, this is too many notifications for Johnny +# suppress_notifications_after 60 => 1.hour +# } + +# Archie is Johnny's boss +# +# person("archie") { +# all { email("archie@example.com") } +# +# # Don't spam Archie, if more than 3 messages per hour come in. +# suppress_notifications_after 3 => 1.hour +# } + +# Here is a group of alerts generated by the core routers. +# +# alert_group { +# level URGENT +# includes { source == "core-router" } +# +# # Johnny should get up and fix these errors very quickly, we will +# # bother him every 15 minutes until he does. +# # +# notify("johnny") { every 15.minutes } +# +# # Archie only wants to know about these alerts if they have gone +# # unacknowledged for a whole hour - Johnny must be slacking! Even +# # then he only needs to know during the working day. +# # +# notify("archie") { +# every 6.hours +# during { unacknowledged(1.hour); hours_in_day(9..17) } +# } +# } + +# +# Default notification - tell root about all alerts every hour +# +alert_group { + level NORMAL + notify("root") { every 1.hour } +} + 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/mauveserver.conf b/mauveserver.conf deleted file mode 100644 index 4baec0a..0000000 --- a/mauveserver.conf +++ /dev/null @@ -1,159 +0,0 @@ -# Example mauveserver.conf file, based on Bytemark's configuration. -# Probably still needs a bit of improvement and explanation. -# - -# The service which listens for alert messages -# -server { - # - # persistent data store, only sqlite3 supported at the moment - # - database "sqlite3:///var/lib/mauvealert/alerts.db" - - listener { - ip "0.0.0.0" - port 32741 - } - - # default is probably more than enough! - # transmission_id_expire_time 600 - - # few options for web interface, just the TCP port number - web_interface { - ip "0.0.0.0" - port 1288 - document_root "/usr/share/mauvealert" - } -} - -logger { - - default_format "%d [ %6.6l ] [ %12.12c ] %m" - - outputter("file") { - filename "/var/log/mauvealert/mauvealert.log" - trunc false - level Log4r::INFO - } - -# outputter("stdout") { -# level Log4r::DEBUG -# } - -# outputter("email") { -# server "localhost" -# subject "Mauve logger output" -# from "mauvealert@localhost" -# to "boring@localhost" -# domain "localhost" -# level Log4r::WARN -# } - -} - -notification_method("email") { - # - # email address to send from - # - from "mauvealert@" + `hostname`.chomp - - # - # outbound smtp host - # - server "localhost" - - # - # add this to the subject of any emails we send - # - subject_prefix "[mauvealert]" -} - -# How to log into a jabber server -# -# notification_method("xmpp") { -# jid "mauvealert@chat.example.com/boo" -# password "x" -# } - -# How to notify by SMS - we use aql.com, you'll need to write a module -# to use any other provider. -# -# notification_method("sms") { -# provider "AQL" -# -# username "x" -# password "x" -# from "01234567890" -# -# # Maximum number of SMS messages to concatenate for one notification -# max_messages_per_alert 3 -# } - -# Simple default notification preference for root at this machine, at all -# alert levels. You probably want more people, see below for a more complete -# example. -# -person("root") { - all { email("root@localhost") } -} - -# Johnny is the go-to guy for everything on this network, poor Johnny! -# -# person("johnny") { -# -# # Johnny wants waking up 24/7 if anything urgent happens -# urgent { sms("07111222333") } -# -# # Email him for anything that's not urgent -# normal { email("johnny@example.com") } -# -# # Anything else can just be a jabber message, which he might miss. -# # Email instead if he's unavailable/offline - but give it a try if -# # we don't know his status. -# low { xmpp("johnny@example.com.jabber.org", :if_presence => [:available, unknown]) || email("johnny@example.com") } -# -# # SMS messages are expensive, if we're sending more than 5 per minute, -# # tell the user we're going to stop until it slows down. -# suppress_notifications_after 5 => 1.minute -# # In general, this is too many notifications for Johnny -# suppress_notifications_after 60 => 1.hour -# } - -# Archie is Johnny's boss -# -# person("archie") { -# all { email("archie@example.com") } -# -# # Don't spam Archie, if more than 3 messages per hour come in. -# suppress_notifications_after 3 => 1.hour -# } - -# Here is a group of alerts generated by the core routers. -# -# alert_group { -# level URGENT -# includes { source == "core-router" } -# -# # Johnny should get up and fix these errors very quickly, we will -# # bother him every 15 minutes until he does. -# # -# notify("johnny") { every 15.minutes } -# -# # Archie only wants to know about these alerts if they have gone -# # unacknowledged for a whole hour - Johnny must be slacking! Even -# # then he only needs to know during the working day. -# # -# notify("archie") { -# every 6.hours -# during { unacknowledged(1.hour); hours_in_day(9..17) } -# } -# } - -# -# Default notification - tell root about all alerts every hour -# -alert_group { - level NORMAL - notify("root") { every 1.hour } -} - diff --git a/static/javascript/mauve_utils.js b/static/javascript/mauve_utils.js index 674a3a9..cd0d52b 100644 --- a/static/javascript/mauve_utils.js +++ b/static/javascript/mauve_utils.js @@ -226,7 +226,7 @@ function clearError(func) { } if ( $('div.flash.error').contents().length == 0 ) { - $('div.flash.error').fadeOut(2000); + $('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=< ["flash", klass]} :textile #{flash[klass]} - :javascript - $(document).ready(function () { $('div.flash').delay(1000).fadeOut(2000);}); - else %div{:class => ["flash", klass], :style => "display: none"} -- cgit v1.2.1