Zabbix – Show only alerts triggered more than 40 minutes ago

Hey guys, I’m trying to create a panel in Grafana that only shows Zabbix alerts that were triggered more than 40 minutes ago. I’ve been trying to figure this out for over a week and I’ve reached a point where I don’t know what else to test. What I’ve already tried:

I use the Infinity plugin as a datasource (JSON). I make the call to the Zabbix API using the problem.get method. Then I apply Grafana transformations to try to filter and convert the data.

Where the problem is: The main blockage is converting Unix epoch time (the ‘clock’ field returned by the API) and filtering by minutes (showing only alerts that are more than 40 minutes old). I can’t get the transformation to reliably calculate the time difference and filter correctly. Has anyone encountered a similar scenario or knows how to solve this (whether with a Grafana transformation, Infinity query, or even another approach)? Any tip, query example, transformation, or reference link would help me a lot. Thank you in advance for your attention, and I’ll be waiting for any help! :folded_hands:

I understand your problem. I’m currently working on a solution for it and will get back to you shortly.

1 Like

I will be waiting for you, I thank you greatly!

please try …
Grafana Transformations
Add field from calculation → convert clock to milliseconds (clock * 1000)
Convert field type → set it as Time
Calculate age (difference) → compare with current time

Hey man, sorry for the delay in responding to you.. I was handling other pending issues and this one ended up being left behind. I will probably try this only tomorrow, but as soon as I try it and have feedback on all of this, I will get back to you here right away. Thank you for making your time available to help me.

So dude, I was even able to do the convert field type → set it as Time.

The problem is that the “age,” which would be the difference between the time the alert was generated and “$agora,” which would be the current time in epoch seconds, is not listed as a field. The “age” appears in the table column but does not appear in the Field from calculation or filter field by values transformation. So, I can’t filter the “age,” I can’t use the “age” to do other calculations, for example, convert the “age” that is in milliseconds into seconds/minutes/hours. …

Please post sample json data coming from api showing what it looks like from api and the result you want after transforming it

1 Like

At the moment of the screenshot above, I did not use the API method; I did it using query(problem). Unfortunately, I cannot show data that the API returns, it contains sensitive information.

I have already done the calculation part, my problem now is that the difference field that is generated after the operation of the alert trigger time - the current time appears as a new column in the table, but when filtering the alerts by this time difference field it does not appear in the ‘Filter by value’ transformation field (I am using the UnixTimeStamp() variable to get the current time)

Please post the structure of the json while you obfuscate the real data.