Detailed information about how to configure and use Event Handler with RAW version

Hey folks, anyone here have more information how to configure the Event Handler using CheckMK Raw?
I found some links about it but still have some questions:

  • The /etc/nagios/conf.d is the correct place to add the file? And the events configuration need to be created inside the CheckMK server installation with the name event_handler.cfg?
  • Is that a way to test if the configuration it’s working?
  • This example bellow is a good way to how to configure the file?
extra_service_conf["event_handler_enabled"] = [
  ( "1", ["Linux"], ["Service Name"] ),

extra_service_conf["event_handler"] = [
  ( "manage_service", ["Linux"], ["Service Name"]),

extra_nagios_conf += r"""
  define command{
    command_name   manage_service
    command_line   /usr/local/bin/ $SERVICESTATE$ $SERVICESTATETYPE$ $HOSTADDRESS$

To give more context, the ideia is pretty simple, when CheckMK identify that the service are in a CRITICAL state, will run the script to restart the service.

Here the links that I found for future reference:

Here the configuration that I’m using today (All files in CheckMK server):
Files created after login with omd user: sudo su - site_name

# Main configuration file of Check_MK
# We highly recommend to use WATO to configure Check_MK these days.

extra_service_conf["event_handler_enabled"]=["1", ALL_HOSTS, ALL_SERVICES]
extra_service_conf["event_handler"]=["call_script", ALL_HOSTS, ALL_SERVICES]


define command{
  command_name   call_script
  command_line   /omd/sites/site_name/etc/nagios/conf.d/ $SERVICESTATE$ $SERVICESTATETYPE$ $HOSTADDRESS$

The script content is pretty simple:

echo "CheckMK Event Handler $1 $2 $3" >> /opt/omd/sites/site_name/var/log/check_mk_event.log

The log file don’t show anything, so that means the config is not working for some reason that I can’t identify.

Create/Modify alert handler services:

Local modifications to ~/etc/check_mk/ are stored in separate files in ~/etc/check_mk/conf.d. These files will presumably not be changed during a CMK update. That is why the alert handler settings are stored in this directory.

Folder for action scripts:

Logfile for alert handler:

Activate changes to inside the CMK instance with:

cmk -R

Hey @gerald.endres, thanks for the tips, so my CheckMK installation don’t have a file called, I will create it.
Do you have a example of the content for this file?
I’ve tried with this simple example here but the log file was not created:

define example_handler {
    command = "echo Checkmk Alert" >> /omd/sites/site_name/var/log/check_mk_event.log
    state = ["CRIT"]