Ad Widget

Collapse

Item : return an array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tof233
    Member
    • Nov 2010
    • 94

    #1

    Item : return an array

    Hello,

    I would like to know whether it is possible for an item to get an array.

    Here is the idea:
    I wrote a check_fping command.
    I would like it to return to zabbix server an array like:
    $values["Round trip time"]
    $values["loss"]

    I know I could do one check_ping_RTT and one check_ping_loss but I would like to retrieve directly all informations from only one ping.

    Do you have an idea if it's possible?
  • zabbix_zen
    Senior Member
    • Jul 2009
    • 426

    #2
    You could set the item as 'char' type.
    But how would you build the Trigger expression over it?

    Comment

    • tof233
      Member
      • Nov 2010
      • 94

      #3
      Thank you for your reply.
      I thought there would be something like
      item.roundtriptime
      and item.loss

      Comment

      • untergeek
        Senior Member
        Zabbix Certified Specialist
        • Jun 2009
        • 512

        #4
        You can send an array to Zabbix, but you can only process it as a string.

        This means you can't trend the data and you can't graph it. Building triggers is also complicated as it can only look to see if a string match exists within the stored value.

        Far better to store multiple items which are number based and trendable than to store an array.

        If you receive multiple values back from a script, consider parsing those values further and sending them back via zabbix_sender or something of the sort.

        Comment

        • alixen
          Senior Member
          • Apr 2006
          • 474

          #5
          Hi,

          I have a few external scripts that generate several values when called.

          The way I get all of them is to return first one as return value (as expected by Zabbix) and feed other values to items of type "Zabbix trapper" with zabbix_sender command.

          My setup looks like:
          • item1 : type : external script, script : myscript.sh[{HOSTNAME}]
          • item2 : type : zabbix trapper
          • item3 : type : zabbix trapper


          and mysript.sh

          Code:
          #! /bin/sh
          host=$2
          
          #.. collect all values
          
          zabbix_sender -z127.0.0.1 -h $host -k item2 -v $value2
          zabbix_sender -z127.0.0.1 -h $host -k item3 -v $value3
          echo $value1
          exit 0
          Regards,
          Alixen
          http://www.alixen.fr/zabbix.html

          Comment

          • tof233
            Member
            • Nov 2010
            • 94

            #6
            Thank you both for your help.

            So I will try using the zabbix sender.

            Comment

            Working...