grafana / grafana-zabbix

Zabbix plugin for Grafana dashboard
http://play.grafana-zabbix.org
Apache License 2.0
2.06k stars 458 forks source link

Implement last/first to aggregateBy #505

Open rrg92 opened 6 years ago

rrg92 commented 6 years ago

I'm submitting a ...

What did you do?

Able to get last or first value in a interval using aggregateBy or another function, if need.

What was the expected result?

The value of point will be the last or first value to a given interval. For example, aggregateBy(1d, last) must return last value in the resulting serie of interval "1d". Just like other functions do (avg, min, max), just allow get first or last. (if possible, we can specifu a Nth position. But first or last is good for while!)

What happened instead?

Not implemented yet. Just avg, max and min is supported.

alexanderzobnin commented 6 years ago

Could you describe your use case?

rrg92 commented 6 years ago

We want to analyze data considering last value of a period. For example, we want see what the disk used size on start (or end) of each month. For this, getting the last or first value using aggregateBy, we give the desired result. We will able to see the raw data without any calculation at given period.

alexanderzobnin commented 6 years ago

@rrg92 not sure aggregateBy() will work as you expect in your case. It aggregates by fixed intervals like 1 hour, 1 day, 30 days, but not a month from calendar.

rrg92 commented 6 years ago

@alexanderzobnin , sure. Let me explain better. Today, the avg value calculates by fixed interval. I was able to generate avg per month. My dashboard show, in every first day of last 12 months, the average. If, in place of avg, i would can get the last value (avg needs scan all values in the set, then, getting last dont change many things, you agree this?) then, this we give me the desired result.

alexanderzobnin commented 6 years ago

@rrg92 actually, it isn't so hard to implement last as aggregation function, so I'll try to add it anyway.

rrg92 commented 6 years ago

Thanks!

adrianlzt commented 6 years ago

I have a different use case for "last" aggregation. I want to expose the number of servers for a particular hostgroup. Using "last" + "count" will be easy to get that result.

Another use case si to obtain the total memory sum for all servers. "last" + "sum" will be handy also.

Woutch commented 5 years ago

Any update on this issue? I have the same problem. I have several items loaded from LLD which are booleans ( 1 or 0).

I need to show a count of how many are 1 and how many are 0.

Other ideas are also welcome ;-)

Thanks!

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had activity in the last 2 years. It will be closed in 60 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!