Zabbix database error unable to select configuration

Hi! I got a "Database error, Unable to select configuration" error message on the web page with zabbix-server-mysql container in docker. I see an error on the docker logs output: INFO gav...

Hi!

I got a «Database error, Unable to select configuration» error message on the web page with zabbix-server-mysql container in docker.

I see an error on the docker logs output:
INFO gave up: zabbix-server entered FATAL state, too many start retries too quickly
and I see this in the zabbix-server container when I try to start the entrypoint script manually:
cannot use database "zabbix": Zabbix server cannot work with a Zabbix proxy database

The docker logs output:

docker logs b41
2017-11-02 13:26:23,206 INFO exited: zabbix-server (exit status 1; not expected)
2017-11-02 13:26:26,211 INFO spawned: 'zabbix-server' with pid 137
2017-11-02 13:26:26,211 INFO spawned: 'zabbix-server' with pid 137
Starting Zabbix Server. Zabbix 3.4.3 (revision 73588).
Press Ctrl+C to exit.

   137:20171102:132626.218 Starting Zabbix Server. Zabbix 3.4.3 (revision 73588).
   137:20171102:132626.218 ****** Enabled features ******
   137:20171102:132626.219 SNMP monitoring:           YES
   137:20171102:132626.219 IPMI monitoring:           YES
   137:20171102:132626.219 Web monitoring:            YES
   137:20171102:132626.219 VMware monitoring:         YES
   137:20171102:132626.219 SMTP authentication:       YES
   137:20171102:132626.219 Jabber notifications:      YES
   137:20171102:132626.219 Ez Texting notifications:  YES
   137:20171102:132626.219 ODBC:                      YES
   137:20171102:132626.219 SSH2 support:              YES
   137:20171102:132626.219 IPv6 support:              YES
   137:20171102:132626.219 TLS support:               YES
   137:20171102:132626.219 ******************************
   137:20171102:132626.219 using configuration file: /etc/zabbix/zabbix_server.conf
   137:20171102:132626.221 cannot use database "zabbix": Zabbix server cannot work with a Zabbix proxy database
2017-11-02 13:26:26,222 INFO exited: zabbix-server (exit status 1; not expected)
2017-11-02 13:26:26,222 INFO exited: zabbix-server (exit status 1; not expected)
2017-11-02 13:26:27,223 INFO gave up: zabbix-server entered FATAL state, too many start retries too quickly
2017-11-02 13:26:27,223 INFO gave up: zabbix-server entered FATAL state, too many start retries too quickly

The output when I try to start Zabbix run script manually:

zabbix@b410320eeb20:/var/lib/zabbix$ zabbix_server -c /etc/zabbix/zabbix_server.conf -f
Starting Zabbix Server. Zabbix 3.4.3 (revision 73588).
Press Ctrl+C to exit.

   141:20171102:131645.862 Starting Zabbix Server. Zabbix 3.4.3 (revision 73588).
   141:20171102:131645.862 ****** Enabled features ******
   141:20171102:131645.862 SNMP monitoring:           YES
   141:20171102:131645.862 IPMI monitoring:           YES
   141:20171102:131645.862 Web monitoring:            YES
   141:20171102:131645.862 VMware monitoring:         YES
   141:20171102:131645.862 SMTP authentication:       YES
   141:20171102:131645.862 Jabber notifications:      YES
   141:20171102:131645.862 Ez Texting notifications:  YES
   141:20171102:131645.862 ODBC:                      YES
   141:20171102:131645.862 SSH2 support:              YES
   141:20171102:131645.862 IPv6 support:              YES
   141:20171102:131645.862 TLS support:               YES
   141:20171102:131645.862 ******************************
   141:20171102:131645.862 using configuration file: /etc/zabbix/zabbix_server.conf
   141:20171102:131645.864 cannot use database "zabbix": Zabbix server cannot work with a Zabbix proxy database

My docker-compose.yml file:

version: '3'

services:
  zabbix-db:
    image: mysql
    environment:
      MYSQL_ROOT_PASSWORD: "Secret1"
      MYSQL_DATABASE: "zabbix"
      MYSQL_USER: "zabbix"
      MYSQL_PASSWORD: "zabbix"
    volumes:
      - './db/:/var/lib/mysql'
      - '/etc/localtime:/etc/localtime:ro'
    restart: always
  zabbix-server:
    image: zabbix/zabbix-server-mysql:ubuntu-3.4-latest
    environment:
      DB_SERVER_HOST: "zabbix-db"
      MYSQL_DATABASE: "zabbix"
      MYSQL_USER: "zabbix"
      MYSQL_PASSWORD: "zabbix"
      ZBX_CACHESIZE: "128M"
      ZBX_VALUECACHESIZE: "128M"
    volumes:
      - './xtrafiles:/srv/xtrafiles'
      - './alertscripts:/usr/lib/zabbix/alertscripts'
      - '/etc/localtime:/etc/localtime:ro'
    depends_on:
      - zabbix-db
    ports:
      - '10051:10051'
    restart: always
  zabbix-web:
    image: zabbix/zabbix-web-nginx-mysql:ubuntu-latest
    environment:
      DB_SERVER_HOST: "zabbix-db"
      MYSQL_DATABASE: "zabbix"
      MYSQL_USER: "zabbix"
      MYSQL_PASSWORD: "zabbix"
      ZBX_SERVER_HOST: "zabbix-server"
      TZ: "Europe/Budapest"
    volumes:
      - '/etc/localtime:/etc/localtime:ro'
    ports:
      - '80:80'
      - '443:443'
    restart: always

