2 ms·
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 i
by eliot_sykes 15y ago
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 => 'admin@yoursite.tld',
:sms => '+441234567890',
:twitter => 'twitteruser'}