CheckMK integration and API object attributes

Infos:

  • Used Zammad version: 6.2.0-1709189301.4a2dd7d0.jammy
  • Used Zammad installation type: package
  • Operating system: ubuntu 22.04
  • Browser + version: Firefox 123.0 (64-bit)

Expected behavior:

Goal is to generate tickets based on CheckMK notifications in dedicated group(s) for specific organization(s), for both services and hosts.

The notification calls the Zammad API according to the CheckMK integration settings and adds attributes like group_id and organization_id, by doing this the ticket is created in the appropriate group for the defined organization and the overviews can be filtered by

  • group is Monitoring group(s)
  • organization is current user organization
  • When the API using curl is called to test the API and ticket object attributes like group_id and organization_id are added, that also organization_id attribute is set in the newly created ticket

Actual behavior:

  • The group is set correctly, the organization is not
    organization_id is not set (nil)
    image

Steps to reproduce the behavior:

Set up Organization(s)
Set up Group(s)
Set up CheckMK integration
Get group_id and organization_id using rails console commands

Test curl API call with defined group_id and organization_id
The group is set correctly, the organization is not

export NOTIFY_HOSTPROBLEMID=123
export NOTIFY_HOSTNAME=SC-154518-01-01
export NOTIFY_HOSTSTATE="DOWN"
export NOTIFY_HOSTOUTPUT="CRITICAL - Host unreachable @ rta nan, lost 100%"


curl -k -X POST \
  -F "event_id=$NOTIFY_HOSTPROBLEMID" \
  -F "host=$NOTIFY_HOSTNAME" \
  -F "state=$NOTIFY_HOSTSTATE" \
  -F "text=$NOTIFY_HOSTOUTPUT" \
  -F "group_id=13" \
  -F "organization_id=8" \
  https://zammad.example.com/api/v1/integration/check_mk/<token> 

Additional notes

Is adding the organization(s) to the customer_id: 1 (System), the correct solution for this issue?

I also tried to set a customer_id=3 which is member of the organization_id=8 but that did not work either.

export NOTIFY_HOSTPROBLEMID=123
export NOTIFY_HOSTNAME=SC-154542-01-01
export NOTIFY_HOSTSTATE="DOWN"
export NOTIFY_HOSTOUTPUT="CRITICAL - Host unreachable @ rta nan, lost 100%"


curl -k -X POST \
  -F "event_id=$NOTIFY_HOSTPROBLEMID" \
  -F "host=$NOTIFY_HOSTNAME" \
  -F "state=$NOTIFY_HOSTSTATE" \
  -F "text=$NOTIFY_HOSTOUTPUT" \
  -F "group_id=13" \
  -F "organization_id=8" \
  -F "customer_id=3" \
  https://zammad.example.com/api/v1/integration/check_mk/<token> 

image

Is it required to add support for organization_id in check_mk_controller.rb or something different?

Any pointer/idea/workaround would be greatly appreciated.

Thanks

What I tried today:

  • Created dedicated automation user
  • Added automation user to all organizations for monitoring
  • Extracted automation user_ID using the rails console: user_ID: 3
  • Changed line 104 of /app/controllers/integration/check_mk_controller.rb and changed ID from 1 (System) to 3 (automation user)
  • Restart zammad systemctl restart zammad
  • Pushed a notification

In this case the customer_id is set to 3 and the group_id is correctly set to 8
image

Which works fine enough for my needs.
This is risky since it will be overwritten ad every update, but in my limited knowledge of how Zammad works, this is the best possible solution.

It would be nice if the “if customer not found use customer_ID:1” could be parametrized in the webGUI.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.