Skip to content

Commit

Permalink
seems to work...
Browse files Browse the repository at this point in the history
  • Loading branch information
thewoolleyman committed Oct 28, 2008
1 parent c67c77b commit 26169f7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions check_timestamp.rb
@@ -0,0 +1,20 @@
class CheckTimestamp < Scout::Plugin
def build_report
begin
threshold = option(:threshold).to_f
path = option(:path)
timestamp = File.new(path).mtime
current_time = Time.now
difference = (current_time - timestamp) / 60
output = "Path: #{path}, Threshold: #{threshold}, Timestamp: #{timestamp}, Current Time: #{current_time}, Difference: #{difference}"
report(:output => output)
if difference > threshold
alert(:subject => "File #{path} was older than #{threshold} minutes", :body => output)
end
return difference
rescue Exception => e
error(:subject => 'Error running Check Timestamp plugin', :body => e)
return -1
end
end
end
9 changes: 9 additions & 0 deletions check_timestamp.yml
@@ -0,0 +1,9 @@
options:
path:
name: path
notes: path to the file which will have its timestamp checked
default: /fully/qualified/path/to/your/file
threshold:
name: threshold
notes: threshold in minutes for the timestamp. If the timestamp of the file is older than this threshold, an error will be returned.
default: 360

0 comments on commit 26169f7

Please sign in to comment.