Ad Widget

Collapse

How to check if value of a string item is an empty string?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • unufrii
    Junior Member
    • Apr 2009
    • 5

    #1

    How to check if value of a string item is an empty string?

    Hello All,

    I am trying to construct a trigger, which fires up if a switch port goes down and in the same time port description is an empty string (no port description). That's because I am not interested in ports which have no description. The problem is how to check if the value of the port description item is an empty string.

    Expressions like:

    Code:
    ({sw:Port 199 State.last(0)}=2)&({sw:Port 199 Desc.last(0)}#'')
    generates error Incorrect trigger expression. [ ... #'']

    Sorry if the solution is trivial but I spend the last hour reading the manual, forums and googling without success.

    Thanks in advance.
  • unufrii
    Junior Member
    • Apr 2009
    • 5

    #2
    Hmm - I found a solution. Don't know if it is the most effective, but it works for me.

    It looks that

    ({sw:Port 199 State.last(0)}=2) & ({sw:Port 199 Desc.regexp(^)}#0)

    expression does the trick.

    Comment

    • esimim2
      Junior Member
      • Nov 2018
      • 2

      #3
      The best way to check if the value of an item is empty is to use the Zabbix strlen function, which is going to measure how many characters there are within the item:

      {hostName:itemKey.strlen()}>0

      : if the number of characters are more than 0 the Trigger will go off!
      Last edited by esimim2; 22-11-2018, 02:02.

      Comment

      Working...