Custom Host Macro in Service


#1

Hi.

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?

tia


#2

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.
http://forums.meulie.net/t/passing-paramater-to-email-script/6151


#3

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.