I think this is a bug.

Maybe the base data is not imported:
https://www.zabbix.com/forum/showthread.php?t=16778

root@b410320eeb20:/var/lib/zabbix# mysql -u $MYSQL_USER --password=$MYSQL_PASSWORD -h $DB_SERVER_HOST $MYSQL_DATABASE
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 125
Server version: 5.7.20 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> select * from users;
Empty set (0.00 sec)

mysql>

I think this is a bug in the new server container.

Can You fix it?

Содержание

  1. Cannot use database «zabbix’: its «users» table is empty _is this the Zabbix proxy database?)
  2. Details
  3. Description
  4. Вопросы по разворачиванию zabbix
  5. var/log/postgresql/postgresql-9.4-main.log
  6. check presence of some data (from data.sql) or some table(s) during setup.php on step 3
  7. Details
  8. Description
  9. Attachments
  10. Issue Links
  11. ошибка при установке и настройке Zabbix

Cannot use database «zabbix’: its «users» table is empty _is this the Zabbix proxy database?)

Details

Description

Followed the documentation for Ubuntu 16.04 Install Zabbix from Package

Then under DB configuration I get
Cannot connect to the database.Details * Unable to select configuration.
**

Logs under /var/log/zabbix/zabbix_server.conf

2426:20180629:213009.110 Starting Zabbix Server. Zabbix 3.4.11 (revision 82160).
*2426:20180629:213009.110 ****** Enabled features *******
2426:20180629:213009.110 SNMP monitoring: YES
2426:20180629:213009.110 IPMI monitoring: YES
2426:20180629:213009.110 Web monitoring: YES
2426:20180629:213009.110 VMware monitoring: YES
2426:20180629:213009.110 SMTP authentication: YES
2426:20180629:213009.110 Jabber notifications: YES
2426:20180629:213009.110 Ez Texting notifications: YES
2426:20180629:213009.110 ODBC: YES
2426:20180629:213009.110 SSH2 support: YES
2426:20180629:213009.110 IPv6 support: YES
2426:20180629:213009.110 TLS support: YES
*2426:20180629:213009.110 *******************************
2426:20180629:213009.110 using configuration file: /etc/zabbix/zabbix_server.conf
2426:20180629:213009.114 cannot use database «zabbix»: its «users» table is empty (is this the Zabbix proxy database?)

Hit a wall here, and don’t know what to do next, any ideas? Thanks**

Источник

Вопросы по разворачиванию zabbix

