Ad Widget

Collapse

Trigger expression with a Regex Threshold?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aurelie
    Junior Member
    • Jan 2016
    • 16

    #1

    Trigger expression with a Regex Threshold?

    Hello all,

    I'm trying to implement a trigger on a hardware status, with that numerical values status:
    PROBLEM = unknown(1), ready(3), reset(4), down(6)
    OK = running(2), runningAtFullSpeed(5), standby(7)

    Is it possible to define a regex into the expression constant to avoid to repeat the expression for each status?

    I tried several expressions but nothing seems to work:
    {ZabbixServer:HardwareStatuskey.last(#1)} = @HardwareRegex
    {ZabbixServer:HardwareStatuskey.last(#1)} = (1 or 3 or 4 or 6)
    {ZabbixServer:HardwareStatuskey.last(#1)} = [1346]
    {ZabbixServer:HardwareStatuskey.last(#1)} = {$callHardwareRegex}

    Is someone have an idea?
    Thanks
  • michael.weber
    Senior Member
    • Nov 2015
    • 121

    #2
    can you try:
    {ZabbixServer:HardwareStatuskey.last()}=1 or {ZabbixServer:HardwareStatuskey.last()}=3 or {ZabbixServer:HardwareStatuskey.last()}=4 or {ZabbixServer:HardwareStatuskey.last()}=6
    OR
    {ZabbixServer:HardwareStatuskey.regexp(1|2|4|6)}=1
    see

    and

    Comment

    • aurelie
      Junior Member
      • Jan 2016
      • 16

      #3
      Hello Michael,

      Thanks for answering.

      But as metionned in Zabbix documentation, the function regexp() only supports String, Text and Log values, while in my case I have a numeric Item.

      For the other solution :
      {ZabbixServer:HardwareStatuskey.last()}=1 or {ZabbixServer:HardwareStatuskey.last()}=3 or {ZabbixServer:HardwareStatuskey.last()}=4 or {ZabbixServer:HardwareStatuskey.last()}=6

      It works, but I was wondering for an easier way to write it, as I will also have to manage three occurrences before trigger status change.

      If you or anyone have an other idea...
      Thanks

      Comment

      • aurelie
        Junior Member
        • Jan 2016
        • 16

        #4
        I finally got it with Michael clue.

        To be able to use numeric values with the regexp() function, I have to change the "Type of Information" of my Item by "Character" and I can write :

        {ZabbixServer:HardwareStatuskey.regexp("1|3|4|6",# 1)} = 0

        Comment

        Working...