<?xml version="1.0" encoding="UTF-8"?>
<plugin-url>
  <approved type="boolean">true</approved>
  <author>Chad Woolley</author>
  <cached-tag-list>timestamp, file</cached-tag-list>
  <canonical-name nil="true"></canonical-name>
  <code>class CheckTimestamp &lt; 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).round.to_f
      output = &quot;Path: #{path}, Threshold: #{threshold} minutes, Path Timestamp: #{timestamp}, Current Time: #{current_time}, Difference: #{difference}&quot;
      report(:difference =&gt; difference, :threshold =&gt; threshold)
      if difference &gt; threshold
        alert(:subject =&gt; &quot;File #{path} was #{difference} minutes old, which is over the threshold of #{threshold} minutes&quot;, :body =&gt; output)
      end
      return difference
    rescue Exception =&gt; e
      error(:subject =&gt; 'Error running Check Timestamp plugin', :body =&gt; e)
      return -1
    end
  end
end</code>
  <created-at type="datetime">2008-11-18T23:51:19-08:00</created-at>
  <default-triggers type="yaml" nil="true"></default-triggers>
  <description>Checks the timestamp on a given file, generating an alert if the timestamp of the file is older than a given threshold.

</description>
  <featured type="boolean">false</featured>
  <id type="integer">92</id>
  <metadata type="yaml" nil="true"></metadata>
  <name>Timestamp Monitor</name>
  <plugins-count type="integer">5</plugins-count>
  <rating-avg type="decimal">0.0</rating-avg>
  <rating-count type="integer">0</rating-count>
  <rating-total type="integer">0</rating-total>
  <readme nil="true"></readme>
  <schema type="yaml" nil="true"></schema>
  <scout-version type="integer">2</scout-version>
  <short-description>Checks the timestamp on a given file, generating an alert if the timestamp of the file is older than a given threshold.</short-description>
  <tested-platforms>linux</tested-platforms>
  <total-usage-count type="integer">0</total-usage-count>
  <updated-at type="datetime">2009-09-23T23:03:27-07:00</updated-at>
  <url>http://github.com/thewoolleyman/scout_plugin_check_timestamp/blob/master%2Fcheck_timestamp.rb?raw=true</url>
</plugin-url>
