Ad Widget

Collapse

Discovery adding host level macro Example:{${#FSNAME}.LIMIT.LOW}

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cdslaughter
    Member
    • Jun 2018
    • 69

    #1

    Discovery adding host level macro Example:{${#FSNAME}.LIMIT.LOW}

    I am trying to figure out if there is a way to dynamically create host level macros based on the results of a discovery.
    These macros will be used to tune a trigger and I have confirmed this works.
    Code:
    Problem: {[URL="http://172.18.22.37/items.php?form=update&itemid=73317"]202719lpadaptec.mhsl.test.local:test.item.1[/URL].[B]last([/B][B])[/B]}<{$TEST.ITEM.1.LOW}
    Recovery: {[URL="http://172.18.22.37/items.php?form=update&itemid=73317"]202719lpadaptec.mhsl.test.local:test.item.1[/URL].[B]last([/B][B])[/B]}>{$TEST.ITEM.1.HIGH}
    I have the matching host macros "{$TEST.ITEM.1.LOW} {$TEST.ITEM.1.HIGH}" created in the Host Macros section. This works wonderfully.

    I am using this as a way to tune (some) individual servers triggers without having to modify the triggers themselves. This means I just go to the host macro section and tweak the values of some macros to get the desired trigger behavior I am looking for.

    If we look at the file system discovery example below.
    Code:
    Problem: {[URL="http://172.18.22.37/disc_prototypes.php?form=update&itemid=60304&parent_discoveryid=60299"]Template Discovery - Disk and Filesystem:vfs.fs.size[{#FSNAME},pfree][/URL].[B]last([/B][B])[/B]}<10
    Recovery: {[URL="http://172.18.22.37/disc_prototypes.php?form=update&itemid=60304&parent_discoveryid=60299"]Template Discovery - Disk and Filesystem:vfs.fs.size[{#FSNAME},pfree][/URL].[B]last([/B][B])[/B]}>15
    This creates all the triggers with hard coded values for "Problem/Ok" which in most cases works just fine, but if I wanted to make those hard coded values (10/15) something that was easily changed, I would have to disable the original trigger, clone it, enable the clone, and then modify the values.
    It really isn't a problem fixing the trigger creation part of the discovery process,
    Code:
    Problem: {[URL="http://172.18.22.37/disc_prototypes.php?form=update&itemid=60304&parent_discoveryid=60299"]Template Discovery - Disk and Filesystem:vfs.fs.size[{#FSNAME},pfree][/URL].[B]last([/B][B])[/B]}<{${#FSNAME}.LIMIT.LOW}
    Recovery: {[URL="http://172.18.22.37/disc_prototypes.php?form=update&itemid=60304&parent_discoveryid=60299"]Template Discovery - Disk and Filesystem:vfs.fs.size[{#FSNAME},pfree][/URL].[B]last([/B][B])[/B]}>{${#FSNAME}.LIMIT.HIGH}
    But rather the creation of the two host macros "{${#FSNAME}.LIMIT.LOW} and {${#FSNAME}.LIMIT.HIGH}".

    I realize that this may be kinda odd, but the scale I am trying to gear up to deploy to and more importantly, for me to make it as easy as possible for others to make changes to some of the triggers that we often have to modify without having to clone/unlink/disable triggers that were generated by a discovery would make life a lot easier for me.

    Has anyone tried something like this and found a solution by chance?

    Thank you

    Carl Slaughter
    Last edited by cdslaughter; 15-11-2018, 22:42.
  • cdslaughter
    Member
    • Jun 2018
    • 69

    #2
    Has anyone had any experience with this type of thing? Anyone have any thoughts on how to get this to work?

    Comment

    • kloczek
      Senior Member
      • Jun 2006
      • 1771

      #3
      For LLDs prototypes macros definition is a bit different
      http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
      https://kloczek.wordpress.com/
      zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
      My zabbix templates https://github.com/kloczek/zabbix-templates

      Comment

      • cdslaughter
        Member
        • Jun 2018
        • 69

        #4
        Originally posted by kloczek
        For LLDs prototypes macros definition is a bit different
        https://www.zabbix.com/documentation..._macro_context
        I looked at that, but it still did not specify how to automate the creation of the "user macros" in the discovery process.
        If I am reading the document correctly, in section 3.9 "Using LLD macros in user macro contexts" it gives you the example trigger expression but then states that I should create the use macro.
        Code:
        Then add user macros:[LIST][*]{$LOW_SPACE_LIMIT} [B]10[/B][*]{$LOW_SPACE_LIMIT:/home} [B]20[/B][*]{$LOW_SPACE_LIMIT:/tmp} [B]50[/B][/LIST]
        Now, once the file systems are discovered, events will be generated if /, /usr and /var filesystems have less than [B]10[/B]% of free disk space, the /home filesystem - less than [B]20[/B]% of free disk space or the /tmp filesystem - less than [B]50[/B]% of free disk space.
        That indicated to me that I still need to manually add the user macros. This is the exact issue I am trying to address.

        Am I missing something?

        Comment

        • kloczek
          Senior Member
          • Jun 2006
          • 1771

          #5
          Firs template triggers needs to use macros prototypes.
          if generated triggers will be using such populated macros than globally, on template or host level will be alter those prototyped macros values.

          PS. You just gave me good idea that I should implement such prototype macros in my templates. However until 29 this month I have no completely time to sit down and implement such feature.
          Please recall me if I'll not post some update about such modification in my templates if until 29th you will not be able to figure out how to implement this.
          http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
          https://kloczek.wordpress.com/
          zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
          My zabbix templates https://github.com/kloczek/zabbix-templates

          Comment

          • cdslaughter
            Member
            • Jun 2018
            • 69

            #6
            Unfortunately, I think you still misunderstand my issue. In order to make it a little clearer, I have made a template that illustrates the issue. Currently it will not import correctly due to the issue I am having, If you can figure out how to make it import and work, then perhaps you will have found my solution.


            Remember, I need the system to dynamically create the {${#FSNAME}.LIMIT.LOW} and {${#FSNAME}.LIMIT.HIGH} macros in the host macro section. Their values can be whatever number you like.

            Carl
            Attached Files

            Comment

            • cdslaughter
              Member
              • Jun 2018
              • 69

              #7
              Kloczek, I have not heard back from you. If you like, I would be happy to get on a call and explain the issue and even demonstrate it. I suspect you are thinking of one macro and I am thinking of another.
              in the same way you might want to set a host macro {$SNMP_VALUE_ROUTER1} at the host level (From the host > macros section) I am trying to dynamically create a macro in the same location based on the discovery results.

              Carl

              Comment

              Working...