Ad Widget

Collapse

how to create item prototypes for this lld array?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ik_zelf
    Member
    • Feb 2015
    • 60

    #1

    how to create item prototypes for this lld array?

    I generated an lld json array:
    Code:
    testhost key1 1427037241 {"data":
    [{"{#TARGET}":40,"{#ACTUAL}":40,"{#RUNNING}":0,"{#PENDING}":0,"{#TOOL}":"Standard Tool"}
    ,{"{#TARGET}":1,"{#ACTUAL}":1,"{#RUNNING}":0,"{#PENDING}":0,"{#TOOL}":"Internal Tool"}
    ,{"{#TARGET}":1,"{#ACTUAL}":1,"{#RUNNING}":0,"{#PENDING}":0,"{#TOOL}":"Conflict Tool"}
    ,{"{#TARGET}":1,"{#ACTUAL}":1,"{#RUNNING}":0,"{#PENDING}":0,"{#TOOL}":"Scheduler Tool"}
    ]}
    What I was hoping to accomplish is having 4 items generated for each tool.
    something like
    key1."Standard Tool".actual
    key1."Standard Tool".running
    key1."Standard Tool".pending
    key1."Standard Tool".target
    and same for the other 3 tools.

    is this possible at all?
    If yes, can I have a pointer with some explanation how to accomplish this?
    If no: how should I tackle this so I might get the items I need?

    thanks,
    Ronald.
    Last edited by richlv; 22-03-2015, 22:04.
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    it looks like you are actually trying to pass item values in the lld json (like target, actual, running, pending) - is that correct ?
    if so, you should only send data needed for item creation in the lld json - actual values will follow later, presumably via zabbix sender or its protocol
    Zabbix 3.0 Network Monitoring book

    Comment

    • ik_zelf
      Member
      • Feb 2015
      • 60

      #3
      thanks for your response,

      yes, I did pass the values in one go.
      So I should change the LLD array to:
      testhost key1 1427037241 {"data":
      ["{#TOOL}":"Standard Tool"}
      ,"{#TOOL}":"Internal Tool"}
      ,"{#TOOL}":"Conflict Tool"}
      ,"{#TOOL}":"Scheduler Tool"}
      ]}

      create prototypes with
      key1.[{TOOL}].actual
      key1.[{TOOL}].running
      key1.[{TOOL}].target
      key1.[{TOOL}].pending

      and send data with
      key1."Standard Tool".actual {time} 40
      key1."Standard Tool".running {time} 0
      key1."Standard Tool".pending {time} 0
      key1."Standard Tool".target {time} 40

      I guess I can also send the data in one json array?
      like:
      testhost key1 1427037241 {"data":
      [{"key1.Standard Tool.actual":40,"key1.Standard Tool.target":40,"key1.Standard Tool.running":0,"key1.Standard Tool.pending":0}
      ,{"key1.Internal Tool.actual":1,"key1.Internal Tool.target":1,"key1.Internal Tool.running":0,"key1.Internal Tool.pending":0}
      <snip>
      ]}


      is that correct?
      and yes, in this case I send the data and discovery using zabbix_sender

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        1. lld json/array looks good;
        2. no, item key syntax will not allow that - use something like key1.[{TOOL},actual]
        3. the simplest approach is to use zabbix sender. something like :
        zabbix_sender -z zabbix_server -s host -k "key1.[Standard Tool,actual]" -o 40 (although i'm puzzled by what is {time} supposed to do there ? )
        4. ...or even better, send all of the values from a single file - see "man zabbix_sender"
        Zabbix 3.0 Network Monitoring book

        Comment

        • ik_zelf
          Member
          • Feb 2015
          • 60

          #5
          Thanks Rich,

          back to the drawing board then ;-)
          {time} is the unixtime that is supposed to be in the data when using zabbix_sender -T

          that really is a comma: key1.[{TOOL},actual]
          ?

          Ronald - who is learning day and night at the moment

          Comment

          • richlv
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2005
            • 3112

            #6
            time - ah, ok. fields will be a bit different in the input file, but again - see the zabbix sender manpage

            that really is a comma: key1.[{TOOL},actual]
            sure, see item key syntax in https://www.zabbix.com/documentation...items/item/key
            Zabbix 3.0 Network Monitoring book

            Comment

            • ik_zelf
              Member
              • Feb 2015
              • 60

              #7
              Hi Rich,

              I have quite a few bit setup and running now. thanks for your help!

              now, suppose I have items generated from a template like
              Code:
              key1.[{TOOL},target] and
              key1.[{TOOL},running]
              I have seen that zabbix also has computed items. So the question is simple,
              How can I compute the percentage of actual that I have running for my TOOLs?

              I tried with:
              Code:
              (last(key1.[{#TOOL},running]) /
              last(key1.[{#TOOL},target])) * 100
              but no items are appearing now.
              Do you also have a hint for this?
              (I assume the problem I have here is the same for triggers and graph prototypes ....)

              thanks,
              Ronald

              Comment

              • aib
                Senior Member
                • Jan 2014
                • 1615

                #8
                Originally posted by ik_zelf
                I have seen that zabbix also has computed items. So the question is simple,
                How can I compute the percentage of actual that I have running for my TOOLs?

                I tried with:
                Code:
                (last(key1.[{#TOOL},running]) /
                last(key1.[{#TOOL},target])) * 100
                but no items are appearing now.
                There are at least two ways to do it:
                - create Template for one more, Calculated item
                - Create Calculated Item manually, by using the real name of keys.

                In case of creating Template, you have to use the same key as you used to create an individual Item.
                And formula can be:
                Code:
                100 * (last(key1.[{TOOL},running]) / key1.[{TOOL},target])
                In case of creating manual Item, the formula will include the real name of processes:
                Code:
                100 * (last(key1.["Standard Tool",running]) / key1.["Standard Tool",target])
                Be patient - formula calculates only after all data collected (plus additional 5-10 minutes plus Update interval for Calculated Item).
                Sincerely yours,
                Aleksey

                Comment

                • ik_zelf
                  Member
                  • Feb 2015
                  • 60

                  #9
                  Thanks,

                  the bit with: "patience" solved my issue, almost


                  What if I want to sum all running TOOLS ?
                  I guess that must be something like:
                  Code:
                  sum((last(key1.[,running]))
                  but it throws:
                  Cannot evaluate function "sum(running])": item "hostname:last(key1.[" does not exist. Does it matter that the TOOLS are discovered items?
                  Is my naming correct?

                  Something like a preview for these kind of things would be very convenient.
                  Last edited by ik_zelf; 27-03-2015, 16:23.

                  Comment

                  • aib
                    Senior Member
                    • Jan 2014
                    • 1615

                    #10
                    Well, it's very general question: "Can I create a graph with summary of all traffic from all discovered interfaces?"
                    And short answer is NO! Not yet.

                    It doesn't work in Discovery - Zabbix cannot predict how many interfaces/Items he will create and how complex formula has to be.

                    But you can create a manual Item after discovery process finished.
                    Just create Calculated Item and use formula like:
                    Code:
                    last(key1."Standard Tool".running) + last(key1."Internal Tool".running) + last(key1."Conflict Tool".running) + last(key1."Scheduler Tool".running)
                    Sincerely yours,
                    Aleksey

                    Comment

                    • ik_zelf
                      Member
                      • Feb 2015
                      • 60

                      #11
                      thanks for your reply. That with the network interface was exactly what I was searching for as an example to use. Too bad, I can not write this sum as I suggested because I am working with some dynamic items and need to have them all in scope, when they exist.
                      Also, writing such a sum for about a hundred items would be a bit messy..

                      I was imagining that zabbix would find the items that match the pattern at calculation time.

                      Thanks,
                      Ronald - who is learning every day

                      Comment

                      • ik_zelf
                        Member
                        • Feb 2015
                        • 60

                        #12
                        Originally posted by aib
                        Well, it's very general question: "Can I create a graph with summary of all traffic from all discovered interfaces?"
                        And short answer is NO! Not yet.
                        Hi Aleksey,

                        is there any news on this subject, I mean about the 'yet' part of Not yet. I can imagine that there could be some demand for this....

                        thanks,
                        Ronald.

                        Comment

                        • richlv
                          Senior Member
                          Zabbix Certified Trainer
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Oct 2005
                          • 3112

                          #13
                          you probably want to follow https://support.zabbix.com/browse/ZBXNEXT-927
                          Zabbix 3.0 Network Monitoring book

                          Comment

                          • ik_zelf
                            Member
                            • Feb 2015
                            • 60

                            #14
                            I assume that graphs and computed items have the same limitation concerning
                            "Can I create a graph with summary of all traffic from all discovered interfaces?"

                            or, can I easily create a sum for item[*,bytes], where the "*" represents a wildcard for an ID. Like with tablespaces, we measure tablespaces by size and a database size is the sum of all tablespaces .... Can we create a computed item for that?
                            (or do we need to make one huge computed item listing all tablespaces in a big sum?)

                            Comment

                            • richlv
                              Senior Member
                              Zabbix Certified Trainer
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Oct 2005
                              • 3112

                              #15
                              jira search says it's https://support.zabbix.com/browse/ZBXNEXT-1420
                              Zabbix 3.0 Network Monitoring book

                              Comment

                              Working...