Веб-морда ругается:
The frontend does not match Zabbix database.
Итак, вопросы.
1. zcat /usr/share/doc/zabbix-server-pgsql-3.0.*/create.sql.gz | psql zabbix
залития этих sql-скриптов достаточно? на некоторых форумах гуглится ответ про «frontend does not match», что надо выполнить to` какие то sql-скрипты по разворачиванию. странно, что в офф. руководстве этого нет, лишь create.sql.gz.
2. Option: DBSchema.Schema name. Used for IBM DB2 and PostgreSQL.
Указывать ли название БД сюда? В офф. руководстве этого тоже нет, там только
DBHost=
DBName=zabbix
DBUser=zabbix
DBPassword=
и всё, никакой DBSchema!

я блин, сначала грешил, что виновата повышенная версия, соблазнился поновее и поставил не ту, что указана в руководстве. но и с именно той версией заббикса из мануала та же фигня.

https://notessysadmin.com/peculiarity-of-zabbix-installation-in-conjunction-w.
Залить дампы в базы (от пользователя postgres):
psql -U zabbix -f /usr/share/zabbix-server-pgsql/schema.sql zabbix
psql -U zabbix -f /usr/share/zabbix-server-pgsql/images.sql zabbix
psql -U zabbix -f /usr/share/zabbix-server-pgsql/data.sql zabbix
Если не развернуть дампы в базу, то из вебморды, на шаге коннекта к postgre, будет отдавать это ошибку:
The frontend does not match Zabbix database

но, блина, этих файлов нет, где он их выковырял??

Да, достаточно. Но заливать нужно от имени пользователя, под которым и будет работать zabbix

До этого нужно создать пользователя и выдать полные права на базу zabbix

2. Option: DBSchema.Schema name. Used for IBM DB2 and PostgreSQL.

Попробуй имя пользователя там указать или просто оставить пустым

Там речь про zabbix 2.2. Не актуально. Залить нужно только create.sql

спасибо.
это сделано. сейчас не могу состыковать заббикс с постгрессом. Даже с соседней машины могу подключиться просто из консоли.

2402:20171029:173911.779 [Z3001] connection to database ‘zabbix’ failed: [0] could not connect to server: Connection refused
Is the server running on host «127.0.0.1» and accepting
TCP/IP connections on port 5432?

в /etc/zabbix/zabbix_server.conf
стоит
DBHost=127.0.0.1

до этого пробовал ставить имя машины, тоже нихрена заббикс не видел

var/log/postgresql/postgresql-9.4-main.log

2017-10-29 16:31:15 MSK [2262-1] zabbix@zabbix ВАЖНО: в pg_hba.conf нет записи для компьютера «127.0.0.1», пользователя «zabbix», базы «zabbix», SSL выкл.
2017-10-29 16:32:17 MSK [2076-2] СООБЩЕНИЕ: получен запрос на быстрое выключение
2017-10-29 16:32:17 MSK [2076-3] СООБЩЕНИЕ: прерывание всех активных транзакций
2017-10-29 16:32:17 MSK [2081-2] СООБЩЕНИЕ: процесс запуска автоочистки завершается
2017-10-29 16:32:17 MSK [2078-1] СООБЩЕНИЕ: выключение
2017-10-29 16:32:18 MSK [2078-2] СООБЩЕНИЕ: система БД выключена
2017-10-29 16:32:19 MSK [2305-1] СООБЩЕНИЕ: неверный метод проверки подлинности «127.0.0.1»
2017-10-29 16:32:19 MSK [2305-2] КОНТЕКСТ: строка 88 файла конфигурации «/etc/postgresql/9.4/main/pg_hba.conf»
2017-10-29 16:32:19 MSK [2305-3] ВАЖНО: не удалось загрузить pg_hba.conf

Is the server running on host «127.0.0.1» and accepting

TCP/IP connections on port 5432?

И на всякий случай убедись, что в pg_hba.conf для связки «локальный хост» + «БД zabbix» + «login zabbix» нет peer или ident, только md5

На всякий случай уточню. Ты понимаешь, что у сервера свой конфиг, а у веб-морды свой конфиг?

Если у тебя ошибка подключения в веб-морде, нет смысла ковырять конфиг сервера

это поборол.
с DBSchema=zabbix пишет такое
[Z3005] query failed: [0] PGRES_FATAL_ERROR:ОШИБКА: отношение «users» не существует
LINE 1: select userid from users limit 1
^
[select userid from users limit 1]
3242:20171029:220406.075 cannot use database «zabbix»: database is not a Zabbix database

закомментировал взад DBSchema=zabbix
using configuration file: /etc/zabbix/zabbix_server.conf
3374:20171029:220630.323 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ОШИБКА: нет доступа к отношению users
[select userid from users limit 1]
3374:20171029:220630.323 cannot use database «zabbix»: database is not a Zabbix database

Если у тебя ошибка подключения в веб-морде, нет смысла ковырять конфиг сервера

пока что я забил на веб-морду и отслеживаю по логам чисто сам заббикс, чтобы сначала он запустился

Дропни базу и создай заново

У пользователя полный права на новую базу

create.sql заливай от имени пользователя

Посмотрел на один из своих инстансов zabbix ( debian, postgres ) — DBScheme не указан

Потом через psql подключись к БД zabbix под учёткой zabbix и выполни команду

на выходе должен быть список таблиц в базе

Кстати, ты уверен что заливаешь в базу sql от той же самой версии zabbix?

Кстати, ты уверен что заливаешь в базу sql от той же самой версии zabbix?

ну. не уверен.
после «alter table users owner to zabbix;»

Cannot upgrade database: the database must correspond to version 2.0 or later.

create.sql заливай от имени пользователя

создать пользователя zabbix в постгресе и от него уже залить?

А где ты взял этот скрипт?

создать пользователя zabbix в постгресе и от него уже залить?

Даже в инструкции это есть. Хотя инструкция какая-то бестолковая — база создаётся без владельца. Надо как-то так:

да, инструкция бестолковая, особенно для новичков.
зато я научился, как надо правильно. сейчас ещё потрахал pg_hba.conf
local all zabbix password
зато создалась база от юзера-заббикса.
премного благодарен за помощь, с меня пиво.

лучше local all zabbix md5

да? вроде я так пробовал, заббикс так не хотел подключаться. то есть постгресс сругнулся на неверный тип авторизации, насколько я помню логи.

Источник

check presence of some data (from data.sql) or some table(s) during setup.php on step 3

Details

Description

If an user will create zabbix DB without filling it by schema and will successfully perform the GUI setup, he will see a non friendly error text at the login page:
mysql_free_result() expects parameter 1 to be resource, boolean given [include/db.inc.php:561]

This error visible ONLY if a table «users» doesn’t exist.
If the table «users» exists, we will see nice warning text: «Unable to select configuration.» above the username input field.
And it still not very informative.

Would be great to check on step 3 is the DB created correctly and filled by data.
The check could be simple — presence of «users» table or more complex: at least one row in the «config» table.

Attachments

Issue Links

ZBX-5083 New install frontend error: mysql_free_result() expects parameter 1 to be resource, boolean given [include/db.inc.php:561]

  • Closed
    The issue is considered finished, the resolution is correct. Issues which are closed can be reopened. «>Closed

ZBX-5093 Warning about pg_free_result() right after setup

  • Closed
    The issue is considered finished, the resolution is correct. Issues which are closed can be reopened. «>Closed

ZBX-6713 Ugly login screen after problems in DB

  • Closed
    The issue is considered finished, the resolution is correct. Issues which are closed can be reopened. «>Closed

Источник

ошибка при установке и настройке Zabbix

16.4 Тыс. Просмотры

добрый день,
по статье «Установка и настройка Zabbix 4.0» по статье, столкнулся с проблемой проверки логов cat /var/log/zabbix/zabbix_server.log
получают ответ
1710:20190920:163530.988 *** Enabled features
1710:20190920:163530.988 SNMP monitoring: YES
1710:20190920:163530.988 IPMI monitoring: YES
1710:20190920:163530.988 Web monitoring: YES
1710:20190920:163530.988 VMware monitoring: YES
1710:20190920:163530.988 SMTP authentication: YES
1710:20190920:163530.988 Jabber notifications: YES
1710:20190920:163530.988 Ez Texting notifications: YES
1710:20190920:163530.988 ODBC: YES
1710:20190920:163530.988 SSH2 support: YES
1710:20190920:163530.988 IPv6 support: YES
1710:20190920:163530.989 TLS support: YES
1710:20190920:163530.989 ***************************
1710:20190920:163530.989 using configuration file: /etc/zabbix/zabbix_server.conf
1710:20190920:163530.994 cannot use database «zabbix»: its «users» table is empty (is this the Zabbix proxy database?)
помогите пожалуйста, бьюсь уже третий день, в centos я новичок

Понимаю что прошло много времени, может кому-то поможет моё решение проблемы. База данных у вас скорей всего не загрузилась этой командой:

Понимаю что прошло много времени, может кому-то поможет моё решение проблемы. База данных у вас скорей всего не загрузилась этой командой:

Не нашёл как редактировать своё сообщение, да и времени пока нет. Базу данных zabbix в mysql удаляю и создаю utf8, т.к. Zabbix не поддерживает такую кодировку.

У вас, судя по всему, не создались таблицы в базе данных. В статье это выполняется командой:

Убедитесь, что она корректно отработала.

запрос пароля, ввел, ошибок нет.

снова логи и те же ошибки

У меня вопрос по теме! После ввода

И ввода пароля ничего не происходит вообще, я ждал 30 минут. В чем дело может быть ?

Команды # mysql -uzabbix -p zabbix

mysql> select * from users;

Выводят: Empty set (0.00 sec)

Проверьте, что у вас реально в базе в таблице users.

# mysql -uzabbix -p zabbix

mysql> select * from users;

Должны увидеть двух пользователей — Admin и guest. Если это не так, значит база у вас либо не создана, либо создана с ошибками.

MariaDB [zabbix]> select * from users
->

внятного ответа я не вижу.

что случилось с бд при создании? подскажите как исправить, пожалуйста

Такае же ошиба. Но при выполнении скрипта zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

ERROR 1118 (42000) at line 1278: Row size too large (> 8126). Changing some colu mns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is s tored inline.

Добавил сюда /etc/my.cnf.d/server.cnf

drop database zabbix;

после создал заново базу

grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabpassword’;

После этого выполнил скрипт

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

Прошло без ошибок

Запускаю забикс смотрю логи и там новые ошибки

Источник

This is as far as I can get. Cannot connect to the MYSQL database Ubuntu. I start to configure the zabbix server, the screen Configure the DB connection . After a few minutes, you should be able to see both computers by . I will install and configure the work of the zabbix server on nginx, which. Select the host ( zabbix server) and click “Disabled . During the package installation I selected the automatic database. Choose a strong passwor repeat it and wait for the installation to finish . Put it on your map and choose a fancy symbol, like WordPress Logo or.

Zabbix repository to our server. The web frontend has a wizard that helps you to configure its basics. If the connection fails completely, make sure Apache is started up and there is no. Use below link to read more about zabbix configuration. High performance, high capacity able to monitor hundreds of thousands of devices.

Open the configuration file of PHP and change your location. Selecting previously unselected package . Our tutorial will teach. Today, Windows is not able to open TAR. On the dashboard screen, access the Configuration menu and select the Host option. Merci aussi a tous pour . Unable to select configuration.

You can choose any name for the database in place of fosslinuxzabbix in the below command:. If you see any parameter failing , you have to modify it and refresh the page. If the names do not match, the data cannot be delivered! In the first tab, specify hostname, select one of the existing groups or create new group.

Unmet demands Showing when the network was unable to meet the. Go to Configuration Hosts and select the FileMaker Server host that was created. Templates” page, or through . PHP option post_max_size 8M 16M Fail PHP option max_execution_time 30 . You are not able to choose some of the languages, because locales . Browse your file system and select the OVA file of RealOpInsight. In you setup host group-based dashboards, you will be able to have Executive Dashboards . No sure if this a bug but I am unable to acknowledge some old triggers.

Click Add Integration and select the integration that you would like to add. SELinux Configuration Change. Event source“, select Auto-Registration. CentOSにログインしたら、続いて zabbix を起動する作業をします。. Data and select the host (that you have configured) in the filter section:.

To be able to connect to database we would need one to be running first.

Пожалуйста, войдите или зарегистрируйтесь.

Считаете, что Ubuntu недостаточно дружелюбна к новичкам?
Помогите создать новое Руководство для новичков!

  • Форум русскоязычного сообщества Ubuntu »
  • Поддержка »
  • Linux в организациях (Модератор: graddata) »
  • Zabbix на Ubuntu

« предыдущая тема следующая тема »

  • Печать

Страницы: [1]   Вниз


Автор
Тема: Zabbix на Ubuntu  (Прочитано 2520 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
dimasшл225

  • Автор темы
  • Новичок
  • *
  • Сообщений: 2
    • Просмотр профиля

Zabbix на Ubuntu

« : 27 Апреля 2022, 10:06:13 »

Проблема при подключении к БД, работаю с Ubuntu и Zabbix впервые
Не возможно подключиться к базе данных.
Не удалось выбрать конфигурацию.


Оффлайн
bezbo

  • Старожил
  • *
  • Сообщений: 1646
    • Просмотр профиля

Re: Zabbix на Ubuntu

« Ответ #1 : 27 Апреля 2022, 19:39:54 »

У Zabbix хорошая документация: как установить и руководство


Оффлайн
dimasшл225

  • Автор темы
  • Новичок
  • *
  • Сообщений: 2
    • Просмотр профиля

Re: Zabbix на Ubuntu

« Ответ #2 : 28 Апреля 2022, 09:11:21 »

Я уже все инструкции испробовал какие только нашел


Оффлайн
БТР

  • Заслуженный пользователь
  • СуперМодератор
  • Старожил
  • *
  • Сообщений: 5915
    • Просмотр профиля

Re: Zabbix на Ubuntu

« Ответ #3 : 28 Апреля 2022, 09:45:28 »

dimasшл225, не надо пробовать все. Выполните по пунктам с официального сайта. Если возникнут ошибки — фиксируйте и сообщайте.


  • Печать

Страницы: [1]   Вверх

« предыдущая тема следующая тема »

  • Форум русскоязычного сообщества Ubuntu »
  • Поддержка »
  • Linux в организациях (Модератор: graddata) »
  • Zabbix на Ubuntu

XHTML
RSS
Мобильная версия

SMF 2.0.19 |
SMF © 2011, Simple Machines | Карта форума

Страница сгенерирована за 0.044 секунд. Запросов: 25.

Are you looking for a solution to “zabbix cannot connect to the database” error ? Here’s how we fix it.

Zabbix is a monitoring software tool. When using zabbix we may encounter many errors like zabbix cannot connect to the database. This may occur due to incorrect database details.

At Bobcares, we often get requests from our customers to fix ‘zabbix cannot connect to the database’ as part of our Server Management Services.

Today, we’ll see the reasons and how our Support Engineers fix this error.

Causes for ‘Zabbix cannot connect to the database’ Error

At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems while managing Zabbix.

Now, let’s see the major reasons for this Zabbix error to occur and we’ll also see how our Support Engineers fix this zabbix database cannot connect error.

Incorrect Database details

Recently one of our customers approached us with the same zabbix problem. He said he was getting an error in his zabbix dashboard like the one shown below in the screenshot.

zabbix cannot connect to database

When we checked in detail, our Support Engineers found that there is mismatch in the details given in database with those in zabbix_server configuration file.

We found that the DBName given in database was not the same as the one given in zabbix configuration file. So, we changed it to the right one. Finally, this fixed the error.

We also Checked and confirmed whether all other values entered were right.

Incorrect DBsocket

We got another request from some other customer. However, the error was similar. Here is the error message our customer was receiving.

[ZXXX] connection to database 'Databasename' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql'

We checked and found that the socket given in mysql configuration file is different from the one specified in the configuration file for zabbix. In mysql configuration DBSocket value was  /var/run/mysql/mysql.sock and in zabbix_server configuration it was  DBSocket=/var/run/mysql. So, we made the following corrections in zabbix configuration file:

XXXX:/usr/share/zabbix # cat /etc/zabbix/zabbix-server.conf
LogFile=/var/log/zabbix/zabbix-server.log
PidFile=/var/run/zabbix/zabbix-server.pid
DBName=*****
DBUser=*****
DBPassword=*************
DBSocket=/var/run/mysql/mysql.sock

And this fixed the problem.

[Need any further assistance in fixing zabbix errors? – We’ll help you]

Conclusion

In short, ‘Zabbix cannot connect to the database’ error may occur due to some reasons like wrong database details or when there is any mismatch in configuration file values, etc. Today, we saw how our Support Engineers fix this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Модераторы: GRooVE, alexco

Правила форума
Убедительная просьба юзать теги [code] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.

tomek

рядовой
Сообщения: 26
Зарегистрирован: 2010-07-20 13:07:23

Zabbix ошибка MySQL

Добрый день!
Прошу помощи, в решение возникшей проблемой:

Есть сервер FreeBSD на нем крутится Zabbix с сопутствующими Mysql и APache, все работает. Решено сделать клон сервера, делалось по мануалу:
http://www.probsd.org.ua/net/%D0%BA%D0% … D0%BE-ssh/

Почти все запустилось и заработало кроме одного: При заходе на Zabbix с веб-интерфейса выходит ошибка:

Код: Выделить всё

 mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)[/usr/local/www/zabbix/include/db.inc.php:58] 

Конфигурация Mysql по-умолчанию, ничего не изменял конфигурационных файлов для него не создавал. Сам Mysql запущен в процессах, /tmp/mysql.sock присутствует.

Заранее спасибо.


Хостинговая компания Host-Food.ru

Хостинг HostFood.ru

 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/


Аватара пользователя

dmtr

ст. прапорщик
Сообщения: 545
Зарегистрирован: 2009-11-06 22:01:34
Откуда: с Ростова

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

dmtr » 2011-11-02 15:12:02

This game has no name. It will never be the same.


tomek

рядовой
Сообщения: 26
Зарегистрирован: 2010-07-20 13:07:23

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

tomek » 2011-11-02 15:45:22

К сожалению не помогло, кстати mysql.sock то появляется то пропадает…

При 1ой сессии захода на веб интерфейс валятся след ошибки:

Код: Выделить всё

Error in query [UPDATE sessions SET lastaccess=1320237842 WHERE sessionid='f81434edd9a638541e3a6489d68524a9'] [Lost connection to MySQL server during query]
Error in query [DELETE FROM sessions WHERE userid=2 AND status=0 AND lastaccess<1320236942] [MySQL server has gone away]
Error in query [SELECT g.usrgrpid FROM usrgrp g, users_groups ug WHERE ug.userid = 2 AND g.usrgrpid = ug.usrgrpid AND g.debug_mode = 1 LIMIT 1 OFFSET 0] [MySQL server has gone away]
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:544]
mysql_free_result() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:546]
Error in query [SELECT * FROM config WHERE ((configid BETWEEN 000000000000000 AND 099999999999999))] [MySQL server has gone away]
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:544]
mysql_free_result() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:546]
Unable to select configuration
Error in query [SELECT * FROM profiles WHERE userid=2 AND ((profileid BETWEEN 000000000000000 AND 099999999999999)) ORDER BY userid ASC, profileid ASC] [MySQL server has gone away]
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:544]
mysql_free_result() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:546]
Error in query [SELECT * FROM config WHERE ((configid BETWEEN 000000000000000 AND 099999999999999))] [MySQL server has gone away]
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:544]
mysql_free_result() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:546]
Unable to select configuration
Error in query [SELECT * FROM config WHERE ((configid BETWEEN 000000000000000 AND 099999999999999))] [MySQL server has gone away]
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:544]
mysql_free_result() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:546]
Unable to select configuration
Undefined variable: css[/usr/local/www/zabbix/include/users.inc.php:29]
Error in query [SELECT * FROM config WHERE ((configid BETWEEN 000000000000000 AND 099999999999999))] [MySQL server has gone away]
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:544]
mysql_free_result() expects parameter 1 to be resource, boolean given[/usr/local/www/zabbix/include/db.inc.php:546]
Unable to select configuration

После повторных заходов только ошибка из 1го поста.


Аватара пользователя

dmtr

ст. прапорщик
Сообщения: 545
Зарегистрирован: 2009-11-06 22:01:34
Откуда: с Ростова

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

dmtr » 2011-11-02 15:47:08

mysql перезапускали после выставления прав на /tmp?

This game has no name. It will never be the same.


tomek

рядовой
Сообщения: 26
Зарегистрирован: 2010-07-20 13:07:23

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

tomek » 2011-11-02 15:49:55

Да, и перезапускал и сервер полностью ребутал:

Код: Выделить всё

drwxrwxrwt  2 root    wheel         512 Nov  2 15:39 .ICE-unix
drwxrwxrwt  2 root    wheel         512 Nov  2 15:39 .X11-unix
drwxrwxrwt  2 root    wheel         512 Nov  2 15:39 .XIM-unix
drwxrwxrwt  2 root    wheel         512 Nov  2 15:39 .font-unix
drwxrwxr-x  2 root    operator      512 Nov  2 13:58 .snap
-rw-r--r--  1 root    wheel      949822 Feb 14  2011 1.txt
-rw-r--r--  1 root    wheel           0 Mar  4  2011 10.18.10.22.txt
-rw-r--r--  1 root    wheel     1729613 Feb 15  2011 2.txt
-rw-r--r--  1 root    wheel       16384 Mar  4  2011 2940-8pc.txt
-rw-r--r--  1 root    wheel      475152 Feb 16  2011 3.txt
-rw-r--r--  1 root    wheel      107257 Mar  4  2011 3560-8pc.txt
-rw-r--r--  1 root    wheel           0 Mar  4  2011 3560.txt
-rw-r--r--  1 root    wheel       82147 Mar  5  2011 3560buhg.txt
-rw-r--r--  1 root    wheel      722454 Feb 16  2011 4.txt
-rw-r--r--  1 root    wheel      461809 Feb 16  2011 5.txt
-rw-r--r--  1 root    wheel      617530 Feb 16  2011 6.txt
-rw-r--r--  1 root    wheel      613818 Mar  1  2011 IDF3.txt
-rw-r--r--  1 root    wheel      605726 Mar  4  2011 IDF3test.txt
-rw-r--r--  1 root    wheel      329682 Mar  4  2011 IDF4.txt
-rw-r--r--  1 root    wheel      320949 Mar  4  2011 IDF5.txt
-rw-r--r--  1 root    wheel      288492 Mar  5  2011 IDF6_1.txt
srwxrwxrwx  1 mysql   wheel           0 Nov  2 15:49 mysql.sock
-rw-------  1 root    wheel       61880 Nov  2 16:00 restoresymtable
-rw-------  1 root    wheel           0 Mar 22  2011 vi.68kihGTgXq
-rw-------  1 root    wheel           0 May 13 12:07 vi.9QaT6VRHjA
-rw-------  1 root    wheel           0 May 16 15:01 vi.j4Ref0ET0D
-rw-------  1 root    wheel           0 Jan 12  2011 vi.nWwifUF1cD
-rw-------  1 root    wheel           0 Mar 21  2011 vi.rcl8yMFmlQ
-rw-rw-r--  1 zabbix  wheel       10197 Nov  2 15:39 zabbix_agentd.log
-rw-rw-r--  1 zabbix  wheel           3 Nov  2 15:39 zabbix_agentd.pid
-rw-rw-r--  1 zabbix  wheel      681123 Nov  2 15:49 zabbix_server.log
-rw-rw-r--  1 zabbix  wheel     1048604 Nov  2 10:56 zabbix_server.log.old
-rw-rw-r--  1 zabbix  wheel           3 Nov  2 15:39 zabbix_server.pid
-rw-rw-r--  1 zabbix  wheel          48 Mar 21  2011 zabbix_server_1026.pinger
-rw-rw-r--  1 zabbix  wheel          71 Nov  2 13:58 zabbix_server_1071.pinger
-rw-rw-r--  1 zabbix  wheel          83 Oct  7 17:08 zabbix_server_1084.pinger
-rw-rw-r--  1 zabbix  wheel          94 Sep 21 16:20 zabbix_server_1086.pinger
-rw-rw-r--  1 zabbix  wheel          57 Sep 21 09:09 zabbix_server_1090.pinger
-rw-rw-r--  1 zabbix  wheel          80 Sep 21 09:29 zabbix_server_1114.pinger

Код: Выделить всё

lrwxr-xr-x   1 root  wheel       11 Jul 19  2010 sys -> usr/src/sys
drwxrwxrwt   7 root  wheel     1536 Nov  2 16:50 tmp


Аватара пользователя

dmtr

ст. прапорщик
Сообщения: 545
Зарегистрирован: 2009-11-06 22:01:34
Откуда: с Ростова

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

dmtr » 2011-11-02 15:54:56

а руками удается подключиться к мускулю с логин-паролем заббикса?

This game has no name. It will never be the same.


tomek

рядовой
Сообщения: 26
Зарегистрирован: 2010-07-20 13:07:23

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

tomek » 2011-11-02 16:07:08

C помощью комманды:

Код: Выделить всё

mysql -u root -p 
Password: Пароль указанный в Zabbix-server.conf

Пустило

Код: Выделить всё

zabbix# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.1.54 FreeBSD port: mysql-server-5.1.54_1

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>
mysql>


Аватара пользователя

dmtr

ст. прапорщик
Сообщения: 545
Зарегистрирован: 2009-11-06 22:01:34
Откуда: с Ростова

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

dmtr » 2011-11-02 16:13:07

а пользователя для заббикса не создавали? он под рутом с мускулем на старом сервере работает?

This game has no name. It will never be the same.


tomek

рядовой
Сообщения: 26
Зарегистрирован: 2010-07-20 13:07:23

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

tomek » 2011-11-02 17:05:55

Пользователь zabbix есть, но именно с мускулом работает под рутом. Конфигурация на старом сервере идиентична:

Код: Выделить всё

zabbix# cat /etc/passwd
# $FreeBSD: src/etc/master.passwd,v 1.40.22.1.4.1 2010/06/14 02:09:06 kensmith Exp $
#
root:*:0:0:Charlie &:/root:/bin/csh
toor:*:0:0:Bourne-again Superuser:/root:
daemon:*:1:1:Owner of many system processes:/root:/usr/sbin/nologin
operator:*:2:5:System &:/:/usr/sbin/nologin
bin:*:3:7:Binaries Commands and Source:/:/usr/sbin/nologin
tty:*:4:65533:Tty Sandbox:/:/usr/sbin/nologin
kmem:*:5:65533:KMem Sandbox:/:/usr/sbin/nologin
games:*:7:13:Games pseudo-user:/usr/games:/usr/sbin/nologin
news:*:8:8:News Subsystem:/:/usr/sbin/nologin
man:*:9:9:Mister Man Pages:/usr/share/man:/usr/sbin/nologin
sshd:*:22:22:Secure Shell Daemon:/var/empty:/usr/sbin/nologin
smmsp:*:25:25:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin
mailnull:*:26:26:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin
bind:*:53:53:Bind Sandbox:/:/usr/sbin/nologin
proxy:*:62:62:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin
_pflogd:*:64:64:pflogd privsep user:/var/empty:/usr/sbin/nologin
_dhcp:*:65:65:dhcp programs:/var/empty:/usr/sbin/nologin
uucp:*:66:66:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico
pop:*:68:6:Post Office Owner:/nonexistent:/usr/sbin/nologin
www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin
admin:*:1001:1001:User &:home/admin:/bin/tcsh
mysql:*:88:88:MySQL Daemon:/var/db/mysql:/usr/sbin/nologin
zabbix:*:122:122:Zabbix NMS:/nonexistent:/usr/sbin/nologin
tftpd:*:1002:1002:tftp_manager:/nonexisten:/usr/sbin/nologin
smsd:*:151:151:SMS Gate worker:/nonexistent:/sbin/nologin

Часть конфига касательно мускула в zabbix-server.conf

Код: Выделить всё

## Option: DBHost
#       Database host name.
#       If set to localhost, socket is used for MySQL.
#
# Mandatory: no
# Default:
 DBHost=localhost

### Option: DBName
#       Database name.
#       For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
#
# Mandatory: yes
# Default:
# DBName=

DBName= zabbix

### Option: DBUser
#       Database user. Ignored for SQLite.
#
# Mandatory: no
# Default:
# DBUser=

DBUser= root

### Option: DBPassword
#       Database password. Ignored for SQLite.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword= Пароль


Аватара пользователя

dmtr

ст. прапорщик
Сообщения: 545
Зарегистрирован: 2009-11-06 22:01:34
Откуда: с Ростова

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

dmtr » 2011-11-02 17:20:17

zabbix-server.conf это классно, а что в конфиге веб-интерфейса?

This game has no name. It will never be the same.


tomek

рядовой
Сообщения: 26
Зарегистрирован: 2010-07-20 13:07:23

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

tomek » 2011-11-03 7:00:16

Тоже самое *(

Код: Выделить всё


global $DB;

$DB["TYPE"]             = 'MYSQL';
$DB["SERVER"]           = 'localhost';
$DB["PORT"]             = '0';
$DB["DATABASE"]         = 'zabbix';
$DB["USER"]             = 'root';
$DB["PASSWORD"]         = 'Пароль';
$ZBX_SERVER             = 'localhost';
$ZBX_SERVER_PORT        = '10051';
$ZBX_SERVER_NAME        = '';

$IMAGE_FORMAT_DEFAULT   = IMAGE_FORMAT_PNG;
?>


Аватара пользователя

Mox

лейтенант
Сообщения: 757
Зарегистрирован: 2008-12-16 16:04:14
Откуда: питер
Контактная информация:

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

Mox » 2011-11-03 9:39:05

а в лог mysql случайно ничего не сыпется?

«В мире программирования алгоритмы становятся более важными, чем код, и именно из-за академических корней в BSD изначально большое внимание уделялось проработке алгоритмов». Мэтт Диллон


tomek

рядовой
Сообщения: 26
Зарегистрирован: 2010-07-20 13:07:23

Re: Zabbix ошибка MySQL

Непрочитанное сообщение

tomek » 2011-11-08 7:12:13

В логах Mysql ничего заметно плохого нету… Но это явно mysql, в процессах (top), он постоянно то появляется то пропадает, тоже самое и с /tmp/mysql.sock

var/log/mysql.log

Код: Выделить всё

/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument


Понравилась статья? Поделить с друзьями:

Читайте также:

  • Zabbix database error connection refused centos
  • Zabbix configure error mysql library not found
  • Zabbix configuration file error permission denied
  • Zabbix appliance database error
  • Zabbix an authentication function returned an error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии