Ad Widget

Collapse

trigger and item value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Inc0
    Member
    • Dec 2010
    • 36

    #1

    trigger and item value

    Hello,

    is there a way to show in a trigger a value of an item different from the one that triggered the trigger? (sorry for my english)

    Examlpe:
    Item1: A -> free disk space in Bytes
    Item2: B -> free disk space in %
    Trigger1: IF (B<5) THEN "Low space on {HOSTNAME}: {ITEM.VALUE}% (FreeDiskSpace MByte)"

    When the free space runs below 5% I want to see in Trigger1 the % value of free disk space (Item2 can be accessed using {ITEM.VALUE}) AND the amount of space expressed in MByte or GByte (Item1).
    I did some test specifying the hostname, the template name and so on but no luck.

    Thx and merry Xmas
    Last edited by Inc0; 28-12-2010, 09:57.
  • danrog
    Senior Member
    • Sep 2009
    • 164

    #2
    Try this (untested)

    I was thinking about this and originally I thought hmmmm, not really but then I realized it should be possible. You would have to have two checks in the trigger.

    Description: low diskspace on /var ({ITEM.LASTVALUE1} {ITEM.LASTVALUE2})
    In your example
    Item.lastvalue1 = B
    Item.lastvalue2 = A

    Trigger would have to be setup like this:
    (B<5)|(A<100)

    This reads as follows:
    If currrent % is less then 5% OR bytes less than 100 trigger. So really the second half is only so you can include the bytes value in the trigger description.


    I haven't tested but based on the docs and experience this should work


    Merry/Happy Christmas!!!!

    Comment

    • zalex_ua
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Oct 2009
      • 1286

      #3
      Originally posted by Inc0
      Hello,
      is there a way to show in a trigger a value of an item different from the one that triggered the trigger? (sorry for my english)

      Examlpe:
      Item1: A -> free disk space in Bytes
      Item2: B -> free disk space in %
      Trigger1: IF (B<5) THEN "Low space on {HOSTNAME}: {ITEM.VALUE}% (FreeDiskSpace MByte)"
      It should work. I have working macro {ITEM.VALUE} in the trigger Name.

      Originally posted by danrog
      I You would have to have two checks in the trigger.

      Description: low diskspace on /var ({ITEM.LASTVALUE1} {ITEM.LASTVALUE2})
      {ITEM.LASTVALUE} - is not right macro for this purposes.

      {ITEM.VALUE} - is right macro !
      Historical (when event happened) value of Nth item of the trigger expression if used for displaying events

      Comment

      • danrog
        Senior Member
        • Sep 2009
        • 164

        #4
        Hmmm both are listed as supported in trigger descriptions and both support displaying the Nth trigger expression used. I think they will also display the same data as the item table only contains the last value received from the host. So {item.lastvalueN} will work.

        {ITEM.LASTVALUE<1-9>} X X The latest value of the Nth item of the trigger expression which caused a notification. Supported from Zabbix 1.4.3. It is alias to {{HOSTNAME}:{TRIGGER.KEY}.last(0)

        Comment

        • zalex_ua
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Oct 2009
          • 1286

          #5
          Originally posted by danrog
          IHmmm both are listed as supported in trigger descriptions and both support displaying the Nth trigger expression used
          yes, but ->

          Originally posted by danrog
          I think they will also display the same data as the item table only contains the last value received from the host.
          No !
          {ITEM.VALUE<1-9>} - return Historical (when event happened) value of ...
          {ITEM.LASTVALUE<1-9>} - return latest value of the ...

          This is ROOT difference !

          For the first request by Inc0 - the right macro is {ITEM.VALUE<1-9>} instead of {ITEM.LASTVALUE<1-9>}.
          It will provide the correct viewing names in Monitoring -> Events GUI menu.


          See some my pictures at https://support.zabbix.com/browse/ZBX-2808 and i hope you will understand

          Comment

          • Inc0
            Member
            • Dec 2010
            • 36

            #6
            First of all, thank you for your support and merry Christmas

            I tested your suggestions and the macro {ITEM.VALUE<1-9>} works fine showing the % of free space space but I still can't see the value (MB/GB) of free space next to the %

            Here is the trigger (latest and NOT working version) I created for a template called MyTemplate:
            NAME: Low free disk space on {HOSTNAME} volume /: {ITEM.VALUE}% free ({{IPADDRESS}:{vfs.fs.size[/,free]}.last(0)})
            EXPRESSION: {MyTemplate:vfs.fs.size[/,pfree].last(0)}>5 & {MyTemplate:vfs.fs.size[/,pfree].last(0)}<10
            New dependency: NONE
            Event generation: Normal
            Severity: Warning

            Example
            hostname: foobar (Obviously foobar has MyTemplate linked)
            free disk space (in %) in /: 8%
            free disk space (GB) in /: 2GB

            The trigger in personal dashboard is shown as:
            Low free disk space on foobar volume /: 8% free ({{IPADDRESS}:{vfs.fs.size[/,free]}.last(0)})

            instead of

            Low free disk space on foobar volume /: 8% free (2GB)


            What am I doing wrong?

            Comment

            • zalex_ua
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Oct 2009
              • 1286

              #7
              Originally posted by Inc0
              The trigger in personal dashboard is shown as:
              Low free disk space on foobar volume /: 8% free ({{IPADDRESS}:{vfs.fs.size[/,free]}.last(0)})

              instead of

              Low free disk space on foobar volume /: 8% free (2GB)


              What am I doing wrong?

              Try trigger name:
              NAME: Low free disk space on {HOSTNAME} volume /: {ITEM.VALUE}% free ({ITEM.VALUE2})

              Using direct function is it not right way, the same as it not right to using the macro {ITEM.LASTVALUE}.

              What is it {IPADDRESS} - is it not right!
              {HOSTNAME<1-9>} - is right !
              and I'm not sure that combination {{IPADDRESS}:{vfs.fs.size[/,free]}.last(0)} should works at all.

              Comment

              • Inc0
                Member
                • Dec 2010
                • 36

                #8
                Originally posted by zalex_ua
                Try trigger name:
                NAME: Low free disk space on {HOSTNAME} volume /: {ITEM.VALUE}% free ({ITEM.VALUE2})

                Using direct function is it not right way, the same as it not right to using the macro {ITEM.LASTVALUE}.
                I'm not using {ITEM.LASTVALUE}
                Changing the trigger according to your suggestion shows a value equal to the % value: the new trigger
                NAME: Low free disk space on {HOSTNAME} volume /: {ITEM.VALUE}% free ({ITEM.VALUE2})

                shows

                Low free disk space on foobar volume /: 8% free (8)

                What is it {IPADDRESS} - is it not right!
                {HOSTNAME<1-9>} - is right !
                and I'm not sure that combination {{IPADDRESS}:{vfs.fs.size[/,free]}.last(0)} should works at all.
                Yes and no: using {IPADDRESS} is WRONG (so yes: you are right) but no, using {{HOSTNAME}:{vfs.fs.size[/,free]}.last(0)}
                the trigger shows

                Low free disk space on foobar volume /: 8% free ({foobar:{vfs.fs.size[/,free]}.last(0)})

                Comment

                • zalex_ua
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Oct 2009
                  • 1286

                  #9
                  Originally posted by Inc0
                  NAME: Low free disk space on {HOSTNAME} volume /: {ITEM.VALUE}% free ({ITEM.VALUE2})

                  shows

                  Low free disk space on foobar volume /: 8% free (8)

                  hmmm. i'll check in my environment.

                  Comment

                  • Inc0
                    Member
                    • Dec 2010
                    • 36

                    #10
                    Originally posted by zalex_ua
                    hmmm. i'll check in my environment.
                    I've forgot to mention "an important" thing: I'm running zabbix 1.8.3 (compiled by myself).

                    Comment

                    • zalex_ua
                      Senior Member
                      Zabbix Certified Trainer
                      Zabbix Certified SpecialistZabbix Certified Professional
                      • Oct 2009
                      • 1286

                      #11
                      Originally posted by Inc0
                      EXPRESSION: {MyTemplate:vfs.fs.size[/,pfree].last(0)}>5 & {MyTemplate:vfs.fs.size[/,pfree].last(0)}<10

                      What am I doing wrong?
                      Hey you use the same Item in 2nd position.
                      {MyTemplate:vfs.fs.size[/,pfree].last(0)}>5 & {MyTemplate:vfs.fs.size[/,pfree].last(0)}<10

                      This is you mistake!

                      In my environment all works fine.
                      Name:
                      Low free disk space on {HOSTNAME} volume /DB: {ITEM.VALUE}% free ({ITEM.VALUE2})
                      Expression:
                      {Zabbix_Server:vfs.fs.size[/DB,pfree].last(0)}<70 & {Zabbix_Server:vfs.fs.size[/DB,free].last(0)}>1000
                      Result:
                      Low free disk space on Zabbix_Server volume /DB: 57.2032% free (2186862592)

                      Comment

                      • Inc0
                        Member
                        • Dec 2010
                        • 36

                        #12
                        ...and of course it was a stupid mistake
                        It's working fine now, thank you again

                        Inc0

                        Comment

                        • Starko
                          Member
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Aug 2012
                          • 93

                          #13
                          Thank you very much. This works very well.
                          I modified the Linux and Windows Template Trigger prototypes according to your suggestions.

                          Windows
                          Code:
                          Free disk space is less than 5% on volume {#FSNAME} ({ITEM.VALUE2})
                          {Template OS Windows:vfs.fs.size[{#FSNAME},pfree].last(0)}<5 & {Template OS Windows:vfs.fs.size[{#FSNAME},free].last(0)}>1
                          Linux
                          Code:
                          Free disk space is less than 5% on volume {#FSNAME} ({ITEM.VALUE2})
                          {Template OS Linux:vfs.fs.size[{#FSNAME},pfree].last(0)}<5 & {Template OS Linux:vfs.fs.size[{#FSNAME},free].last(0)}>1
                          Sample Trigger Message:
                          Free disk space is less than 5% on volume E: (629.81 MB)

                          Comment

                          Working...