Skip to content

Instantly share code, notes, and snippets.

@jippi
Created December 20, 2016 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jippi/ef1d27e445d5a3879133d0532b68a277 to your computer and use it in GitHub Desktop.
Save jippi/ef1d27e445d5a3879133d0532b68a277 to your computer and use it in GitHub Desktop.
// Scale for the job "content-themes"
job "content-themes" {
// For group "populator"
group "populator" {
// (required) The minimum nuber of tasks to run for this job
min_count = 0
// (required) The maximum number of tasks to run for this job
max_count = 1
// Scale by a rule
// Again the name does not matter for execution
rule "rabbitmq queue size" {
// (required) What backend to use, this will define which configuration
// is valid and which checks you can execute
backend = "rabbitmq"
// (required) The check type, could be anything implemented by the backend
//
// Example for rabbitmq
// - "queue_length"
// - "queue_utilization"
// - "consumer_count"
check_type = "queue_length"
// (required) The comparison do do, this supports the basic match operations like
//
// - above (>)
// - below (<)
// - equal (==)
// - not_equal (!=)
// - above_or_equal (>=)
// - below_or_equal (<=)
comparison = "above"
// (required) The value to compare to, this should be a float or integer
comparison_value = 0.9
// (optional) You can define how often this rule should be checked, by default it will me checked every minte
cron = "*/15 * * *"
// (optional) Possible actions to take if the comparison is evaluated to "true"
if_true {
// Boolean flag to decide if other rules should be processed or not
final = false
increase_count_by = 1
decrease_count_by = 1
set_count = 0
// A sample action to send notifcation to slack
notify {
type = "slack"
room = "#developers"
message = "${SCALE_NAME} moved from ${PREVIOUS_COUNT} to ${CURRENT_COUNT}"
}
}
// (optional) Possible actions to take if the comparison is evaluated to "false"
// the keys will match exactly what if_true can do
if_false {}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment