News for hackers. Stuff that matters.
Re:Monitors.txt - lazy webapp monitoring by eliot_sykes on Saturday November 05, 2011 @03:03PM (#3200603)
Talking about monitoring deeper in the app...Monitoring cron jobs is one thing that I've never done in a way I'm comfortable with, or enough. That realization is what lead to monitors.txt. I'm working on something like this along with a rails plugin for checking jobs run on time:

  Feature: Jobs should run on time

    Scenario: Search Subscription Job ran on time
      Given the job started and ended at:
        | start                   | end                     |
        | 2011-10-30 05:30:01 GMT | 2011-10-30 05:37:42 GMT |
        | 2011-10-29 05:30:01 GMT | 2011-10-29 05:37:42 GMT |
      Then I should see the job took less than 10 minutes
      And I should see the job started every day at "05:30 GMT"
The rails plugin generates the text above and start/end run times with something like this:

  class SearchSubscriptionJob

    def perform
      # Fire off the search subscription emails
      ...
    end

    add_job_monitor :job_method => :perform, 
      :should_run => [:daily, "05:30 GMT"],
      :max_duration => 10.minutes,
      :alerts => {:email => '[email protected]',
                  :sms => '+441234567890',
                  :twitter => 'twitteruser'}

There are no comments on this comment yet.