Ad Widget

Collapse

Item is a string list from user parameter, can I graph of display the values ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gerard-wl
    Junior Member
    • Sep 2015
    • 24

    #1

    Item is a string list from user parameter, can I graph of display the values ?

    Hello to all,

    My command showList produces a short list of sellers like this :

    Peter 45
    Cathy 70
    Fred 0
    ...
    Oliver 30



    The configuration could be :

    ​UserParameter=sellers,showList

    How can easily display this item in a graph or in a table with Zabbix ?

    Thank you!
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Use dependent items (type integer).

    Comment

    • gerard-wl
      Junior Member
      • Sep 2015
      • 24

      #3
      Thank you Hamardaban , not obvious to use in my case ... I'll try to do ...
      ​​​​​​​

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        Graph requires numbers. Your datais not numbers, but a name/value pairs. You can split it up into separate items, based on name (as suggested) and your saved data is now numbers... and with numbers you can draw a graph...

        Comment

        • gerard-wl
          Junior Member
          • Sep 2015
          • 24

          #5
          Than you cyber I've managed to get an apache server uptime as described in the documentation
          But in my case, I don't know a priori the list of vendor names, they can be 100 or 1.000, some new ones may appear and others may disappear, so I can't create a dependent item via a regexp per vendor ...

          Comment

          • cyber
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Dec 2006
            • 4807

            #6
            Originally posted by gerard-wl
            Than you cyber I've managed to get an apache server uptime as described in the documentation
            But in my case, I don't know a priori the list of vendor names, they can be 100 or 1.000, some new ones may appear and others may disappear, so I can't create a dependent item via a regexp per vendor ...
            Then you need to turn to "LLD" and let it create needed items for you.. https://www.zabbix.com/documentation...evel_discovery.

            Comment

            • gerard-wl
              Junior Member
              • Sep 2015
              • 24

              #7
              I see cyber , I'm going to try
              Can I use userparameter (I can format in json if necessary) to feed LLD ? Or any other method ?

              Comment

              • gerard-wl
                Junior Member
                • Sep 2015
                • 24

                #8
                My test :

                UserParameter=discovery.aaa.bbb, /var/tmp/ab/jsonmake

                #cat /var/tmp/ab/jsonmake
                #!/bin/sh

                echo '{ "data": [
                {
                "{#SELLER}": "Peter",
                "{#RESULT}": "45",
                },
                {
                "{#SELLER}": "Cathy",
                "{#RESULT}": "70",
                } ]
                } '

                #

                #/usr/sbin/zabbix_agent2 -t discovery.aaa.bbb
                discovery.aaa.bbb [s|{ "data": [
                {
                "{#SELLER}": "Peter",
                "{#RESULT}": "45",
                },
                {
                "{#SELLER}": "Cathy",
                "{#RESULT}": "70",
                } ]
                }]
                #



                Click image for larger version  Name:	cap.png Views:	0 Size:	19.6 KB ID:	456479

                But nothing in latest data received ...

                What is missing for me to see 'Peter', 'Cathy', .... 'Oliver' as items and their associated score ?
                Last edited by gerard-wl; 22-12-2022, 18:07.

                Comment

                • Hamardaban
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • May 2019
                  • 2713

                  #9
                  Your json for LLD looks fine
                  (by the way, in new versions, you can not use "data:" in the name of the array - use just array [{},{},{}] ).
                  Show how you made item prototypes?

                  Comment

                  • gerard-wl
                    Junior Member
                    • Sep 2015
                    • 24

                    #10
                    Than you Hamardaban ok I change the script and remove "data".
                    I didn't create anything else, it's my question, what must I create presicely (item prototype?), I'm quite a newbee in LLD

                    Comment

                    • Hamardaban
                      Senior Member
                      Zabbix Certified SpecialistZabbix Certified Professional
                      • May 2019
                      • 2713

                      #11
                      Yes - you need to describe the item prototypes in order for them to be created.
                      Everything is written in detail in the documentation:

                      Comment

                      • gerard-wl
                        Junior Member
                        • Sep 2015
                        • 24

                        #12
                        Please what item prototypes do I have to create for this simple case ? I can't do it please.

                        UserParameter=discovery.aaa.bbb, /var/tmp/ab/jsonmake

                        #cat /var/tmp/ab/jsonmake
                        #!/bin/sh

                        echo '[
                        {
                        "{#SELLER}": "Peter",
                        "{#RESULT}": "32"
                        },
                        {
                        "{#SELLER}": "Cathy",
                        "{#RESULT}": "750"
                        }]'

                        # /usr/sbin/zabbix_agent2 -t discovery.aaa.bbb
                        discovery.aaa.bbb [s|[
                        {
                        "{#SELLER}": "Peter",
                        "{#RESULT}": "32"
                        },
                        {
                        "{#SELLER}": "Cathy",
                        "{#RESULT}": "750"
                        }]]





                        The discovery rule with key discovery.aaa.bbb is created

                        But what are the few steps to complete ?
                        Last edited by gerard-wl; 27-12-2022, 11:49.

                        Comment

                      • gerard-wl
                        Junior Member
                        • Sep 2015
                        • 24

                        #13
                        Hello Hamardaban i've read it more than 10 times
                        So i created this item prototype for my rule :
                        name: result of users
                        type: zabbix trapper
                        key: result["{#SELLER}"]
                        other fields : default
                        In the host configuration, i can see 2 items:
                        result["Peter"]
                        and
                        result["Cathy"]
                        ​type trapper ​
                        ---
                        In the latest data, I can see 2 lines with name "result of users", last check, last value, and change are empty, despite the discovery rule has a period of 1m
                        So I'm missing something to see result["Peter"] and result["Cathy"] constantly updated in these lastest data, since the script /var/tmp/ab/jsonmake (here static) will be in fact dynamic with new values for the "{#RESULT}" field, no?

                        Comment

                        • Hamardaban
                          Senior Member
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • May 2019
                          • 2713

                          #14
                          You missed the following: there are 2 independent processes - the first is LD (creates items, etc.) and the second is getting data into the created items.
                          You, as the "creator" of the system, determine what and how you will receive \ take.
                          What can I offer?
                          You already have a script creating json with data. well.
                          1) Create an item (A, text) that will access the script and receive json (like current lld)
                          2) Change the LLD rule you created so that it is dependent items from previously created items A.
                          3) in LLD, create "item prototypes" also dependent on A with jsonpath preprocessing

                          When "main" item receives the data, the LD rule will work first and create items. In the future, when the data is received by the main items again, the dependent ones (created from prototypes) will also receive the data.

                          Here is an example: https://www.zabbix.com/documentation...ed_filesystems

                          Look at how the official zabbix templates are made- such constructions are constantly used there.


                          Last edited by Hamardaban; 27-12-2022, 12:06.

                          Comment

                          • gerard-wl
                            Junior Member
                            • Sep 2015
                            • 24

                            #15
                            Heum I'm not sure to understand your advices Hamardaban
                            I understand you are a specialist in zabbix, and I feel it clearly, but you speak about the general case of creating 2 processes, your level of knowledge and theory probably seems high but I can't bring them closer to my case
                            Could we be pragmatic for my case ? I think it will be better to understand the missing steps
                            What is missing here and not elsewhere ?
                            Could you describe the steps (in zabbix gui terms), one by one, which will allow me to see refreshed sellers' results in latest data ?
                            I can also use a zabbix sender instead of userparameter, without knowing precisely if one or the other is essential to define this LLD rule ...
                            I think I'm going to have this click to understand everything in LLD rule, but I don't have it yet, and completing this example is a good exercise in my eyes​

                            Comment

                            Working...