Ad Widget

Collapse

Zabbix server template problem after upgrade from 5.0 to 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guillermo.los
    Junior Member
    • Jun 2021
    • 4

    #1

    Zabbix server template problem after upgrade from 5.0 to 6.0

    Hi Guys,
    I just upgrade from 5.0 to 6.0 and as you can see the old zabbix server template is not working well because of the $1 values. is there any way to fix it or download the new zabbix_server template?
    Thanks a Lot
    Regards,
    Guillermo
  • pgatty
    Junior Member
    • Feb 2022
    • 14

    #2
    This is expected. Support for positional macros was deprecated in Zabbix 5 and removed in Zabbix 6. You have two options to fix this:
    1. Replace the old template with the updated template from the official zabbix git repo. The drawback to this is you'll lose all the history for the template items.
    2. Edit the template item names and replace the $4 and $2 with the entries from the Key in the item. For example
    Original item Name Zabbix $4 $2 processes, in %
    Key zabbix[process,java poller,avg,busy]

    The $number represents the position of the item between the [ ]. So the in example above $4 would be busy and $2 would be java poller. The new item name would be

    Zabbix busy java poller processes, in %






    I had this problem in a number of templates. Make sure you also check and update the item names in the item prototypes under the discovery rules. FYI... if you end up changing a lot of item prototype names, you might want to lower the threshold "Keep lost resources period" so the old items get cleaned up (assuming you don't need the history for these items)..
    Last edited by pgatty; 19-02-2022, 22:28.

    Comment


    • guillermo.los
      guillermo.los commented
      Editing a comment
      Thanks pgatty, I'm trying the import of new template , but it's taking so long to import , that is weird.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #3
    Just for correctness... that was deprecated already in 4.0. It continued to work, but it was said, support will be dropped later, fix your templates accordingly.. With v6, this drop finally arrived...

    Comment

    • guillermo.los
      Junior Member
      • Jun 2021
      • 4

      #4


      importing taking forever.

      Click image for larger version

Name:	2022-02-22_09h54_49.png
Views:	4843
Size:	26.8 KB
ID:	440239

      Comment


      • piti
        piti commented
        Editing a comment
        same problem... cannot import template to 6.0
    • highpeak
      Member
      • Nov 2019
      • 30

      #5
      Upgraded to 6.0.2 and same issue here, template import fails to complete.

      Comment

      • MarGeta
        Junior Member
        • Nov 2021
        • 6

        #6
        Same here, can no longer import templates

        Comment

        • guillermo.los
          Junior Member
          • Jun 2021
          • 4

          #7
          What I had to do to import the template is increase the PHP memory way over the recommended value and then works.
          then I put back.

          Comment


          • eDonkey
            eDonkey commented
            Editing a comment
            Solved it for me too.
        • eDonkey
          Junior Member
          • Jun 2022
          • 4

          #8
          If the import is stuck uploading, do as guillermo.los said.
          Just increase the php memory (on Ubuntu located in "/etc/zabbix/apache.conf").
          For me setting "memory_limit" to 800M was enough to do the upload.

          Comment

          • JSylvia007
            Junior Member
            • Sep 2007
            • 29

            #9
            Since I don't mind losing the data. is the appropriate procedure this:

            1. Unlink & Clear the template from all hosts
            2. Delete the Template
            3. Import the new template
            4. Re-link for all appropriate hosts

            Comment

            • Akraz
              Junior Member
              • Sep 2022
              • 11

              #10
              Originally posted by JSylvia007
              Since I don't mind losing the data. is the appropriate procedure this:

              1. Unlink & Clear the template from all hosts
              2. Delete the Template
              3. Import the new template
              4. Re-link for all appropriate hosts
              Thank you. This helped me in 6.2.2. Only issue is i had to reconfigure a lot of classifications of triggers

              Comment

              • frater
                Senior Member
                • Oct 2010
                • 340

                #11
                Originally posted by cyber
                Just for correctness... that was deprecated already in 4.0. It continued to work, but it was said, support will be dropped later, fix your templates accordingly.. With v6, this drop finally arrived...
                You bring this as something good....
                I should never have upgraded.
                My punishment for not following the advice I often give "If it ain't broke, don't fix it"

                The whole idea of computers is to let it work out the results.

                Now it suddenly can't fetch those variable values and put them in its place and if I want to change the value I have to put the same thing in 2 positions, which is asking for errors.
                Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

                Comment

                • tim.mooney
                  Senior Member
                  • Dec 2012
                  • 1427

                  #12
                  Originally posted by frater
                  Now it suddenly can't fetch those variable values and put them in its place and if I want to change the value I have to put the same thing in 2 positions, which is asking for errors.
                  I agree 100% with that.

                  As Cyber said, the developers noted way back in the 4.x days that this behavior was deprecated, but they never said why. They have essentially taken away something that was useful in previous versions of the product, without ever explaining why that feature needed to be removed. Was it a big performance hit? Was it massively complicating some part of the code? Or was it removed for completely arbitrary reasons? Sadly, in most cases, we'll never know.

                  My site's 10 year anniversary with Zabbix just passed, so I have a pretty good history with the product at this point. I still think the developers do a great job, but although I feel like they do a great job explaining "what", especially for deprecations and big product changes I often wish there was also more "why". By that, I mean a rationale or explanation for why a long-time feature is being removed or greatly redesigned (requiring customer adjustments or changes).

                  Comment

                  • frater
                    Senior Member
                    • Oct 2010
                    • 340

                    #13
                    I think Zabbix is the only piece of software I know that makes changes to make it easier for the programmers instead of easier for its users.
                    Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

                    Comment

                    • sivann
                      Junior Member
                      • Mar 2016
                      • 8

                      #14
                      How to fix directly in the DB. Backup first! The following is for postgresql:

                      1. find list of items to fix, save in items.csv:
                      Code:
                      psql -d zabbix -At -c "select itemid,name,name_upper,key_ from items where name like '%$%'" >items.csv


                      2. Create the SQL commands to fix it with the following script (save in zabbixnamesfix.py and run it):
                      Code:
                      #!/usr/bin/env python3
                      import sys
                      import os
                      import re
                      
                      file1 = open('items.csv', 'r')
                      items = file1.readlines()
                      count = 0
                      
                      # Strips the newline character
                      for row in items:
                        itemrow=row.strip()
                        i=itemrow.split('|')
                        itemid=i[0]
                        name=i[1]
                        name_upper=i[2]
                        key=i[3]
                        keyparams=key[key.index('[')+1:-1] #between []
                        kp=keyparams.split(',')
                        idx=0
                        oldname=name
                        for k in kp: #kp array of key parameters
                          idx+=1
                          name=name.replace('$'+str(idx), k)
                        #print('oldname:%-30s, name:%s'%(oldname,name))
                      
                        if not itemid.isnumeric():
                          print(f'ERROR in row {row} itemid not numeric')
                          continue
                        print(f"UPDATE items SET name='{name}', name_upper=UPPER('{name}') WHERE itemid={itemid};")
                      ​
                      ​
                      Then execute it:
                      ./zabbixnamesfix.py >patch.sql

                      3. Review patch.sql and apply it in the db

                      It will replace e.g.
                      "Used disk space on $1 in %" --> "Used disk space on /var in %"
                      Last edited by sivann; 29-09-2023, 15:02.

                      Comment

                      Working...