Commit d8734785283e842f7ecd804dae8d0a22230d19c5:
Check to see if logs have been updated recently
Branch: refs/heads/master
Author: Sam Ruby <[email protected]>
Committer: Sam Ruby <[email protected]>
Pusher: rubys <[email protected]>
------------------------------------------------------------
www/status/monitors/public_json.rb | +++++++++
------------------------------------------------------------
9 changes: 9 additions, 0 deletions.
------------------------------------------------------------
diff --git a/www/status/monitors/public_json.rb
b/www/status/monitors/public_json.rb
index 7ff71b1..42e8738 100644
--- a/www/status/monitors/public_json.rb
+++ b/www/status/monitors/public_json.rb
@@ -3,6 +3,8 @@
#
def Monitor.public_json(previous_status)
+ grace_period = 86_400 # one day
+
logs = File.expand_path('../../www/logs/public-*')
status = {}
@@ -37,6 +39,13 @@ def Monitor.public_json(previous_status)
title: "#{warnings.length} warnings"
end
+ # Check to see if the log has been updated recently
+ if Time.now - File.mtime(log) > grace_period
+ status[name].merge! level: 'danger',
+ data: "Last updated: #{File.mtime(log).to_s}"
+ end
+
+ # Treat everything left as an error to be reported
unless contents.empty?
status[name].merge! level: 'danger', data: contents.split("\n")
end