Ad Widget

Collapse

Query to get list of data from Zabbix PostgreSQL DB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abel5405
    Member
    • Jan 2019
    • 47

    #1

    Query to get list of data from Zabbix PostgreSQL DB

    So I was inspired by the Disk Space post from https://www.zabbix.com/forum/zabbix-...k-space-report and have been learning to do custom reports out of Zabbix. I am having a problem though with the date part feature. I am trying to get the values collected in the last 5 minutes but I don't think "EXTRACT(minutes from now()-(select to_timestamp (clock))) > 6" works as I thought it does. Can anybody help me with this query to pull only those values in the last 5 minutes? Many thanks as always for your help.

    select
    h.host, i.name,t.value, (select to_timestamp (t.clock)) as time
    from
    hosts h
    left join items i on h.hostid = i.hostid
    left join history_text t on i.itemid = t.itemid
    where
    EXTRACT(minutes from now()-(select to_timestamp (clock))) > 6
    and
    t.value is not null
    order by clock desc
Working...