Ad Widget

Collapse

Filter hosts in zabbix api by inventory field?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmusbach
    Member
    • Sep 2013
    • 37

    #1

    Filter hosts in zabbix api by inventory field?

    Hello, we're playing around with identifying hosts in the api using fields in inventory but so far haven't had much luck. Using the perl ZabbixAPI wrapper we've tried:

    Code:
    $hosts=$zab->host_get(
            {
                    filter => {
                            inventory => {
                                    type => 'permamaint'
                            }
                    },
                    groupids => $groupid,
                    output => 'extend'
            }
    );
    But that doesn't even catch hosts that have permamaint in their inventory type field so it seems the filter isn't working. What's the correct syntax for this? Thanks.
  • eric_draven
    Junior Member
    • May 2013
    • 24

    #2
    Hi,
    I have the same problem..Did you succeed eventually?

    Comment

    • jmusbach
      Member
      • Sep 2013
      • 37

      #3
      Hi we did but not efficiently unfortunately. What we ended up having to do is loop through all the hosts getting their details with selectInvetory set to true. Then we checked using perl in our case the value of the inventory field we're using on each iterated host and if it had a valid value then we printed that host. Not efficient but functional.

      Comment

      • eric_draven
        Junior Member
        • May 2013
        • 24

        #4
        Ok, I got it..I think I will try something similar!

        Many thanks

        Comment

        Working...