Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.
/ puppet-cron Public archive

A super great cron Puppet module with timeouts, locking, monitoring, and more!

License

Notifications You must be signed in to change notification settings

Yelp/puppet-cron

Repository files navigation

puppet-cron

Build Status

A super great cron Puppet module with timeouts, locking, monitoring, and more!

WARNING: This module still has some "Yelpisms". Watch out!

Please open an issue if you encounter one. Bonus points for a PR!! :)

Description

Cron is the foundation of any great architecture. Don't let anyone else tell you differently :)

If you are going to deploy cron jobs, do it right.

There is, however, a fine line between using cron to do scheduled tasks, and abusing cron where a better system should be used.

Examples

Minimal job config:

cron::d { 'minimum_example':
  minute  => '*',
  user    => 'root',
  command => '/bin/true',
}

Full example high-frequency job with all optional params:

cron::d { 'name_of_cronjob':
  second  => '*/20',
  minute  => '*',
  hour    => '*',
  dom     => '*',
  month   => '*',
  dow     => '*',
  user    => 'bob',
  mailto  => 'example@example.com',
  command => '/some/example/job',
}

Monitoring Params

This cron module optionally integrates with Yelp's monitoring_check module to add monitoring to your cron job. You can use the following params to tune this monitoring:

  • staleness_threshold: A human-readable time unit ('24h', '5m', '3s') representing how long it is acceptable for the cron job to be failing before sending an alert.
  • staleness_check_params: A hash of any parameter to monitoring_check.

This makes it very easy to get alerts for cron jobs when they start failing, while re-using any existing notification options that your Sensu infrastructure has.

Example: An important cron job that makes tickets after failing for 24h hours:

cron::d { 'name_of_cronjob':
  minute                 => '0',
  hour                   => '4',
  user                   => 'root',
  command                => 'fortune';
  staleness_threshold    => '24h',
  staleness_check_params => {
    'team'    => 'operations',
    'ticket   => true,
    'project' => 'FORTUNE',
  },
}

License

Apache 2.

Contributing

Open an issue or fork and open a Pull Request