Ad Widget

Collapse

Using template MACRO value in template trigger failing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dspruell
    Junior Member
    • Mar 2012
    • 1

    #1

    Using template MACRO value in template trigger failing

    Greetings.

    I am attempting to use a macro in an item key expression for a trigger. This macro is defined in the template, and is used successfully in an item in the template for hosts using that template. Attempting to then use this in the expression for a new trigger in the same template is failing.

    Macro configuration in template:

    {$HTTPS_PORT} = 443

    Item using this macro in simple service:

    Description: Web Service
    Type: Simple check
    Key: tcp,{$HTTPS_PORT}
    Show value: Service state

    Latest data shows this item returning value properly: "Up (1)"


    Attempting to add a trigger to this same template using the key (containing macro) in the expression fails. I've tried adding it several ways (e.g. tcp,{$MACRO} and tcp[{$MACRO}]) and each of these fail:

    (Trigger attempt 1)

    Name: Web service is down on {HOSTNAME}
    Expression: {Template_Sourcefire_Sensor_Base:tcp,{$HTTPS_PORT} .last(0)}#1
    The trigger depends on: No dependencies defined
    Event generation: Normal
    Severity: Average
    Error(s):
    ERROR: Cannot update trigger
    Incorrect item key "tcp,{$HTTPS_PORT" is used in expression. Incorrect simple check parameter.
    Check expression part starting from " {Template_Sourcefire_Sensor_Base:tcp,{$HTTPS_PORT} .last(0)}#1 "


    (Trigger attempt 2)

    Name: Web service is down on {HOSTNAME}
    Expression: {Template_Sourcefire_Sensor_Base:tcp[{$HTTPS_PORT}].last(0)}#1
    The trigger depends on: No dependencies defined
    Event generation: Normal
    Severity: Average
    Error(s):
    ERROR: Cannot update trigger
    Incorrect item key "sensor1:tcp[{$HTTPS_PORT}]" provided for trigger expression.
    Incorrect item key "sensor2:tcp[{$HTTPS_PORT}]" provided for trigger expression.
    Incorrect item key "sensor3:tcp[{$HTTPS_PORT}]" provided for trigger expression.
    Incorrect item key "sensor4:tcp[{$HTTPS_PORT}]" provided for trigger expression.
    Incorrect item key "sensor5:tcp[{$HTTPS_PORT}]" provided for trigger expression.
    Incorrect item key "sensor6:tcp[{$HTTPS_PORT}]" provided for trigger expression.
    Incorrect item key "sensor7:tcp[{$HTTPS_PORT}]" provided for trigger expression.
    Incorrect item key "Template_Sourcefire_Sensor_Base:tcp[{$HTTPS_PORT}]" provided for trigger expression.


    (Trigger attempt 3)

    {Template_Sourcefire_Sensor_Base:tcp[,{$HTTPS_PORT}].last(0)}#1
    Error:
    Incorrect item key "Template_Sourcefire_Sensor_Base:tcp[,{$HTTPS_PORT}]" provided for trigger expression.


    (Trigger attempt 4)

    {Template_Sourcefire_Sensor_Base:tcp[$HTTPS_PORT].last(0)}#1
    Error:
    Incorrect item key "Template_Sourcefire_Sensor_Base:tcp[$HTTPS_PORT]" provided for trigger expression.

    It appears to me that using the macros in a trigger may not be supported and that the parser might be breaking when it encounters the macro curly brace "}" intending to close the expression.

    Is there a different way to do this to use the macro in the trigger expression successfully?

    OS: Red Hat Enterprise Linux Server release 5.6 (Tikanga) / Linux 2.6.18-238.19.1.0.1.el5
    Apache: 2.2.3
    PHP: PHP 5.3.3 (cli) (built: Feb 3 2011 15:47:31) / Zend Engine v2.3.0
    MySQL: mysql Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1
    Zabbix: 1.8.10

    DS
  • Anth0ny
    Member
    • Nov 2009
    • 85

    #2
    i have it too...
    Zabbix 1.8.10

    Incorrect item key "tcp,{$MY_PORT" is used in expression. Incorrect simple check parameter.
    Check expression part starting from " {_Template - Custom:tcp,{$MY_PORT}.last(0)}<1 "
    Last edited by Anth0ny; 23-03-2012, 10:21.

    Comment

    • mikejelley
      Junior Member
      • Apr 2012
      • 1

      #3
      Did you find a solution to this problem? Is there some way to "escape" the additional curly braces? (I assume that is the problem.)

      Comment

      Working...