Ad Widget

Collapse

API: trigger.get returning internal triggers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • uKaNU
    Junior Member
    • Mar 2015
    • 4

    #1

    API: trigger.get returning internal triggers

    Hi all,

    I'm using the api to determine which issues are still 'active' by looking at the trigger value then retrieving the related events.

    Background:
    However, trigger.get is returning some triggers that only contain internal events. (Which I did not expect it to do, as the documentation seems to state that internal event 'triggers' are different to triggers, but I do see them in the triggers table).
    but, after passing the triggerid to Event.Get, it does not have access to these events? (I know they exists because I checked it in the database) Is it possible to have access to the trigger but not the related event? I have checked the user permissions in Zabbix and it's got everything.


    How do I filter out/identify these 'internal' triggers when I call trigger.get

    Thanks.
  • BDiE8VNy
    Senior Member
    • Apr 2010
    • 680

    #2
    Internal events are not created by triggers but can be created for triggers.
    See process_trigger() function in db.c:
    Code:
                            if (0 != state_changed)
                            {
                                    add_event(0, EVENT_SOURCE_INTERNAL, EVENT_OBJECT_TRIGGER, trigger->triggerid,
                                                    &trigger->timespec, new_state, trigger->description,
                                                    trigger->expression_orig, trigger->priority, trigger->type);
     
                                    zbx_snprintf_alloc(sql, sql_alloc, sql_offset, "state=%d,", new_state);
                            }
    The trigger.get() API method should actually not return any internal event (even when related to triggers).

    Internal events can afaik only be exposed by the event.get() API method (see 'source' object property)

    Comment

    • uKaNU
      Junior Member
      • Mar 2015
      • 4

      #3
      Thanks for your reply. I just got back from leave.

      It looks like these internal events are created by a trigger.
      (Please see my attachment)
      As I can retrieve the trigger with trigger.get, but passing the triggerid to event.get in the objectids parameter gives me nothing since all the events belonging to these triggers have the source marked as "internal event"
      Either way, something is not right here. If the events are "Internal" then why give me the trigger in the first place and if its decided to include these triggers, then why event.get does not return events belonging to these triggers?

      I have worked around it now, by going one step further and looking for the existence of events for all returned triggers.
      Attached Files

      Comment

      Working...