Ad Widget

Collapse

Template's name not correct after upgrade

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MikaA
    Junior Member
    • Mar 2020
    • 6

    #1

    Template's name not correct after upgrade

    Hey,

    I just upgraded our old Zabbix 4.4 to 6.0 and now I am (of course) having issues with templates, probably due to updates to templates or something.

    For example, I have template "Template OS Linux", which provide items such as these:
    Click image for larger version

Name:	image.png
Views:	509
Size:	40.8 KB
ID:	455690
    Only now some of the items' names refer to some variable ($1 or $2). However, the item itself refers to correct value in system.cpu.util, idle/user/nice/ and so on. Some of the items look normal even though they seem to be of same format as those that don't:
    Click image for larger version

Name:	image.png
Views:	437
Size:	17.1 KB
ID:	455691

    Now, I tried importing the updated template, but it seems that it is called "Linux by Zabbix Agent" under "Operating systems" instead of "Operating Systems" the current template is, so it didn't replace the original one, which I thought was official linux os template. I could of course just update the names to match the item but the template would still be old, so not optimal. Or I could unlink and clear the old template and replace it with the new one, but that would delete all history, right? So not optimal, either.

    Is there something I'm missing or something else I could try? Manually edit the new template uuid to match the old one perhaps?

    I'm also considering reverting back to 4.4 and build a new 6.0 on the side, which would be better if I would be losing much of history data anyway.


    Mika
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    some of the items' names refer to some variable ($1 or $2)
    That syntax (positional macros) was deprecated 4.0 and it was removed in 6.0: https://www.zabbix.com/documentation...nger-supported

    You need to manually fix the template that uses those, like: "CPU idle time" and so on (in some templates they may refer to LLD macros like {#FSNAME}). Basically the number $N refers to the Nth parameter of the item key.

    Or I could unlink and clear the old template and replace it with the new one, but that would delete all history, right?
    Plain unlinking (NOT "Unlink and clear") does not remove the history, it just "moves" the items from template to the host. If you then add another template that refers to the same item keys, they continue living within that new template. That's the way you can change assigned templates. If your history data is valuable, you need to test all these in another environment to find out any problems in the process.

    I have my own set of specific OS and application-specific templates that I maintain (since Zabbix 3.2 or so), and when useful additions arise in the "standard" templates, I adjust my own templates, instead of replacing them with the standard ones. It takes some effort, but the standard templates often contain so much irrelevant items anyway so it pays off. If you rather like the standard ones, you can try hopping to the standard template train instead by testing the process and replacing your old templates.

    Markku

    Comment

    • MikaA
      Junior Member
      • Mar 2020
      • 6

      #3
      Originally posted by Markku
      That syntax (positional macros) was deprecated 4.0 and it was removed in 6.0: https://www.zabbix.com/documentation...nger-supported
      Ah, that wold explain it, yes :-)

      Originally posted by Markku
      ​Plain unlinking (NOT "Unlink and clear") does not remove the history, it just "moves" the items from template to the host. If you then add another template that refers to the same item keys, they continue living within that new template. That's the way you can change assigned templates. If your history data is valuable, you need to test all these in another environment to find out any problems in the process.

      Yes, that's what I tried first, but I still got error about two items populating the same inventory field (or something like that), so I thought I would have to clear the history altogether.. But, if not, I'll try that way first.

      Hmm, I just did updated the new "linux os template" template to refer to uuids in the current template and there were lots of new items. Am I correct to assume, that:

      1. if I import that adjusted template those items will replace/update the currently present items and add new ones
      2. if I import the unmodified template, unlink the old one and link the new one, I have visually the same end result, but at the db level I would have different uuid entries for same keys

      I suppose history is not that important to not let go, but at least with this specific template I can try the unlinking and linking the unmodified standard template and see what happens :-)

      Thanks for that!

      Comment

      • Markku
        Senior Member
        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
        • Sep 2018
        • 1781

        #4
        error about two items populating the same inventory field (or something like that)
        I don't use inventory much, but I believe this is due to you now have to separate items (= different keys) that populate the same inventory field. You can fix this by reconfiguring one of the keys to not update inventory, or (more likely) the other item is redundant anyway so you can delete it.

        Now about the UUIDs, I haven't really had to fight with them (due to my earlier described strategy of using mostly my own templates), but yeah, just experiment how they actually work when importing templates and you will figure out the best way for you. Luckily it is easy to export and import the database to another server for experiments, you don't really need any monitoring connections to fiddle with the items and template so you can isolate the test server with iptables or external firewall or whatever. Let us know if you need help with cloning the database.

        Markku

        Comment

        • MikaA
          Junior Member
          • Mar 2020
          • 6

          #5
          Yes, I'm getting closer.. Went with "add/modify items from official template to old modified template". Fixed a few typos and such per errors on import as long as it gave some useful tips regarding what's wrong, but then it gave me this:


          Details Import failed
          No permissions to referred object or it does not exist!


          ​Well, it could refer to macros or valuemaps as those didn't exist in the template before, but.. Is there some way to increase logging or whatnot to see what exactly is the problem? Increasing debuglevel for server didn't seem fruitful.

          I am logged in as super admin role so permissions really shouldn't be a problem?


          Comment

          • Markku
            Senior Member
            Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
            • Sep 2018
            • 1781

            #6
            The error doesn't ring any bells here. Would it be possible that you try limiting the import scope by adding only a few changes at a time?

            Markku

            Comment

            Working...