Ad Widget

Collapse

Patch: Trigger expression check in frontend (1.1)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cameronsto
    Senior Member
    • Oct 2005
    • 148

    #1

    Patch: Trigger expression check in frontend (1.1)

    I was trying to add a new trigger via the frontend and was receiving an error that it didn't match the required expression. Well it turned out the regular expression I had used in the item key (vfs.file.regexp[/tmp/md0.txt,.*]) was failing the "validate_simple_expression($expression)" because it contained an asterick. Here's a patch to add astericks to the regular expression check in that method.

    Code:
    --- zabbix-1.1/frontends/php/include/config.inc.php     2006-06-02 07:11:36.000000000 -0400
    +++ /var/www/html/zabbix/include/config.inc.php 2006-06-28 08:35:00.000000000 -0400
    @@ -651,7 +651,7 @@
     // Before str()
     //             if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.((diff)|(min)|(max)|(last)|(prev))\(([0-9\.]+)\)\}$', $expression, $arr)) 
     //             if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.((diff)|(min)|(max)|(last)|(prev)|(str))\(([0-9a-zA-Z\.\_\/\,]+)\)\}$', $expression, $arr)) 
    -               if (eregi('^\{([0-9a-zA-Z\_\.-]+)\:([]\[0-9a-zA-Z\_\/\.\,\:\(\) -]+)\.([a-z]{3,11})\(([#0-9a-zA-Z\_\/\.\,]+)\)\}$', $expression, $arr)) 
    +               if (eregi('^\{([0-9a-zA-Z\_\.-]+)\:([]\[0-9a-zA-Z\_\*\/\.\,\:\(\) -]+)\.([a-z]{3,11})\(([#0-9a-zA-Z\_\/\.\,]+)\)\}$', $expression, $arr)) 
                    {
                            $host=$arr[1];
                            $key=$arr[2];
    cameron
  • LEM
    Senior Member
    Zabbix Certified Specialist
    • Sep 2004
    • 112

    #2
    I propose another modification 'on top of' yours (to resolve the 'str/regexp' parameter limitation, as described here) :
    Code:
    if (eregi('^\{([0-9a-zA-Z\_\.-]+)\:([]\[0-9a-zA-Z\_\*\/\.\,\:\(\) -]+)\.([a-z]{3,11})\(([#0-9a-zA-Z\_\/\.\,[:space:]]+)\)\}$', $expression, $arr))
    Cheers,
    --
    LEM

    Comment

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

      #3
      The patch is applied. Thanks.
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      Working...