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

Some template linking items return error "Warning. Field [formula] is not double" when updating the item setting.

    XMLWordPrintable

Details

    • Incident report
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.8.6
    • 1.8.7
    • Frontend (F)
    • None
    • Linux, FreeBSD. Maybe other platforms have same problem.

    Description

      [Problem]:
      Some template linking items return error "Warning. Field [formula] is not double" when updating the item setting.
      For example, after linking "Template_Linux" in 1.8.6 data.sql, changing "Update interval (in sec)" of item "Free disk space on /" in linking host's item editing screen, it returns error "Warning. Field [formula] is not double".
      Following is easiest way to reproduce.

      (1.) Install and setup Zabbix by using Zabbix 1.8.6 sql setup files.
      (2.) Change "Update interval (in sec)" in "Free disk space on /" item in "Zabbix Server" host.
      (3.) Error message "Warning. Field [formula] is not double" returns.

      [Why it occurs]
      In initial database data, there are some template items data which have empty string as formula column.
      For example, following data is setting '' as formula column.
      Though the data itself is not good, many users are already using these data.
      So, we have to think about avoiding the problem from program side.
      --------------------- from data.sql (version 1.8.6) ---------------------
      INSERT INTO items VALUES (10002,0,'','',161,10001,'Free disk space on $1','vfs.fs.size[/,free]',30,7,365,NULL,NULL,NULL,0,3,'','B',0,0,NULL,'',0,'','','','',0,'',0,0,''
      ,'','',0,0,'','','','',0);
      INSERT INTO items VALUES (10003,0,'','',161,10001,'Free disk space on $1','vfs.fs.size[/tmp,free]',30,7,365,NULL,NULL,NULL,0,3,'','B',0,0,NULL,'',0,'','','','',0,'',0,0
      ,'','','',0,0,'','','','',0);
      INSERT INTO items VALUES (10004,0,'','',161,10001,'Free disk space on $1','vfs.fs.size[/usr,free]',30,7,365,NULL,NULL,NULL,0,3,'','B',0,0,NULL,'',0,'','','','',0,'',0,0
      ,'','','',0,0,'','','','',0);
      -------------------------------------------------------------------------

      From program side, it's usually not problem because the validation for formula is not executed to items which have no check for "multiplier" checkbox.
      But, in template linking items, the validation for formula is executed even if the items have no check for "multiplier" checkbox.
      And if formula column is empty string, the validation returns error.

      The code is following.
      In template linking items, if the items have no check for "multiplier" checkbox, the formula is generated and set as post data.
      The all posted data is validated.
      So, the error occurs.
      ----------- frontends/php/include/forms.inc.php -----------
      (snip...)
      if(isset($limited)){
      $frmItem->addVar('multiplier', $multiplier);

      $mcb = new CCheckBox('multiplier', $multiplier == 1 ? 'yes':'no');
      $mcb->setAttribute('disabled', 'disabled');
      $mltpbox[] = $mcb;
      if($multiplier)

      { $mltpbox[] = SPACE; $ctb = new CTextBox('formula', $formula, 10, 1); $ctb->setAttribute('style', 'text-align: right;'); $mltpbox[] = $ctb; }

      else

      { $frmItem->addVar('formula', $formula); <----- This is problem. This data will post. }

      }
      else

      { $mltpbox[] = new CCheckBox('multiplier',$multiplier == 1 ? 'yes':'no', 'var editbx = document.getElementById(\'formula\'); if(editbx) editbx.disabled = !this.checked;', 1); $mltpbox[] = SPACE; $ctb = new CTextBox('formula', $formula, 10); $ctb->setAttribute('style', 'text-align: right;'); $mltpbox[] = $ctb; }

      (snip...)
      -----------------------------------------------------------

      [How to fix]
      I made a patch which changes the code not to send POST data if $multiplier is not set.
      The way is same as non linking items.
      The patch is for 1.8.6.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tsuzuki Takanori Suzuki
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: