Ad Widget

Collapse

API: host.update: losing existing data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sperrot2
    Junior Member
    • Nov 2023
    • 11

    #1

    API: host.update: losing existing data

    Hello Zabbixers,

    [I am posting this again, on behalf of a colleague, sorry if you already saw it]

    I created a script that uses the APIs to, among other things, modify macro's values. For this, I use host.update method, and it works fine. However, each time I run the script, everything gets reset on the host:
    - values already collected,
    - alerts
    - even LLD discovery elements

    Of course, a few minutes later, everything comme back, but it would be hardly acceptable in a production setting...

    Morover, as things seem to be working, I don't get the real difference between a 'host.update', and what would be a 'host.delete' followed by a 'host.create' ..

    Anyway, is there some way of keeping already collected informations while using 'host.update' API call?

    Thank you very much in advance...


    Best Regards,
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Can you share the script (anonymized, of course) ... or at least the update spec... host.update should not reset anything.
    as docs say "The hostid property must be defined for each host, all other properties are optional. Only the given properties will be updated, all others will remain unchanged.​"

    Comment

    • sperrot2
      Junior Member
      • Nov 2023
      • 11

      #3
      Hello,

      Thanks cyber for answering quickly ...

      As I do not follow this subject directly, I have transmitted the link to my colleague
      I know it is a Perl script, on a v6.0 (or 6.4 Zbx version)

      Comment

      • sperrot2
        Junior Member
        • Nov 2023
        • 11

        #4
        [Here is my colleague answer]


        Hi and and great thx for your reply. Just reading your words made me think of something … and I guess this is the story. In fact, in the part of my script that uses the host.update method, instead of creating a JSON with only the properties that change, I create a JSON with the whole properties, whether they have been modified or not !!! Stupid I am … Sure that if I modify the script so that the JSON only embeds the delta, I won’t have any trouble any more.


        Thx again !

        Comment

        Working...