Ad Widget

Collapse

How to get the HOST.ID in an item key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FH26
    Junior Member
    • Feb 2022
    • 15

    #1

    How to get the HOST.ID in an item key

    Hey, I'd like to use the HOST.ID Macro in an item key.
    Sadly this doesnt work, only HOST.HOST, but I need the ID.
    Is there any reason this doesnt work and any know workaround?
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    I guess it is not working there, as it not made to work there...

    If you think this might be useful, you can submit a request for that.

    For workarounds, there's too little information about what you want to achieve...

    Comment

    • FH26
      Junior Member
      • Feb 2022
      • 15

      #3
      I've programmed a script to periodically update the hosts name to a specific value we're receiving over SNMP.
      This script takes the Host ID and then changes the name over the API.
      I wanted the script to be run by an External Check item and the item calls the script (./updatehostnames.sh {HOST.ID} ).
      I want every host to have this item so that the name is always up to date.
      The script works perfectly fine, but I sadly can't call it since items don't allow the {HOST.ID}-Macro.

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        ok .. so is that value stored in one of items? Basically you could create a trigger, something like "hostname changed" and then use {HOST.ID} in action associated with that trigger...
        {HOST.ID} → Trigger-based notifications and commands

        Comment

        Working...