Unable to get custom service attributes in notification plugin but able to see them via live statuscolumn

Hi, I defined a custom_service_attribute named SOP and gave it a dummy value as “TEXT” and it is available in services of localhost.

Please find below:

custom_variable_names;custom_variable_values;custom_variables;
SOP;Text;SOP|Text;

As per the documentation [https://checkmk.com/werk/7185], these values would be sent to the notification plugin as SERVICE_[ID] where ID is the ID of the Custom service attribute right? But I checked the environment variables that are sent to the notification plugin and it is not available. In fact, I listed all the environment variables and it wasn’t available.

I also cross checked in this file [ ~/var/check_mk/notify/backlog.mk]

Kindly find below an example present in the backlog.mk file

{‘SERVICENOTIFICATIONNUMBER’: ‘0’, ‘HOSTALIAS’: ‘localhost’, ‘HOSTADDRESS’: ‘127.0.0.1’, ‘SERVICESTATE’: ‘OK’, ‘HOSTACKAUTHOR’: ‘’, ‘SERVICEATTEMPT’: ‘1’, ‘SERVICEACKCOMMENT’: ‘’, ‘SERVICEPERFDATA’: ‘util=5.142038;20;30;0;600 util_average=4.389062;20;30;0;600’, ‘LASTHOSTSTATEID’: ‘0’, ‘NOTIFICATIONAUTHORNAME’: ‘cmkadmin’, ‘HOSTNAME’: ‘localhost’, ‘HOSTSTATEID’: ‘0’, ‘SERVICECHECKCOMMAND’: ‘check_mk-docker_container_cpu’, ‘HOST_ADDRESS_4’: ‘127.0.0.1’, ‘CONTACTEMAIL’: ‘’, ‘LONGHOSTOUTPUT’: ‘’, ‘HOST_ADDRESS_6’: ‘’, ‘SERVICEPROBLEMID’: ‘0’, ‘LASTHOSTSTATECHANGE’: ‘1611555159’, ‘NOTIFICATIONCOMMENT’: ‘TEST’, ‘CONTACTNAME’: ‘check-mk-notify’, ‘CONTACTPAGER’: ‘’, ‘SERVICEACKAUTHOR’: ‘’, ‘HOST_ADDRESS_FAMILY’: ‘4’, ‘HOSTGROUPNAMES’: ‘check_mk’, ‘HOSTOUTPUT’: ‘OK - 127.0.0.1: rta 0.121ms, lost 0%’, ‘LONGDATETIME’: ‘Tue Jan 26 16:53:17 IST 2021’, ‘LASTHOSTSTATE’: ‘UP’, ‘SERVICEDESC’: ‘CPU utilization’, ‘HOSTDOWNTIME’: ‘0’, ‘HOSTTAGS’: ‘/wato/ auto-piggyback cmk-agent ip-v4 ip-v4-only lan no-snmp prod site:cmk tcp’, ‘LASTSERVICESTATEID’: ‘0’, ‘HOSTNOTIFICATIONNUMBER’: ‘0’, ‘HOSTSTATE’: ‘UP’, ‘SERVICESTATEID’: ‘0’, ‘HOSTATTEMPT’: ‘1’, ‘HOSTACKCOMMENT’: ‘’, ‘HOSTPERFDATA’: ‘rta=0.121ms;200.000;500.000;0; pl=0%;80;100;; rtmax=0.208ms;;;; rtmin=0.015ms;;;;’, ‘LONGSERVICEOUTPUT’: ‘’, ‘NOTIFICATIONAUTHOR’: ‘cmkadmin’, ‘LASTSERVICESTATECHANGE’: ‘1611654751’, ‘HOSTCHECKCOMMAND’: ‘check-mk-host-ping!-w 200.00,80.00% -c 500.00,100.00%’, ‘LASTHOSTUP’: ‘1611660137’, ‘SERVICEGROUPNAMES’: ‘’, ‘SERVICEOUTPUT’: ‘OK - Total CPU (5min average): 4.39%’, ‘HOSTPROBLEMID’: ‘0’, ‘LASTSERVICESTATE’: ‘OK’, ‘DATE’: ‘2021-01-26’, ‘SHORTDATETIME’: ‘2021-01-26 16:53:17’, ‘NOTIFICATIONTYPE’: ‘CUSTOM’, ‘LASTSERVICEOK’: ‘1611660186’, ‘NOTIFICATIONAUTHORALIAS’: ‘cmkadmin’}

code_snippet to get all envi. variables

def total_var() -> Dict[str, str]:
return {
var: value
for var, value in environ.items()
}

total_out = total_var()

I checked by printing total_out but the Custom service attributes were not available.

Kindly help! Thanks.

Finally figured out the answer.

Added this line in checkmk_templates.cfg
NOTIFY_SERVICE_SOP=’$_SERVICESOP$’ \

In env variables, we can see the value now:
‘NOTIFY_SERVICE_SOP’: ‘Text’

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.