Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLA from Zabbix to Grafana is incorrect #885

Closed
lbaad opened this issue Jan 29, 2020 · 13 comments
Closed

SLA from Zabbix to Grafana is incorrect #885

lbaad opened this issue Jan 29, 2020 · 13 comments

Comments

@lbaad
Copy link

lbaad commented Jan 29, 2020

Hi Alexander

Thanks for a supreme plugin for Zabbix and Grafana
We are using it very intensive

That said, we have some issues with the SLA / IT-service calculation from Zabbix to Grafana

Our SLA is'nt correct displayed in Grafana. If we query the Zabbix API we get the correct number, but not in grafana

Example:
SLA in grafana shows 97.9647 % with "max data points" set and "This month so far" set
sla-grfana

without the max data points the result is this time the same (sometimes the SLA is more accurate when the "Max data points" are set to 100, but not always)
SLA in Zabbix shows 97.0300 for the same period
sla-zabbix
We think it's because the plugin calculates the intervals instead of just displaying the value, but you might also have an opinion about this, I think

The problem is both in Grafana 6.2.0 and the lastest release 6.5.3

Cheers
Lars
Denmark

@lbaad lbaad changed the title SLA from Zabbix to Grafana is wrong SLA from Zabbix to Grafana is incorrect Jan 29, 2020
@niklep
Copy link

niklep commented Feb 14, 2020

I confirm the problem. Look at SLA graph - last data's point has value 98.750 at 2020-02-14 05:00:00. But as you can see at graph, real last value higher. And Zabbix display value 99.0675.
Interval - 7 days.
Grafana 6.5.3, Zabbix 4.0.17.

image

@elsopapa
Copy link

same here

@mbuyukkarakas
Copy link

We have the same problem.

@niklep
Copy link

niklep commented Feb 27, 2020

I performed some diagnostics.
Results in screenshots. It's clear, that result in grafana incorrect.
grafana_sla
zabbix_web_sla_info
zapi_sla_info

@stkhansen
Copy link

I have done some digging in the code, and as far as I can see, there are a number of isssues in play here. Some also depend on the way the plugin is used in the individual case. In our use case (lbaad and me) we use singlestat panels to show a 30 day based SLA.
We have two issues:

  1. The date rounding seems to add some time to the interval. This is the Math.floor and Math.ceil part of getSLAIntervals.
  2. The interval requested for a singlestat for a month is resulting in some 32 individual intervals being requested from Zabbix and then pieced together in Grafana.

For item 2 removing the for loop in getLSAIntervals seems to do the trick, however this will not work for tables or graphs. It would probaply be better to look at the type of visualization used and then proceed based on that.

Cheers
Kristian

@kolopaa
Copy link

kolopaa commented Mar 26, 2020

I have done some digging in the code, and as far as I can see, there are a number of isssues in play here. Some also depend on the way the plugin is used in the individual case. In our use case (lbaad and me) we use singlestat panels to show a 30 day based SLA.
We have two issues:

  1. The date rounding seems to add some time to the interval. This is the Math.floor and Math.ceil part of getSLAIntervals.
  2. The interval requested for a singlestat for a month is resulting in some 32 individual intervals being requested from Zabbix and then pieced together in Grafana.

For item 2 removing the for loop in getLSAIntervals seems to do the trick, however this will not work for tables or graphs. It would probaply be better to look at the type of visualization used and then proceed based on that.

Cheers
Kristian

Where can you remove these loops? I also have differences in values.

@stkhansen
Copy link

A my mistake.
Item 2 is in the BuildSLAIntervals function, located in ZabbixAPIConnector.js.
It is this loop:
for (let i = timeFrom; i <= timeTo - slaInterval; i += slaInterval) {
intervals.push({
from : i,
to : (i + slaInterval)
});
which need to be altered like this:
intervals.push({
from: timeFrom,
to: timeTo
})

But as previously stated, this will only work for singlestat type visualizations where we need to have 1 interval returned.

Cheers
Kristian

@konstantin-kornienko
Copy link

The overall problem is that Grafana plugin requests SLA data with breaking it down to 1h intervals, then math is applied (avg etc), it's incorrect.
For tables/singlestats plugin should not break down by 1 hour intervals, instead it have to request SLA value for the whole dashboard's time range. Zabbix API will return 1 value - SLA for this period, calculated correctly.

@elsopapa
Copy link

elsopapa commented Mar 31, 2020 via email

@konstantin-kornienko
Copy link

I suppose, that plugin should be updated with new option for SLA:
SLA aggregation interval with values like this:

  • auto (current approach)
  • none (turn off splitting time range to intervals at all)
  • 1 hour
  • 6 hours
  • 12 hours
  • 1 day
  • 1 week
  • 1 month

have no time to create PR. Maybe someone could help?

@alexanderzobnin
Copy link
Collaborator

Hi! Yes, it's because of the new feature introduced recently - SLA over time. I should add interval option as @konstantin-kornienko mentioned.

@konstantin-kornienko
Copy link

@alexanderzobnin, thanks a lot for this! Tested, at first glance works as expected!

@siemgp
Copy link

siemgp commented Aug 2, 2022

Hi everyone. Please , could you send me the how to do this "update plugin the SLA aggregation interval"?

I suppose, that plugin should be updated with new option for SLA: SLA aggregation interval with values like this:

  • auto (current approach)
  • none (turn off splitting time range to intervals at all)
  • 1 hour
  • 6 hours
  • 12 hours
  • 1 day
  • 1 week
  • 1 month

have no time to create PR. Maybe someone could help?

Please, can you send me the how to do this?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants