API access coming from Zabbix going wrong?

Infos:

  • Used Zammad version: 3.5.0-1603788665.5a776fce.bionic
  • Used Zammad installation source: (source, package, …) : packages
  • Operating system: Ubuntu 18.04
  • Browser + version: Firefox 87.0

Expected behavior:

  • That I would see a new ticket in my ticket queue

Actual behavior:

  • I don’t see a new ticket in my ticket queue :slight_smile:
  • I see the Zammad database containing a new record:
    204 | 1 | 2 | 1 | 2 | 85204 | Problem: cyrus-imapd service not running
  • When opening ticket 85204 I see: Oops… I’m sorry, but you have insufficient rights to open this Ticket.
  • I am the admin of the system. I can’t seem to find, let alone, open the newly created ticket.
  • Maybe there is something missing in the initial api call to create the ticket. But how to find out?

Steps to reproduce the behavior:

  • I trigger an alert in Zabbix monitoring.
  • I see zabbix making an API call to Zammad using a Zabbix media action and running a Javascript to call the api url with a token and several fields.
  • If you really like to know, this is what Zabbix logging tells me:
    2023863:20210327:083954.729 [ Zammad Webhook ] Sending request: http://zammad.thuis.local/api/v1/tickets {“title”:“Problem: cyrus-imapd service not running”,

“group”:“Users”,
“article”:{“subject”:“Problem: cyrus-imapd service not running”,

“body”:“Problem: cyrus-imapd service not running\nProblem started at 08:39:50 on 2021.03.27\r\nProblem name: cyrus-imapd service not running\r\nHost: inzicht\r\nSeverity: High\r\nOperational data: 1\r\nOriginal problem ID: 767261\r\n[nhttp://zammad.thuis.local/tr_events.php?triggerid=16096&eventid=767261\n](nhttp://zammad.thuis.local/tr_events.php?triggerid=16096&eventid=767261%5Cn)”,

“type”:“note”,
“internal”:false},
“customer”:“jbaten@i2rs.nl”}

2023863:20210327:083954.906 [ Zammad Webhook ] Received response with status code 201: {“id”:204,
“group_id”:1,
“priority_id”:2,
“state_id”:1,
“organization_id”:2,
“number”:“85204”,
“title”:“Problem: cyrus-imapd service not running”,
“owner_id”:1,
“customer_id”:3,
“note”:null,
“first_response_at”:null,
“first_response_escalation_at”:null,
“first_response_in_min”:null,
“first_response_diff_in_min”:null,
“close_at”:null,
“close_escalation_at”:null,
“close_in_min”:null,
“close_diff_in_min”:null,
“update_escalation_at”:null,
“update_in_min”:null,
“update_diff_in_min”:null,
“last_contact_at”:null,
“last_contact_agent_at”:null,
“last_contact_customer_at”:null,
“last_owner_update_at”:null,
“create_article_type_id”:10,
“create_article_sender_id”:1,
“article_count”:1,
“escalation_at”:null,
“pending_time”:null,
“type”:null,
“time_unit”:null,
“preferences”:{},
“updated_by_id”:3,
“created_by_id”:3,
“created_at”:“2021-03-27T07:39:54.771Z”,
“updated_at”:“2021-03-27T07:39:54.870Z”,
“article_ids”:[1225],
“ticket_time_accounting_ids”:[]}

  • This is the Zammad logging:

