Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-9961

Misleading DB error message when conf/maintenance.inc.php is set

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 3.0.0alpha3
    • Frontend (F)

      Zabbix FE show maintenance message when DB version does not match expected version.

      Steps to reproduce:

      • Use an older DB Version (my case: 2050061)
      • Edit conf/maintenance.inc.php
        • Define ZBX_DENY_GUI_ACCESS to 0 (or 1, but this would be expected)
        • Set an array WITHOUT your ip value to $ZBX_GUI_ACCESS_IP_RANGE (ex: array('127.0.0.1'))
        • Set a value to $_REQUEST['warning_msg']

      Example of conf/maintenance.inc.php:

      // Maintenance mode
      define('ZBX_DENY_GUI_ACCESS', 0);
      
      // IP range, who are allowed to connect to FrontEnd
      $ZBX_GUI_ACCESS_IP_RANGE = array('127.0.0.1');
      
      // MSG shown on Warning screen!
      $_REQUEST['warning_msg'] = 'Zabbix is under maintenance.';
      

      When trying to access, the message show is:

      $ curl http://zabbix
      <!DOCTYPE html>
      <html>
      ...
      <body><div class="article"><div class="msg-bad msg-global">Zabbix is under maintenance.<div class="msg-buttons"><button type="button" onclick="document.location.reload();">Retry</button></div></div></div><script type="text/javascript">
      setTimeout('document.location.reload();', 30000);
      </script></body></html>
      $
      

      It should reply instead, the error in include/config.inc.php:

      catch (DBException $e) {
      	(new CView('general.warning', [
      		'header' => 'Database error',
      		'messages' => [$e->getMessage()],
      		'theme' => ZBX_DEFAULT_THEME
      	]))->render();
      
      	exit;
      }
      

      If you comment everything in conf/maintenance.inc.php, the problem does not happen and it shows the correct error message:

      $ curl http://zabbix
      <!DOCTYPE html>
      <html>
      ...
      <body><div class="article"><div class="msg-bad msg-global">Database error<div class="msg-details"><ul class="msg-details-border"><li>The frontend does not match Zabbix database. Current database version (mandatory/optional): 2050061/2050061. Required mandatory version: 2050069. Contact your system administrator.</li></ul></div><div class="msg-buttons"><button type="button" onclick="document.location.reload();">Retry</button></div></div></div><script type="text/javascript">
      setTimeout('document.location.reload();', 30000);
      </script></body></html>
      $
      

            Unassigned Unassigned
            fpaternot Filipe Paternot
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: