Disabling/enabling event handler with api

Hello everyone,

I am trying to disable/enable event handler feature of a specific service by using API . However, I couldn’t make it .
Extra note : (I am using Icinga director).

I tried to curl like this :

curl -k -s -u credential:credential -H 'Accept: application/json' -X PUT -d '{"attrs":{"enable_event_handler": false}}' https://localhost:5665/v1/objects/services/[ServiceName]?pretty=1

However it returns an error like below :

"results": [
        {
            "code": 500,
            "errors": [
                "Error: Invalid Service name.\n"
            ],
            "status": "Object could not be created."
        }
    ]

why don’t you create two servicetemplate.

  • one withour eventhandler set
  • one with eventhandler set, inheriting the first one
  • apply different servicetemplates to the hosts

Hi Moreamazingnick,

It is because I created my own model to start/stop processes . I want to disable Event Handler when I click Stop process button as well . When I stop the process , 1 min later event handler starts it automatically right now .