Ad Widget

Collapse

How do I convert a 0/1 value set to a pair of strings (e.g. down/up)?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mj-jbell
    Junior Member
    • Mar 2015
    • 2

    #1

    How do I convert a 0/1 value set to a pair of strings (e.g. down/up)?

    I'm trying to set up port monitoring on a Zabbix server, and currently this is logged as a 0 if the port's down, and a 1 if the port is up.

    The goal is to have a trigger fire, with a subject line something like this:

    Code:
    PROBLEM: HTTP port on web-server-01 is DOWN
    ... and this ...

    Code:
    OK: HTTP port on web-server-01 is UP
    ...

    So I've tried to do this by configuring the trigger something like this:

    Code:
    The HTTP port on {HOST.NAME} is {ITEM.VALUE}
    But this isn't terribly useful since it only says that it's 0 or 1 ... so is there a way to translate this 0 or 1 to "DOWN" or "UP"?
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    See value mapping

    Comment

    • mj-jbell
      Junior Member
      • Mar 2015
      • 2

      #3
      DERP.

      I got it, thanks.

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        Originally posted by mj-jbell
        But this isn't terribly useful since it only says that it's 0 or 1 ... so is there a way to translate this 0 or 1 to "DOWN" or "UP"?
        By default, Zabbix have some "Value Mapping" presets.
        One has a name "Service State" and mapping 0 & 1 to Down & Up.

        So, the easiest way to use it - configure your item to use "Service State" value mapping for the field "Show value"
        Attached Files
        Sincerely yours,
        Aleksey

        Comment

        • tchjts1
          Senior Member
          • May 2008
          • 1605

          #5
          As Aib mentioned, value mapping will help in some areas, but not all.

          At least in my 2.0.9 setup, a graph will still indicate only the return code instead of the value mapping - unfortunately. I think maybe this was going to be addressed in a newer release than what I am running.

          My workaround is simply to create a custom graph and in the graph description I put the legend, such as:
          "My App Services 0 = Down; 1 = Up" or whatever the case may be.

          Alerts will correctly show the value mapping along with the return code though without any modification.
          Last edited by tchjts1; 28-03-2015, 04:46.

          Comment

          • dstrickler
            Junior Member
            • Mar 2022
            • 10

            #6
            As of Zabbix v6.x, you can see a post here that explains how to do it. In short, you can use Value Mapping on a Template to make it pretty easy. While my example uses the words Up and Down, you can change it to anything you want. Or you can expand it to handle more than two values.

            Comment

            Working...