Ad Widget

Collapse

Using cut or split in formula to parse a string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeff.gilbertson
    Junior Member
    • Feb 2012
    • 1

    #1

    Using cut or split in formula to parse a string

    I searched the manual and the forum, and can't find an answer to this question.

    Suppose I have a custom UserParameter (en_data) that returns the following:

    en0:0:0:1234:9876:3579:3159:0:113

    That would have an item created to store as-is.


    Is it possible to then create separate calculated value items from each colon-delimited parameter?

    ie:

    Host.iface=(split(/:/, en_data))[0]
    Host.xmitdropped=(split(/:/, en_data))[1]
    Host.rcvdropped=(split(/:/, en_data))[2]

    etc, etc

    or:

    Host.iface=(cut -d ":" -f0),en_data
    Host.xmitdropped=(cut -d ":" -f1),en_data

    etc, etc

    Reason is ...

    If I have three interfaces, and each interface has 10 parameters, that is 30 requests for data from the agent.

    If I could split the colon-delimited result, I could reduce that to one request per interface, effectively moving the workload from the client-side (agent) to the server-side.

    Is this remotely possible?

    Thanks!
  • Tractorboy
    Member
    • Oct 2010
    • 98

    #2
    Not that I am aware

    But really do believe it would be a good feature. I know I'd use it, as I have many times wanted this and have had to make multiple requests to gather the same.

    I have also in some cases worked around this by using vbs (appreciate not good for your example)

    I call a vbs script, which itself then uses zabbix sender to push out all the key/value pairs of results. Finally returning 0 for success if all succeeded.

    Comment

    Working...