Ad Widget

Collapse

Fetch multiple -derived- items using only one base item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cbichis
    Member
    • Apr 2013
    • 30

    #1

    Fetch multiple -derived- items using only one base item

    Hi,

    I need to extract from a server I am monitoring about 20 items data.

    The items can be all fetched using a single call, which is expensive.

    The data is stored into the output like this:

    item1: value1 (numeric)
    item2: value2 (numeric)
    item3: value3 (numeric)
    .................
    item20: value20 (numeric)

    Currently I have one UserParameter which allows me to extract every item with a call:

    UserParameter=app.status[*],/path-to-app/status | awk '/^$1/{$$1="";gsub(/^[ \t]+/, "");print}'

    Obviously this means I will have 20 - costly - calls to the app... Which is not good at all...

    I need to find out a way to only call the app one time and then extract (grep/awk) the items from the "base item".

    I think I have 2 solutions:

    1. Zabbix agent is fetching the entire app status output, which is stored within an item (Text) and on Zabbix server I use Calculated items for rest 20. There is however an issue. I can't find something to help me grep/awk the numerically values from the "base item". The functions which can be used on a Calculated item seems to be very limited:



    2. Zabbix agent is fetching the entire app status output, which is stored within an item (Text) and on Zabbix server. Then I use 20 External check items to extract the amounts for them from base item. Here is another issue. I need to pass to external script the value of "base item".

    However, as far as I tested I can't find how to pass item app.status value to external script:

    app_status.sh["paramtoget","{last(app.status)}"]
    or
    app_status.sh["paramtoget",{last(app.status)}]
    or
    app_status.sh["paramtoget",last(app.status)]

    Doesn't work as seems it's not passing the last app.status item value

    3. At least for now I am trying to avoid using trappers.

    Anyone has any idea how to either fix one of above issues or any other idea how to solve the problem?
    Last edited by cbichis; 18-04-2013, 15:42.
  • Bernd Hohmann
    Member
    • Mar 2013
    • 46

    #2
    I had the same problem getting a couple of values for a HTTP-Status.

    My solution: I created a script like "gethttpstatus(host,what)". When calling "what=status" it collects all the values and write them into a file /tmp/$host. When calling "what=value1" it returns the first line from /tmp/$host and so on.

    Small problem: its not guaranteed that Zabbix will call the script in the right order (status,value1,value2…..) so the first run after a status change may return some wrong values - which isn't a real problem.

    Bernd

    Comment

    • Heilig
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Mar 2013
      • 366

      #3

      In this situation, I think it would be appropriate to use zabbix_sender.

      Comment

      • cbichis
        Member
        • Apr 2013
        • 30

        #4
        Thanks Bernd, I already though of that but I don't find it a very good idea.

        Heiling, I will check using sender.

        Thank you!

        Comment

        Working...