Check_mysql_health as template Service, apply Service where mysql, but i want to change the treshold on the object Host

Hi,

please take a look into formatting config blocks with Markdown, that increases readability and allows to see the important parts more quickly.

In terms of the question:

vars.warning = “80000” // Want to override this threshold in object Host
vars.critical = “100000” // Want to override this threshold in object Host

Look into conditions.

  if (host.vars.warning) {
    vars.warning = host.vars.warning
  } else {
    vars.warning = 80000
  }

Some remarks:

  • Use longer custom variable names to uniquely identify them
  • Numbers don’t need quotes becoming a string, 80000 is sufficient.
  • check_by_ssh allows for advanced techniques without having to modify the check commands all the time. There’s a blog post I’ve read today.

Cheers,
Michael