Ad Widget

Collapse

[Z3001] connection to database failed, unable to open database file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BalcaenJF
    Junior Member
    • Jun 2024
    • 1

    #1

    [Z3001] connection to database failed, unable to open database file

    Hello,
    I have installed AlmaLinux 9.4 and then ran the following commands, but I still get this error message.
    The previous installations done with the same methods worked fine before.
    Can you help me?

    Install AlmaLinux 9.4

    dnf -y update
    dnf -y upgrade
    dnf makecache --refresh
    dnf -y install sqlite
    rpm -Uvh https://repo.zabbix.com/zabbix/6.4/r...el9.noarch.rpm
    dnf -y update
    dnf clean all
    dnf -y install zabbix-proxy-sqlite3 zabbix-selinux-policy
    cd /etc/zabbix/
    nano zabbix_proxy.conf
    systemctl start zabbix-proxy.service
    tail /var/log/zabbix/zabbix_proxy.log
    setenforce 0
    systemctl restart zabbix-proxy.service
    tail /var/log/zabbix/zabbix_proxy.log

    [root@SRV-ZABBIX zabbix]# tail /var/log/zabbix/zabbix_proxy.log
    74269:20240628:100710.585 Web monitoring: YES
    74269:20240628:100710.585 VMware monitoring: YES
    74269:20240628:100710.585 ODBC: YES
    74269:20240628:100710.585 SSH support: YES
    74269:20240628:100710.585 IPv6 support: YES
    74269:20240628:100710.585 TLS support: YES
    74269:20240628:100710.585 **************************
    74269:20240628:100710.585 using configuration file: /etc/zabbix/zabbix_proxy.conf
    74269:20240628:100710.585 [Z3001] connection to database '/tmp/zabbix_proxy' failed: [0] unable to open database file
    74269:20240628:100710.585 database is down: reconnecting in 10 seconds

    [root@SRV-ZABBIX zabbix]# rpm -qa |grep zabbix
    zabbix-release-6.4-1.el9.noarch
    zabbix-proxy-sqlite3-6.4.16-release1.el9.x86_64
    zabbix-selinux-policy-6.4.16-release1.el9.x86_64

    [root@SRV-ZABBIX tmp]# rpm -qa | grep sqlite
    sqlite-libs-3.34.1-7.el9_3.x86_64
    sqlite-3.34.1-7.el9_3.x86_64
    zabbix-proxy-sqlite3-6.4.16-release1.el9.x86_64

    [root@SRV-ZABBIX tmp]# cat /etc/redhat-release
    AlmaLinux release 9.4 (Seafoam Ocelot)

    cat /etc/zabbix/zabbix_proxy.conf
    Server=supervision.xxx.xx
    Hostname=Zabbix_xxx
    LogFile=/var/log/zabbix/zabbix_proxy.log
    LogFileSize=0
    DebugLevel=5
    PidFile=/run/zabbix/zabbix_proxy.pid
    SocketDir=/run/zabbix
    DBName=/tmp/zabbix_proxy
    DBUser=zabbix
    SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
    Timeout=4
    LogSlowQueries=3000
    StatsAllowedIP=127.0.0.1
    TLSConnect=psk
    TLSAccept=psk
    TLSPSKIdentity=xxx
    TLSPSKFile=/etc/zabbix/key.psk
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    The installation documentation for the proxy documents that you have to create the database: https://www.zabbix.com/documentation...ating-database

    I don't see anywhere in your steps where you've done that creation step.

    Comment

    • Hamardaban
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • May 2019
      • 2713

      #3
      When using an sqlite database for a proxy, it is enough to point only to the database file (DBName=/var/db/zabbix_proxy.db) and no need DBUser.
      You don't need to do anything else. The main thing is that the zabbix_proxy service user has write rights to this directory
      The zabbix_proxy itself will create a database file with the desired structure at startup.

      12134:20240306:163904.126 Starting Zabbix Proxy (active) [SAM]. Zabbix 6.4.11 (revision fb6439a26e3).
      12134:20240306:163904.126 **** Enabled features ****
      12134:20240306:163904.126 SNMP monitoring: YES
      12134:20240306:163904.126 IPMI monitoring: YES
      12134:20240306:163904.126 Web monitoring: YES
      12134:20240306:163904.126 VMware monitoring: YES
      12134:20240306:163904.126 ODBC: YES
      12134:20240306:163904.126 SSH support: YES
      12134:20240306:163904.126 IPv6 support: NO
      12134:20240306:163904.127 TLS support: YES
      12134:20240306:163904.127 **************************
      12134:20240306:163904.127 using configuration file: /usr/local/etc/zabbix64/zabbix_proxy.conf
      12134:20240306:163904.127 cannot open database file "/var/db/sqlite/zabbix_proxy.db": [2] No such file or directory
      12134:20240306:163904.128 creating database ...
      12134:20240306:163905.664 current database version (mandatory/optional): 06040000/06040026
      12134:20240306:163905.664 required mandatory version: 06040000
      12134:20240306:163905.681 proxy #0 started [main process]
      Last edited by Hamardaban; 02-07-2024, 09:48.

      Comment


      • tim.mooney
        tim.mooney commented
        Editing a comment
        Oh interesting, I didn't realize that the proxy with SQLite worked that way. Thanks for the correction Hamardaban! I appreciate it.
    • Lone Wolf
      Member
      • Mar 2010
      • 34

      #4
      Zabbix proxy 6.4.16 is buggy. It doesn't create SQLite database. Downgrade to 6.4.15.

      Comment

      • NgRox
        Member
        • Jun 2022
        • 44

        #5
        dnf install sqlite zabbix-sql-scripts -y
        sqlite3 /var/lib/zabbix/proxy.db < /usr/share/zabbix-sql-scripts/sqlite3/proxy.sql

        Change parameter DBNAME in configuration file to /var/lib/zabbix/proxy.db

        Comment

        Working...