Ad Widget

Collapse

Trigger macro naming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ebrajoh
    Junior Member
    • Jan 2011
    • 3

    #1

    Trigger macro naming

    I'm sharing a method of naming triggers with macros,.

    I've set up a couple of triggers that trigger actions from one (more than one actually) item but get their name from oneother. Se below:

    {Template_MSC:r.1.strlen(0)}<0 | {Template_MSC:nidl.1.last(0)}=0 & {Template_MSC:nocc.1.last(0)}>0 & {Template_MSC:r.1.regexp(.*?S[O|I])}=0

    The trick is to or the naming item with a nonsense expression. The nonsense expression in this case is "{Template_MSC:r.1.strlen(0)}<0" since a string cant have a length < 0.

    The name can then be selected with something like below, where {ITEM.VALUE1} selects the first items value (the naming items value):
    Route {ITEM.VALUE1} in {HOSTNAME} no idle device
    Last edited by ebrajoh; 25-01-2011, 08:39.
  • untergeek
    Senior Member
    Zabbix Certified Specialist
    • Jun 2009
    • 512

    #2
    I discovered the same thing, though I've used the str(NULL) on mine, checking for a non-null answer. I think your solution may be less taxing on the database than mine.

    Comment

    • mushero
      Senior Member
      • May 2010
      • 101

      #3
      I am clearly not smart enough to figure this out - what problem are we solving and how does this do that with the nonsense expression ? Seems to be missing a few pieces for me to understand.

      Comment

      • ebrajoh
        Junior Member
        • Jan 2011
        • 3

        #4
        If you post what you want to do mushero. I can help you explain how to do that.

        Comment

        • fredo2906
          Junior Member
          • Jan 2011
          • 14

          #5
          Thank you for sharing that. You may be able to help me with my issue.

          I have an item key as follow:
          ssh,[{$SSH_PORT}]

          And I want to set a trigger like that
          {aserver:ssh,[{$SSH_PORT}].last(0)}=1

          I get the following error :
          * Not allowed symbols or sequence of symbols in expression element detected: Check expression part starting from ' [{$SSH_PORT}].last(0)}=1 '
          * Not allowed symbols or sequence of symbols in expression element detected: Check expression part starting from ' ].last(0)}=1 '

          Why?

          Comment

          • JBo
            Senior Member
            • Jan 2011
            • 310

            #6
            Hi,

            Originally posted by fredo2906
            Thank you for sharing that. You may be able to help me with my issue.

            I have an item key as follow:
            ssh,[{$SSH_PORT}]

            And I want to set a trigger like that
            {aserver:ssh,[{$SSH_PORT}].last(0)}=1

            I get the following error :
            * Not allowed symbols or sequence of symbols in expression element detected: Check expression part starting from ' [{$SSH_PORT}].last(0)}=1 '
            * Not allowed symbols or sequence of symbols in expression element detected: Check expression part starting from ' ].last(0)}=1 '

            Why?
            First, you should start your own thread when your question is unrelated to the problem discussed here.

            Anyway, your item syntax is wrong. Check ssh,<port> in documentation.
            It should be :
            ssh,{$SSH_PORT}

            If you still have problem, just start a new thread

            Hope this helps,
            JBo

            Comment

            • ebrajoh
              Junior Member
              • Jan 2011
              • 3

              #7
              I agree with JBo that the problem is unrelated. Though, I'm not that sure that you can use "user defined macros" like that at all :-(

              Comment

              • fredo2906
                Junior Member
                • Jan 2011
                • 14

                #8
                Yes I know, sorry for that.
                Actually thanks to all for the replies. The problem was related to the naming.

                Comment

                • mushero
                  Senior Member
                  • May 2010
                  • 101

                  #9
                  Originally posted by ebrajoh
                  If you post what you want to do mushero. I can help you explain how to do that.
                  Not that I wanted to do something, but was trying to figure out how I can use this, i.e. what problem it's solving to use a macro in the name (though I think I can see some value), and not clear which item in the first post is the macro, i.e. would be great to use a host macro, too. Would appear he wants the item value in the name.

                  Comment

                  Working...