Ad Widget

Collapse

BUG: Arithmetic Minus Not Supported In Triggers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • James Wells
    Senior Member
    • Jun 2005
    • 664

    #1

    BUG: Arithmetic Minus Not Supported In Triggers

    Greetings,

    We are attempting to create a couple of complex triggers and have found that the arithmetic minus (-) is not supported, though the documentation clearly shows it as supported. An example trigger;
    Code:
    ({HOSTNAME:system.uptime.prev()}-{HOSTNAME:system.uptime.last()})<86400
    This trigger will fail at creation time with an error showing (0-0)<86400 is an invalid expression, where as the following will work;
    Code:
    ({HOSTNAME:system.uptime.prev()}+{HOSTNAME:system.uptime.last()})<86400
    This is on Zabbix-1.1.4, and it is a blocking issue that needs to get resolved soon.
    Unofficial Zabbix Developer
  • James Wells
    Senior Member
    • Jun 2005
    • 664

    #2
    Well, I found that 1.1.5 still has the problem. I did a bit of digging and found that it has the same problem that Palmertree found two different threads;
    Zabbix Version 1.1.5 - Can not add host names with a dash
    Zabbix 1.1.5 - Triggers with dashes

    In this case the problem is in triggers.inc.php, on or about line 196;
    Code:
                            $arr="";
                            if (eregi('^((.)*)([0-9\.]+[A-Z]{0,1})[ ]*([\&\|\>\<\=\+\-\*\/\#]{1})[ ]*([0-9\.]+[A-Z]{0,1})((.)*)$', $expression, $arr))
                            {
    //                              echo "OK<br>";
    //                              for($i=0;$i<50;$i++)
    //                              {
    //                                      if($arr[$i]!="")
    //                                              echo "  $i: ",$arr[$i],"<br>";
    //                              }
    This should instead look like;
    Code:
                            $arr="";
                            if (eregi('^((.)*)([0-9\.]+[A-Z]{0,1})[ ]*([\&\|\>\<\=\+\*\/\#-]{1})[ ]*([0-9\.]+[A-Z]{0,1})((.)*)$', $expression, $arr))
                            {
    //                              echo "OK<br>";
    //                              for($i=0;$i<50;$i++)
    //                              {
    //                                      if($arr[$i]!="")
    //                                              echo "  $i: ",$arr[$i],"<br>";
    //                              }
    Unofficial Zabbix Developer

    Comment

    • Palmertree
      Senior Member
      • Sep 2005
      • 746

      #3
      Thanks James for the information. That correction did the trick.

      Comment

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

        #4
        Sorry we didn't include the fix into 1.1.5. Perhaps we will release 1.1.6 earlier to get rid of the unfortunate problems.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

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

          #5
          Please see http://www.zabbix.com/forum/showthread.php?t=4989
          Alexei Vladishev
          Creator of Zabbix, Product manager
          New York | Tokyo | Riga
          My Twitter

          Comment

          Working...