Ad Widget

Collapse

It seems the zabbix-server is not talking to database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sentiblue
    Junior Member
    • Jan 2017
    • 3

    #1

    It seems the zabbix-server is not talking to database

    Hi all....

    I'm installing the Zabbix server 3.2 for Ubuntu using the following instructions page


    Everything went fine... no errors.

    But few things are not right

    1. There's no /usr/share/doc/zabbix-server-mysql/create.sql.gz as stated in the documentation.
    - I did find 3 files in /usr/share/zabbix-server-mysql: data.sql.gz, images.sql.gz, and schema.sql.gz.
    - I ran these files in order: schema, images, data. I really don't know if that's the right order... I used my best judgement.

    2. There's no /etc/zabbix/apache.conf.
    - I did find this file at the same location of the sql scripts and copied over
    - I added the several lines to it as indicated in the instructions
    - This file alone being there doesn't offer any good. It has to be referenced by /etc/apache2/apache2.conf using this line: "Include /etc/zabbix/apache.conf". This should be mentioned in the documentation.

    3. MySQL, zabbix-server and apache2 start OK

    But when hitting the front-end with a browser... I got the code spitting out syntax instead of the page. I'm yet to figure out why... If anybody has seen this before and got it working, could you share ?

    array(T_ZBX_STR, O_NO, null, NOT_EMPTY, 'isset({enter})', _('Username')), 'password' => array(T_ZBX_STR, O_OPT, null, null, 'isset({enter})'), 'sessionid' => array(T_ZBX_STR, O_OPT, null, null, null), 'reconnect' => array(T_ZBX_INT, O_OPT, P_SYS|P_ACT, BETWEEN(0, 65535), null), 'enter' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'autologin' => array(T_ZBX_INT, O_OPT, null, null, null), 'request' => array(T_ZBX_STR, O_OPT, null, null, null) ); check_fields($fields); // logout if (isset($_REQUEST['reconnect'])) { DBstart(); add_audit_details(AUDIT_ACTION_LOGOUT, AUDIT_RESOURCE_USER, CWebUser::$data['userid'], '', _('Manual Logout'), CWebUser::$data['userid'] ); DBend(true); CWebUser::logout(); redirect('index.php'); } $config = select_config(); if ($config['authentication_type'] == ZBX_AUTH_HTTP) { if (!empty($_SERVER['PHP_AUTH_USER'])) { $_REQUEST['enter'] = _('Sign in'); $_REQUEST['name'] = $_SERVER['PHP_AUTH_USER']; } else { access_deny(ACCESS_DENY_PAGE); } } // login via form if (isset($_REQUEST['enter']) && $_REQUEST['enter'] == _('Sign in')) { // try to login $autoLogin = getRequest('autologin', 0); DBstart(); $loginSuccess = CWebUser::login(getRequest('name', ''), getRequest('password', '')); DBend(true); if ($loginSuccess) { // save remember login preference $user = array('autologin' => $autoLogin); if (CWebUser::$data['autologin'] != $autoLogin) { API::User()->updateProfile($user); } $request = getRequest('request'); $url = zbx_empty($request) ? CWebUser::$data['url'] : $request; if (zbx_empty($url) || $url == $page['file']) { $url = 'dashboard.php'; } redirect($url); exit; } // login failed, fall back to a guest account else { CWebUser::checkAuthentication(null); } } else { // login the user from the session, if the session id is empty - login as a guest CWebUser::checkAuthentication(CWebUser::getSession Cookie()); } // the user is not logged in, display the login form if (!CWebUser::$data['alias'] || CWebUser::$data['alias'] == ZBX_GUEST_USER) { switch ($config['authentication_type']) { case ZBX_AUTH_HTTP: echo _('User name does not match with DB'); break; case ZBX_AUTH_LDAP: case ZBX_AUTH_INTERNAL: if (isset($_REQUEST['enter'])) { $_REQUEST['autologin'] = getRequest('autologin', 0); } if ($messages = clear_messages()) { $messages = array_pop($messages); $_REQUEST['message'] = $messages['message']; } $loginForm = new CView('general.login'); $loginForm->render(); } } else { redirect(zbx_empty(CWebUser::$data['url']) ? 'dashboard.php' : CWebUser::$data['url']); }

    Note: As I attempt to hit the site... neither zabbix-server nor mysql logs indicate that apache2 has contacted them. Have I done something wrong at apache? Thanks guys!
  • SBO
    Zabbix Certified Specialist
    Zabbix Certified Specialist
    • Sep 2015
    • 226

    #2
    It seems php is not installed on your system.
    Install php, restart apache and try again

    Comment

    • Atsushi
      Senior Member
      • Aug 2013
      • 2028

      #3
      Please tell me the version of Ubuntu you are using.

      Please check the version of Zabbix installed.
      If create.sql.gz does not exist, you may have installed another version.

      Is version 3.2.3 installed as follows?

      Code:
      $ dpkg -l zabbix-server-mysql
      Desired=Unknown/Install/Remove/Purge/Hold
      | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
      |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
      ||/ Name           Version      Architecture Description
      +++-==============-============-============-=================================
      ii  zabbix-server- 1:3.2.3-1+xe amd64        Zabbix network monitoring solutio
      $
      With the old version of Zabbix you may need to install libapache2-mod-php.

      I will introduce the procedure when I installed Zabbix 3.2.3 on Ubuntu 16.04.
      I install the following package additionally.
      snmp, php-bcmath, php-mbstring, php-xml

      Code:
      $ sudo apt-get update
      $ sudo apt-get upgrade
      $ sudo reboot
      $ sudo apt-get install mysql-server
      $ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
      $ sudo service mysql restart
      $ wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
      $ sudo dpkg -i zabbix-release_3.2-1+xenial_all.deb
      $ sudo apt-get update
      $ sudo apt-get install zabbix-agent zabbix-server-mysql zabbix-frontend-php
      $ mysql -uroot -p
      mysql> create database zabbix character set utf8 collate utf8_bin;
      mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password' ;
      mysql> exit
      $ zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uroot zabbix -p
      $ sudo vi /etc/zabbix/zabbix_server.conf
      
      set DBPassword.
      
      $ sudo vi /etc/apache2/conf-enabled/zabbix.conf
      
      enable timezone setting.
      
      $ sudo apt-get install snmp
      $ sudo apt-get install php-bcmath
      $ sudo apt-get install php-mbstring
      $ sudo apt-get install php-xml
      $ sudo service zabbix-agent start
      $ sudo service zabbix-server start
      $ sudo service apache2 restart

      Comment

      Working...