Ad Widget

Collapse

Updating template items via import in 1.8.2 not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • limo
    Senior Member
    • Dec 2004
    • 192

    #1

    Updating template items via import in 1.8.2 not working

    Hi to all,

    we use automatic script to get SNMP oids, portnames etc, which automaticaly generates xml suitable for zabbix import. This works fine.

    We linked our ciscos to templates, which are automaticaly generated by this script. Again, no problem.

    Now, we are expecting, that when we import updated templates definitions, all items, triggers and graphs will be updated on ciscos.

    But when we want to do this, we get this error during importing XML:

    Fatal error: Undefined class constant 'resetErrors' in /var/www/zabbix/include/export.inc.php on line 859

    Please, is our scenario OK? Does it should work as we expected? We want to achieve every day automatic import of actualised templates (due to port name changes and link changes) and all graphs, item descriptions and triggers should update autmaticaly.

    Thank you very much,
    Lukas
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    interesting. php version, distro ?
    if you view "reports -> status of zabbix" as superadmin, does it complain about anything ?
    Zabbix 3.0 Network Monitoring book

    Comment

    • limo
      Senior Member
      • Dec 2004
      • 192

      #3
      Report is Ok, does not complain about anything.

      Distro is debian lenny.

      PHP version is 5.2.6.dfsg.1-1+lenny8

      Looking into sources, it seems that ResetErrors() is method, but it is called as constant at this line (without () ). Maybe this could be problem..

      Thank you

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        not sure about details. maybe you can figure out the exact item/trigger that is causing the message and attach a testcase template here ?
        Zabbix 3.0 Network Monitoring book

        Comment

        • limo
          Senior Member
          • Dec 2004
          • 192

          #5
          Hi,

          here is template which is causing problem. But many of them are doing same error. But when it was imported first time, everything is OK. We found, that fist import of template with name 'Template_xxx' is OK, but any subsequent import of same template (which would update items and triggers for all linked hosts too), ends with this error. Unfortunatelly, I cannot say, which trigger or item does this problem because error is fatal and not handled..
          Attached Files

          Comment

          • pikmaster
            Junior Member
            • Feb 2009
            • 12

            #6
            Undefined class constant 'resetErrors'

            Hi. I think it's not related to the particular template, but the fact, that you need to use parenthesis when invoking class method. Change those two lines

            zabbix-1.8.2/frontends/php/include/export.inc.php:859
            PHP Code:
            throw new APIException(1CTemplate::resetErrors); 
            to
            PHP Code:
            throw new APIException(1CTemplate::resetErrors()); 

            and zabbix-1.8.2/frontends/php/include/export.inc.php:873
            PHP Code:
            throw new APIException(1CHost::resetErrors); 
            to
            PHP Code:
            throw new APIException(1CHost::resetErrors()); 
            Unfortunatelly, it produces more errors, when importing:

            * Undefined variable: template[/usr/src/zabbix-1.8.2/frontends/php/api/classes/class.ctemplate.php:1010]
            * Invalid argument supplied for foreach()[/usr/src/zabbix-1.8.2/frontends/php/api/classes/class.ctemplate.php:1183]
            * reset() [<a href='function.reset'>function.reset</a>]: Passed variable is not an array or object[/usr/src/zabbix-1.8.2/frontends/php/api/classes/class.ctemplate.php:1206]
            * Template [ cisco4948 ] already exists
            * Failed to update template

            The problem seems to be this line zabbix-1.8.2/frontends/php/api/classes/class.ctemplate.php:1010

            PHP Code:
            $template['templates'] = $template
            Which seems to be resolved by changing it to:
            PHP Code:
            $template['templates'] = (array)$template
            OK, the patch is submitted http://www.zabbix.com/forum/showthread.php?t=16753
            Last edited by pikmaster; 19-04-2010, 11:04.

            Comment

            • richlv
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Oct 2005
              • 3112

              #7
              so, does importing work as expected in 1.8 svn head ?
              Zabbix 3.0 Network Monitoring book

              Comment

              • simonc
                Member
                • Jul 2009
                • 73

                #8
                Hi all !

                Any news about this problem ? Is it fixed in the next version ?
                I had the same problem on 1.8.2 and i applied the pikmaster's patches to operate properly.

                Br
                Simon

                Comment

                • zabbix_zen
                  Senior Member
                  • Jul 2009
                  • 426

                  #9
                  Hi.

                  This issue is still present in 1.8.5
                  If php-xml isn't installed, instead of a blank message an error message should be shown after the failed import.

                  Comment

                  Working...