Ad Widget

Collapse

ZabbixDB Table Relations Events Hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CaptainNemo
    Junior Member
    • Nov 2023
    • 3

    #1

    ZabbixDB Table Relations Events Hosts

    Hey Guys,
    I want to extract some Collums from the tables in Zabbix DB, the goal is to have an Event or a Problem with the host it associates.
    The Issue is that the tables which hold event id's have no relations with the Tables that hold the host id's, i tried to find a path that will have a common ground yet it i just can't.
    How can merge the Problem with the related host id? for simple table report.

    best regards,



  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    An event can relate to multiple hosts. The api may be better. Events refer to a trigger, you have to decode the trigger expression to get itemids, then get item to get hosts.

    Comment

    • CaptainNemo
      Junior Member
      • Nov 2023
      • 3

      #3
      well i succeeded in correlating a trigger with host through items, yet i can't get the event table to relate to the triggers, i need a timestamp for when a problem for a host happened,
      to cut to the chase, i cant find a way that the Event table refers to the triggers.

      Comment

      • CaptainNemo
        Junior Member
        • Nov 2023
        • 3

        #4
        Found the Connection, The ObjectID field in the eventid containting Tables, such as Events ,Problems etc, holds Values which relate to triggerid, the indicator to which table the objectid relates is according to object and source/
        When source =0 and object = o the objectid = triggerid, so from there trigger id relates to itemid and itemid to hostid and hostname.

        example:

        SELECT
        CASE WHEN p.clock = 0 THEN NULL ELSE to_timestamp(p.clock) END AS problem_time,
        t.description AS problem_description,
        h.host AS host_name,
        p.name AS problem_name
        FROM
        problems p
        JOIN
        triggers t ON p.objectid = t.triggerid
        JOIN
        functions f ON f.triggerid = t.triggerid
        JOIN
        hosts h ON h.hostid = f.hostid
        WHERE
        p.source = 0
        AND p.object = 0

        the source and object references




        Comment

        Working...