whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/3] Commit e7e019c: add a board minutes monitor
Date Sun, 17 Jan 2016 18:11:35 GMT
Commit e7e019c39f166eed92ad7000a77e4b5e96d41eff:
    add a board minutes monitor


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
tools/collate_minutes.rb                                     | ++++ 
www/status/monitor.rb                                        | +++++++++ 
www/status/monitors/board_minutes.rb                         | ++++++++++++++ 
------------------------------------------------------------
27 changes: 27 additions, 0 deletions.
------------------------------------------------------------


diff --git a/tools/collate_minutes.rb b/tools/collate_minutes.rb
index 0cf7beb..08c1081 100755
--- a/tools/collate_minutes.rb
+++ b/tools/collate_minutes.rb
@@ -7,6 +7,10 @@
 require 'net/https'
 require 'fileutils'
 
+# for monitoring purposes
+at_exit { puts "\n*** Exception #{$!.class} ***" unless SystemExit === $! }
+boom
+
 # destination directory
 SITE_MINUTES = ASF::Config.get(:board_minutes) ||
   File.expand_path('../../www/board/minutes', __FILE__)
diff --git a/www/status/monitor.rb b/www/status/monitor.rb
index d3c92ef..49cbbc6 100644
--- a/www/status/monitor.rb
+++ b/www/status/monitor.rb
@@ -37,6 +37,15 @@ def initialize
         begin
           previous = baseline[method] || {mtime: Time.at(0).gmtime.iso8601}
           status = Monitor.send(method, previous) || previous
+
+          # convert non-hashes in proper statuses
+          if not status.instance_of? Hash
+            if status.instance_of? String or status.instance_of? Array
+              status = {data: status}
+            else
+              status = {level: 'danger', data: status.inspect}
+            end
+          end
         rescue Exception => e
           status = {
             level: 'danger', 
diff --git a/www/status/monitors/board_minutes.rb b/www/status/monitors/board_minutes.rb
new file mode 100644
index 0000000..8f2e3f3
--- /dev/null
+++ b/www/status/monitors/board_minutes.rb
@@ -0,0 +1,14 @@
+#
+# Monitor status of board minutes
+#
+
+def Monitor.board_minutes(previous_status)
+  index = File.expand_path('../../www/board/minutes/index.html')
+  log = File.expand_path('../../www/logs/collate_minutes')
+
+  if File.read(log) =~ /\*\*\* (Exception.*) \*\*\*/
+    {level: 'danger', data: $1}
+  else
+    "Last updated: #{File.mtime(index)}"
+  end
+end

Mime
View raw message