Ad Widget

Collapse

Item parameter in trigger?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jherazob
    Junior Member
    • Sep 2011
    • 20

    #1

    Item parameter in trigger?

    I'm using an item that receives a number as a parameter, sent by the monitored host to a trapper item. For example, item "foo[5]" may have a value of 17, item "foo[2]" may have a value of 31 and item "foo[8]" may have a value of 50, which is too high and should fire a trigger.

    I want to make a trigger that uses that number, without having to create one for every possible parameter. For example, if foo[9] has a value of 50 and above, fire an average trigger with all related actions, taking the 9 from the item parameter, instead of having to create, say, 10 different triggers corresponding to foo[1] to foo[10].

    Is this possible? if so, what's the syntax? if it isn't, do you know of a workaround?
  • kofeyh
    Junior Member
    • Jun 2010
    • 17

    #2
    You might find regular expressions, found under "Administration > General > Regular Expressions" useful.

    For example:

    I created a regular expression to match a percentage between 80% and 89%, say 'called percent_greater_than_80':

    Expression: [8-8][0-9][%]
    Expression type: Result is TRUE

    This basically matches a number between 80, and 89, with a % following.

    So 79% would not match, but 82% will.

    Now, if I include that in a trigger, eg to match against another regex (for example to check for a particular string in an SNMP trap):

    ({Template_Example:snmptraps.regexp(@some_trigger_ here)}=1) &({Template_Example:snmptraps.regexp(@percent_grea ter_than_80)}=1) &({Template_Example:snmptraps.nodata(180)}=0)

    .. then if the @some_trigger_here regexp value exists in a trap, and the percentage of the metric is 80% or above (but below 90%) then the trigger will be true and create a PROBLEM or whatever is needed.

    Regular Expressions are extremely useful, in that you can perform anything from string matching, to looking for percentages, or whatever, and then combine more than one expression to create triggers.

    You can then also re-cycle the same expressions in any number of triggers.

    There's some useful pointers in the Wiki as well:

    http://www.zabbix.com/documentation/...config/regexps
    http://www.zabbix.com/documentation/...ar_expressions

    You can also put ranges in triggers, I think, however I'm not exactly sure of the syntax (hence why I stuck with regex, which is easier for me to work out) and what any limitations might be.
    Last edited by kofeyh; 27-03-2012, 08:10.

    Comment

    Working...