How to add custom service attribute inside service notification

I believe there is an issue in the raw edition of the Nagios configuration. I have tested it with versions 2.2p14 and 2.2p18. The problem is that custom attributes do not appear in the context according to the documentation.

However, I have managed to make adjustments in the ~/etc/nagios/conf.d/check_mk_templates.cfg file. Specifically, I added the Host custom attribute with ‘JB_CUSTOM’ and the Service custom attribute with ‘JB_ATTR_CUST’.

      NOTIFY_HOST_ADDRESS_FAMILY='$_HOSTADDRESS_FAMILY$' \
       NOTIFY_HOST_JB_CUSTOM='$_HOSTJB_CUSTOM$' \
       NOTIFY_SERVICE_JB_CUSTOM1='$_SERVICEJB_ATTR_CUST$' \
       check_mk --notify
}

It’s important to note that in the Nagios configuration, the prefix ‘_HOST’ or ‘_SERVICE’ should precede the name of the custom attribute.

After the change, restart the site.

In the context, the name of the attribute should match the Nagios notification attribute name, as illustrated in the figure below:
image

Please, test.