Ad Widget

Collapse

Official Template upgrades: Best practices?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lolstrup
    Junior Member
    • Jul 2021
    • 11

    #1

    Official Template upgrades: Best practices?

    Hi,

    I have 858 hosts using the "Linux by Zabbix Agent active" template from Zabbix 5.4.
    I want to upgrade the template to version 6.2, especially because of the new functionality with heartbeats in active checks.
    I don't think they have any custom changes, and if they do, I don't care about overwriting them.

    It seemed like a good idea to follow this blog post: https://blog.zabbix.com/keeping-your...to-date/16412/
    The directions says to "add a prefix to their names, so the new and old templates can live side by side", but this is just incorrect. It appears the templates have a UUID, so the name doesn't matter.
    (And why is this? If the templates can't compatibly upgrade, they shouldn't have the same UUID..)

    Anyway, I exported the 5.4 version of the template and tried to import 6.2. It keeps giving me errors like "Item with key "proc.num" already exists on "Linux by Zabbix agent active".".
    I tried removing a few until I figured that's a bad idea.

    If I check all the "Delete missing" boxes, it times out with a database error, seemingly trying to update all 858 hosts. I'm unable to reproduce the error the past few attempts, now it just gives "Unexpected server error.".

    What gives? What am I supposed to do? Change the UUID in the imported template (or the old)?
    Then replace the template on all the hosts?
    Template upgrades seem like a huge oversight..

    Thanks
  • yurtesen
    Senior Member
    • Aug 2008
    • 130

    #2
    A bit late... but I faced the same issue and made a bug report. Feel free to vote it up...


    What I did was to
    1- create temporary template (empty) X_temp
    2- assign temporary template X_temp to all hosts using template X
    3- unassigned template X from all hosts
    4- upgrade template X
    5- assign template X to all hosts.

    The reason for X_temp is to be able to find the hosts where the X template was originally assigned.
    I found out that even this cause conflicts sometimes. So clone your zabbix server database and try in the clone first. Also a small mistake can be hard to undo. So make a backup before trying.
    In addition, some old items from older templates are left behind. You will need to clean them manually.​

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #3
      Originally posted by lolstrup
      What gives? What am I supposed to do? Change the UUID in the imported template (or the old)?
      Then replace the template on all the hosts?
      Template upgrades seem like a huge oversight..
      Do the changes they made in version 6.2.7 address some of the pain you're running into with templates? https://www.zabbix.com/documentation...rade_notes_627

      Note: 6.2.7 hasn't been released yet

      Comment

      • yurtesen
        Senior Member
        • Aug 2008
        • 130

        #4
        tim.mooney Probably not, and it might make things worse or/and more confusing. It looks like one coming change is that it does not remove entries when unlinking templates during import. tried to manually unlink templates without clearing them, then import new ones and it did not work.

        The other coming change is allowing new UUID to overwrite old UUID based on, quoting from the changelog link you provided,-> "entity ID (name)" <-. But if you look at the OPs post, the problem does not seem to do anything with UUIDs. Also it is not clear what "entity ID (name)" is? I would have thought they would have used item keys for uniqueness, not the item name. Between old and new templates there are sometimes items with same key but different names sometimes. Then what?

        To make matters worse, these changes will introduce some uncertainties. For example, in the past I could export a template and find/replace all entries of zabbix agent items and replace it with zabbix agent active items. Therefore creating a template which uses active agent. What will happen when I do this in future? Currently it fails because UUIDs of items are same in both templates... See: https://www.zabbix.com/forum/zabbix-...d-agent-active

        I have to say, the template diff that zabbix 6+ shows is quite nice improvement. But making templates easily upgradeable seem to require going back to drawing board...

        Comment

        Working...