Ad Widget

Collapse

how to retrieve problem history data with mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mifftakh
    Junior Member
    • Aug 2022
    • 3

    #1

    how to retrieve problem history data with mysql

    I have a problem with zabbix problem history. I want to pull the problem history data through mysql but the recovery time is null. I want to ask how to calculate recovery time on data 24 hours ago. thanks. this is the query i use :

    Code:
    SELECT DISTINCT i.itemid,i.name,h.name,FROM_UNIXTIME(e.clock) time_event, FROM_UNIXTIME(p.r_clock),
    t.expression,e.`value` status_event,t.value status_trigger, i.value_type,t.recovery_expression,
    t.triggerid,e.eventid,e.`name`
    FROM items i
    LEFT JOIN `hosts` h ON(i.hostid = h.hostid)
    LEFT JOIN hosts_groups g ON (h.hostid = g.hostid)
    LEFT JOIN functions f ON (i.itemid = f.itemid)
    LEFT JOIN triggers t ON (f.triggerid = t.triggerid)
    JOIN `events` e ON (e.objectid=t.triggerid)
    LEFT JOIN problem p ON (e.eventid=p.eventid)
    WHERE h.maintenance_status = 0
    AND g.groupid IN (25,26,27,28,29,30,31,32,33,34,35,36)
    AND t.priority = 5
    AND e.source = 0
    AND e.object =0
    AND FROM_UNIXTIME(e.clock) BETWEEN '2022-08-22 00:00:00' and '2022-08-22 23:59:59'
Working...