I, [2021-03-27T08:39:54.730921 #27729-47262643903740] INFO – : Started POST “/api/v1/tickets” for 10.1.1.1 at 2021-03-27 08:39:54 +0100
I, [2021-03-27T08:39:54.733082 #27729-47262643903740] INFO – : Processing by TicketsController#create as /
I, [2021-03-27T08:39:54.733116 #27729-47262643903740] INFO – : Parameters: {“title”=>“Problem: cyrus-imapd service not running”, “group”=>“Users”, “article”=>{“subject”=>“Problem: cyrus-imapd service not running”, “body”=>"[FILTERED]", “type”=>“note”, “internal”=>false}, “customer”=>“jbaten@i2rs.nl”}
I, [2021-03-27T08:39:54.759420 #27729-47262643903740] INFO – : Enqueued UserDeviceLogJob (Job ID: 17fd68bb-2702-4f38-88a1-b84bceabe1b9) to DelayedJob(default) with arguments: nil, “10.1.1.1”, 3, nil, “token_auth”
I, [2021-03-27T08:39:54.810124 #27729-47262643903740] INFO – : Enqueued SearchIndexJob (Job ID: 9d529fe7-d854-43de-b89c-55abe7ab7375) to DelayedJob(default) with arguments: “Ticket”, 204
I, [2021-03-27T08:39:54.812045 #27729-47262643903740] INFO – : Enqueued SearchIndexAssociationsJob (Job ID: af075753-d11e-4fd0-a678-ffd9935ac9ca) to DelayedJob(default) with arguments: “Ticket”, 204
I, [2021-03-27T08:39:54.815971 #27729-47262643903740] INFO – : Enqueued SearchIndexJob (Job ID: 6268a7c6-339d-451a-ad06-2cb0e10ac70a) to DelayedJob(default) with arguments: “User”, 3
I, [2021-03-27T08:39:54.818991 #27729-47262643903740] INFO – : Enqueued SearchIndexJob (Job ID: 3c21cb18-33d5-4b43-ac99-85f00eb8e90c) to DelayedJob(default) with arguments: “Organization”, 2
I, [2021-03-27T08:39:54.846135 #27729-47262643903740] INFO – : Enqueued TicketUserTicketCounterJob (Job ID: ee6e87c6-a175-4105-bb7f-446b72e76a39) to DelayedJob(default) with arguments: 3, 3
I, [2021-03-27T08:39:54.873643 #27729-47262643903740] INFO – : Won’t enqueue SearchIndexJob (Job ID: 5fbb8a26-c216-4a3d-9889-77537872a4a4) because of already existing job with lock key ‘SearchIndexJob/Ticket/204’.
I, [2021-03-27T08:39:54.873720 #27729-47262643903740] INFO – : Enqueued SearchIndexJob (Job ID: 5fbb8a26-c216-4a3d-9889-77537872a4a4) to DelayedJob(default) with arguments: “Ticket”, 204
I, [2021-03-27T08:39:54.874110 #27729-47262643903740] INFO – : Won’t enqueue SearchIndexAssociationsJob (Job ID: 37c9ca03-e008-4d7e-8e09-e8f4736af4c1) because of already existing job with lock key ‘SearchIndexAssociationsJob/Ticket/204’.
I, [2021-03-27T08:39:54.874163 #27729-47262643903740] INFO – : Enqueued SearchIndexAssociationsJob (Job ID: 37c9ca03-e008-4d7e-8e09-e8f4736af4c1) to DelayedJob(default) with arguments: “Ticket”, 204
I, [2021-03-27T08:39:54.875656 #27729-47262643903740] INFO – : Won’t enqueue SearchIndexJob (Job ID: e14d6ed7-f61b-438c-9650-b8f781bb5360) because of already existing job with lock key ‘SearchIndexJob/User/3’.
I, [2021-03-27T08:39:54.875710 #27729-47262643903740] INFO – : Enqueued SearchIndexJob (Job ID: e14d6ed7-f61b-438c-9650-b8f781bb5360) to DelayedJob(default) with arguments: “User”, 3
I, [2021-03-27T08:39:54.877066 #27729-47262643903740] INFO – : Won’t enqueue SearchIndexJob (Job ID: cfcea1e0-616b-4b5c-b3be-a9eadce1cebd) because of already existing job with lock key ‘SearchIndexJob/Organization/2’.
I, [2021-03-27T08:39:54.877119 #27729-47262643903740] INFO – : Enqueued SearchIndexJob (Job ID: cfcea1e0-616b-4b5c-b3be-a9eadce1cebd) to DelayedJob(default) with arguments: “Organization”, 2
I, [2021-03-27T08:39:54.884509 #27729-47262643903740] INFO – : Won’t enqueue TicketUserTicketCounterJob (Job ID: c8f02edb-ba12-4bb6-aea0-3fee2a2d2362) because of already existing job with lock key ‘TicketUserTicketCounterJob/3/3’.
I, [2021-03-27T08:39:54.886645 #27729-47262643903740] INFO – : Enqueued TicketUserTicketCounterJob (Job ID: c8f02edb-ba12-4bb6-aea0-3fee2a2d2362) to DelayedJob(default) with arguments: 3, 3
I, [2021-03-27T08:39:54.905942 #27729-47262643903740] INFO – : Completed 201 Created in 173ms (Views: 0.3ms | ActiveRecord: 108.7ms)

Solved.

Right. So I send a ticker from Zabbix to Zammad/me. Ticket was created in the database but I did not have access to it.

I added ‘guess’ to the api call so ‘guess:user@domain.tld’.

I checked the checkbox for me being customer (I was already admin and agent) and now I can see these new tickets.

Still weird. Shouldn’t admin be always allowed to see tickets?

Anyway, solved now, so I’m happy.

Turns out I was not yet as happy as I could be. :slight_smile:
Yes, I can see the ticket text. I can open and close the ticket via the “status” widget.
But there does not seem to be any context around the ticket. Like organization.
The field widgets that I usually see and not with this ticket are: Group, Owner, Priority, Labels, Linked to, Time units.

Looks like the tickets appear in the ‘unassigned and open’ list of tickets. I am the admin but can not assign the ticket to somebody (me).

Adding some columns to this view I see that these tickets have no owner. Sure, but how to assign them to somebody?

Ah, ok. These tickets have been assigned to the group ‘users’ and I have disabled the group ‘users’ because I use 2 other groups for my internal workload. So enabling the group ‘users’ and add ign full rights to this group to user me.

Yes, now I see al created tickets and can reassign.

Next step is figuring out how I can use the API to assign created tickets to another group.

Duh! It’s right there in the docs: “group”: “Users”.
Okay, so it’s hard coded in the Zabbix javascript for this Zabbix media type.
This won’t do. Making it configurable.
Closing this article.

1 Like

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