Ad Widget

Collapse

Zabbix 3.4.7 Agent Auto-registration | multiple HostMetadataItems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pimp_vader
    Junior Member
    • Oct 2014
    • 12

    #1

    Zabbix 3.4.7 Agent Auto-registration | multiple HostMetadataItems

    Apologies if this has been answered somewhere already but I spent the last 2.5 hours combing the forums and found nothing.

    I am able to get auto-registration, assign a template, and get the host assigned to a host group using configuration items within the /etc/zabbix/zabbix_agentd.conf file, my question is can I string together multiple HostMetadataItems to leverage multiple actions
    e.g.

    metadata like Linux add to Linux servers
    metadata like linux link linuxserver template
    metadata like ovirt add to Vitual Machines group


    I am finding the first 2 will process fine, the third doesn't appear to be triggered.
    My aget.conf is set like this


    Code:
    ### Option: HostMetadataItem
    #       Optional parameter that defines an item used for getting host metadata.
    #       Host metadata is used at host auto-registration process.
    #       During an auto-registration request an agent will log a warning message if
    #       the value returned by specified item is over limit of 255 characters.
    #       This option is only used when HostMetadata is not defined.
    #
    # Mandatory: no
    # Default:
    # HostMetadataItem=
    
    HostMetadataItem=system.uname
    HostMetadataItem=system.run['facter virtual']
    FWIW this is what I am getting returned when I do a zabbix_get

    Code:
    -bash-4.2$ zabbix_get -s <IPADDR> -p 10050 -k system.run['facter virtual']
    ovirt
    And I do see the system.run['facter virtual'] being called and successfully executed in the agent logs on the target host


    I am starting to think that after it processes the first HostMetadataItem it stops if this is the case is there a method that will allow for multiple HostMetadataItems to be leveraged for registration purposes?

    Thanks in advance
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    I think that HostMetadataItem could not describe multiple lines.
    Try to arrange the necessary character strings in the definition of one line.

    Comment

    • pimp_vader
      Junior Member
      • Oct 2014
      • 12

      #3
      Is there a certain style in which they should be strung together?
      e.g.
      Code:
      HostMetadataItem=system.uname | HostMetadatItem=system.run['facter virtual']
      HostMetadataItem=system.uname | system.run['facter virtual']
      HostMetadataItem=system.uname ; HostMetadatItem=system.run['facter virtual']
      HostMetadataItem=system.uname , HostMetadatItem=system.run['facter virtual']
      Each variation that I have tried so far returns some variation of

      Code:
       2807:20180322:140323.780 cannot get host metadata using "system.uname | HostMetadatItem=system.run['facter virtual']" item specified by "HostMetadataItem" configuration parameter

      And thank you for the response

      Comment

      • pimp_vader
        Junior Member
        • Oct 2014
        • 12

        #4
        bump since I have not found a workable solution yet

        Comment

        • dxmski
          Junior Member
          • Jul 2022
          • 2

          #5
          did you ever find the solution to this? i'm looking at setting up something similar where I have different hosts within different subnets, different domains and different operating systems. Is it best to just have one metadataitem that calls a userparameter that grabs all that information into one string?

          Comment

          • don Rumata
            Junior Member
            • Aug 2023
            • 1

            #6
            My solution:

            /etc/zabbix/zabbix_agentd.conf:
            HostMetadataItem="vfs.file.contents['/etc/zabbix/metadata']"

            `cat /etc/zabbix/metadata`:
            linux=os
            smartmontools=present
            docker=present

            Comment

            Working...