Custom Host Macro in Service



Is it possible to pass a custom host macro into a service command? And if so how?

For example, if I have these arbitrary settings?

define command {
  command_name  check_thing
  command_line     $user1$/check_thing --arg1=$ARG1$ --arg2=$ARG2$

define host {
 host_name  host1
  _customvalue  X

define service {
  host_name           host1
  check_command   check_think!12!$_HOSTCUSTOMVALUE$        <--- want to pass in here

does that make sense?



I believe that you can do exactly what you are suggesting. The syntax is just about what you are using. The only hitch I’ve found is on hosts that don’t have this custom macro defined.

I recently did the exact same thing for an email alert solution.


You know what? You are right, exactly as I typed it above it works!

When I was testing it in my conf, I think I was forgetting that custom macros need the $_ to prefix them.

It works just as I need now.