CheckMK Custom Host Attributes missing in Notifications

CMK version: Checkmk Raw Edition 2.3.0p17

OS version: Oracle Linux 9

Error message: Custom Host Attributes missing in Notifications

Hi together,

im using checkmk RAW Edition but i noticed that my Custom Host Attributes in Notifications are missing.

Here ist how i added the values:

i sent a Notification and my custom fields are missing.

All Custom fields are missing in the “Complete variable list” in my Notification.

Is there anything i can do to get this solved?

Thank you and Regards

Hi again,

seems this is a missing Feature in RAW Edition.

If you want to have those labels in RAW Edition too, this is a Solution:

You need to modify the mail plugin and add the values to the context.
After this the mail plugin runs correctly with the missing host attributes

class SingleEmailContent(EmailContent):
    def __init__(self, context_function: Callable[[], dict[str, str]]) -> None:
        # gather all options from env
        context = context_function()

        ######KPC PART FOR ADDING HOST ATTRIBUTE SUPPORT IN RAW EDITION___START######
        hostattributes=subprocess.getoutput(f"""lq "GET hosts\nColumns: custom_variable_names custom_variable_values\nOutputFormat: json\nFilter: host_name = {context['HOSTNAME']}" """)
        hostattributes=json.loads(hostattributes)

        #with open('/opt/omd/sites/raw_monitoring/test1.log','a') as file:
            #file.write(json.dumps(hostattributes,indent=4))
        for k, v in hostattributes:
            res = {keys: [i for _, i in sub] for keys, sub in groupby(zip(k, v), key = itemgetter(0))}
            res=str(res)
            res=res.replace("[","")
            res=res.replace("]","")
            res=ast.literal_eval(res)
            res={f'HOST_{k}': v for k, v in res.items()}


        context = context|res

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