Ad Widget

Collapse

PATCH [1.3.9] delta() function can (and does) work with integers too

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Farzad FARID
    Member
    • Apr 2007
    • 79

    #1

    PATCH [1.3.9] delta() function can (and does) work with integers too

    Hi,

    I spent a few hours trying to understand why I couldn't calcultate the delta() of an item. I finally debugged the problem and found that delta() only works for floats and not integers!

    The Zabbix documentation is not precise on this point, as it doesn't say which functions support floats, or integers, or both. Could you please update it on this point ?

    As max() and min() support integers, I asked myself why not delta() ? And so I wrote a patch

    It works on a Fedora Core 5 64 bits. I tested it with both the delta(seconds) syntax and the delta(#count) syntax.

    Please consider my patch for inclusion and update the Zabbix documention consequently.

    Regards
    Attached Files
  • Farzad FARID
    Member
    • Apr 2007
    • 79

    #2
    SQL error in the DELTA correction provided in SVN

    Hi Alexei,

    Thanks for including the DELTA patch, but these is an error in your patchset rev 4164 you forgot to delete the word "history" in an SQL query. Here is a patch:

    Code:
    Index: src/zabbix_server/evalfunc.c
    ===================================================================
    --- src/zabbix_server/evalfunc.c        (révision 4167)
    +++ src/zabbix_server/evalfunc.c        (copie de travail)
    @@ -757,7 +757,7 @@
    
            if(flag == ZBX_FLAG_SEC)
            {
    -               result = DBselect("select max(value)-min(value) from %s history where clock>%d and itemid=" ZBX_FS_UI64,
    +               result = DBselect("select max(value)-min(value) from %s where clock>%d and itemid=" ZBX_FS_UI64,
                            table,
                            now-parameter,
                            item->itemid);
    Regards

    Comment

    • Alexei
      Founder, CEO
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2004
      • 5654

      #3
      It wasn't me Anyway it is fixed now! Thanks for the super fast response.
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      Working...