ID: 8025
Title: Add all custom variables of host, service and contact to notification
Component: cmc
Level: 2
Class: New feature
Version: 1.2.5i1
The CMC now automatically adds all custom variables of hosts, service and
contacts to the notification context. The variable name is prefixed with
the word <tt>HOST</tt>, <tt>SERVICE</tt> or
<tt>CUSTOM</tt> and - as its
variable name custom - converted to upper case. So a host variable with
the name <tt>_foobar</tt> will be available as
<tt>HOST_FOOBAR</tt> in the
notification context. The names will be prefixed with <tt>NOTIFY_</tt> and
put
into the environment of the notification plugin. So at the end the variable
will be available as <tt>NOTIFY_HOST_FOOBAR</tt>, e.g. in a shell script:
F+:mynotify.sh
echo "Foobar: $NOTIFY_HOST_FOOBAR"
F-:
H2:Notes
<ul>
<li>In the configuration files in <tt>main.mk</tt> or below
<tt>conf.d</tt>
the variables can be set via <tt>extra_host_conf</tt> or
<tt>extra_service_conf</tt>.
You need to have the variable names begin with an underscore. So a variable name of
<tt>foobar</tt>
is not allowed. You have to write either <tt>_foobar</tt> or
<tt>_FOOBAR</tt>.</li>
<li>When you add contact custom variables via WATO (button <i>Custom
Attributes</i>
in the users management</i>) the underscore will <i>automatically</i> be
added.</li>
<li>when using Nagios as monitoring core you have to adapt
<tt>check_mk_templates.cfg</tt>
whenever you add a new custom variable.</li>
</ul>
Show replies by date