Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5077

Calculation error in 95th percentile

XMLWordPrintable

      Hi,

      I'd like to use the 95th percentile for billing purposes, but since the api or frontend doesn't support getting the value directly I have to calculate it mysql. But no matter how I calculate the value, it is always high than the value displayed in the graph.

      As you can see in the attached graph, the 95th percentile is 5,72Gb/s. But when I calculate (n=95/100*550+1/2) the percentile from the mysql data:

      mysql> select count(*) from history_uint where itemid = 39167;                       
      +----------+                                                                         
      | count(*) |                                                                         
      +----------+                                                                         
      |      550 |                                                                         
      +----------+                                                                         
      1 row in set (0.00 sec)                                                              
      
                                                                                           
      mysql> select * from history_uint where itemid = 39167 order by value desc limit 25,5;                                                                           
      +--------+------------+------------+-----------+                                     
      | itemid | clock      | value      | ns        |                                     
      +--------+------------+------------+-----------+                                     
      |  39167 | 1337971067 | 5959796816 | 567141320 |                                     
      |  39167 | 1337977367 | 5933375808 | 808058345 |                                     
      |  39167 | 1337969567 | 5923229816 | 167354372 |                                     
      |  39167 | 1337978567 | 5916897936 | 794447090 |                                     
      |  39167 | 1337968967 | 5890801240 | 184057883 |                                     
      +--------+------------+------------+-----------+                                     
      5 rows in set (0.05 sec)
      

      You can have a discussion if you should the number up or down, but if I use my calculation to get the value displayed in the graph, it would actually be ~90th percentile:

      mysql> select * from history_uint where itemid = 39167 order by value desc limit 52,5
          -> ;                                                                             
      +--------+------------+------------+-----------+                                     
      | itemid | clock      | value      | ns        |                                     
      +--------+------------+------------+-----------+                                     
      |  39167 | 1338055967 | 5743761168 | 738804166 |                                     
      |  39167 | 1338114768 | 5727882896 | 184340026 |                                     
      |  39167 | 1338062867 | 5723286872 |  31496589 |                                     
      |  39167 | 1338060467 | 5723070512 | 802785945 |                                     
      |  39167 | 1338061667 | 5718211304 | 693634107 |                                     
      +--------+------------+------------+-----------+                                     
      5 rows in set (0.05 sec)
      

      This would create problems for people that display graphs to customers including the 95th percentile, but as in my case, bill on a higher value. I've included a dump of the data for this item.

        1. dump.txt
          20 kB
          Attilla de Groot
        2. graph_percentile.png
          78 kB
          Attilla de Groot

            Unassigned Unassigned
            attilla Attilla de Groot
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: