Ad Widget

Collapse

Solution: Incorrect key format 'key_name[param1,param2,...]'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Marcos Cabrera
    Junior Member
    • May 2008
    • 4

    #1

    Solution: Incorrect key format 'key_name[param1,param2,...]'

    Hi,

    After working hard with aggregation simple ckecks, I have discovered one way to solve this common problem.

    Finally, I managed to create the following Zabbix Aggregate Item: grpsum('iTarifas_Planas','B','last','0')
    iTarifas_Planas: Host group.
    B: Item key.
    last: Item func.
    0: parameter

    The problem was with the regular expression. Zabbix looks the item you enter, and compares it with some regular expressions. Debugging the problem I have seen that it's defined in the following file: include/defines.inc.php

    There you can see: define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_INTERNAL_NAMES.'(\('.ZBX
    _EREG_PARAMS.'\)){0,1})');


    In the original file, you will see some "[]", just replace them with "()", and it should works.

    Good luck.

    Marcos
  • Sir_Yaro
    Member
    • Nov 2008
    • 37

    #2
    I've got the same issue on 1.8.2
    Replace line ~600 in include/defines.inc.php beginning with
    Code:
    define('ZBX_PREG_KEY_NAME'
    , to:
    Code:
    define('ZBX_PREG_KEY_NAME', '([0-9a-zA-Z_\.\-\:\ ,]+)'); /* !!! Don't forget sync code with C !!! */

    Comment

    • probert100
      Junior Member
      • Jun 2010
      • 7

      #3
      This regular expression ([0-9a-zA-Z_\.\-\:\ ,]+) is not exactly correct. Right now it prevents "spaces" from the key names in 1.6 you could have keys with spaces in the names.
      Is there a reason why spaces should not be supported anymore? If not then the expression should be:
      ([ 0-9a-zA-Z_\.\-\:\ ,]+)

      Thanks,
      Robert

      Comment

      • georgew
        Member
        • Mar 2008
        • 50

        #4
        Failure to support keys with spaces is causing difficulty in migrating from 1.6.x. There are thousands of spaces in the key names of 1.6x templates.

        Comment

        Working...