[ZBX-13144] Using special sqlite3 memory destination in parameter 'DBName=:memory:' in zabbix_proxy.conf for zabbix-proxy-sqlite3_3.0.2 does not load a usable database or start correctly Created: 2017 Dec 06  Updated: 2024 Dec 02  Resolved: 2018 Jan 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D)
Affects Version/s: None
Fix Version/s: 4.0 (plan)

Type: Problem report Priority: Minor
Reporter: Kenny Hibberd Assignee: Natalja Cernohajeva (Inactive)
Resolution: Fixed Votes: 0
Labels: performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tested on Raspberry Pi with Raspbian


Attachments: Text File zabbix_proxy.log    
Team: Team B
Sprint: Sprint 24, Sprint 25, Sprint 26
Story Points: 0

 Description   

zabbix-proxy version 3.0.2

Steps to reproduce:
Change configuration file zabbix_proxy.conf parameter:
DBName=:memory:

Result:
See log file...

More documentation about using the ":memory:" destination can be found here: https://www.sqlite.org/inmemorydb.html



 Comments   
Comment by Alexey Pustovalov [ 2017 Dec 06 ]

Zabbix does not support in memory destination. It is not implemented.

Comment by Kenny Hibberd [ 2017 Dec 06 ]

If that is true, can we add that to the documentation until it is? I would like to help contribute to the zabbix documentation, if I can.

Comment by Alexey Pustovalov [ 2017 Dec 06 ]

Kenny,

DBName=:memory: is non multi processes database. it is only per one process. Have you tried to specify DBName=file:memdb1?mode=memory&cache=shared?

Comment by Kenny Hibberd [ 2017 Dec 06 ]

No, I haven't tried that. I will try now.

Comment by Kenny Hibberd [ 2017 Dec 06 ]

5438:20171206:055509.346 cannot open database file "file:memdb1?mode=memory&cache=shared": [2] No such file or directory
5438:20171206:055509.346 creating database ...
5438:20171206:055509.364 [Z3002] cannot create database 'file:memdb1?mode=memory&cache=shared': [0] unable to open database file

Comment by Glebs Ivanovskis (Inactive) [ 2017 Dec 06 ]

The problem with :memory: is that database ceases to exist when connection is closed and Zabbix main process does exactly that after importing schema. If you pass file::memory:?cache=shared as DBName created database will outlive the connection. There is no real need in file:memdb1?mode=memory&cache=shared because Zabbix does not need multiple distinguishable databases. But, and this is a huge "but":

all database connections sharing the in-memory database need to be in the same process

which is not applicable to Zabbix at the moment. To my understanding after forking each forked process will have a completely independent database. However, there is a very limited use case when this setup may be functioning — passive proxy with StartTrappers=1 monitoring only trapper items and active agents. Not sure that you will gain any performance from it.

Comment by Kenny Hibberd [ 2017 Dec 06 ]

Ok, tmpfs it is! Thanks for your help, and your ability to help me understand the issue!

Comment by Glebs Ivanovskis (Inactive) [ 2017 Dec 06 ]

Thank you! It was an interesting issue to investigate. Let's document it!

Comment by Natalja Cernohajeva (Inactive) [ 2018 Jan 03 ]

Necessary documentation update has been executed in cooperation with glebs.ivanovskis for all supported versions (Zabbix proxy parameter table) DBName parameter description update.

Dear glebs.ivanovskis , please review and close if it's ok.

RESOLVED

glebs.ivanovskis Technically, in 3.0 SQLite can be used as server's database too. Should we update server's config parameters? Or shall we remove SQLite mention from there as not recommended?

natalja.cernohajeva: fixed for 3.0 Zabbix server parameters. Please review.
RESOLVED

glebs.ivanovskis Good.
CLOSED

Comment by Faustin [ 2021 Oct 05 ]

Hi!
Just for the record, I was having problem on a very old Raspberry PI 1. Writing to the Sqlite3 DB was not fast enough.

So I used tmpfs to store the DB:

$ grep tmpfs /etc/fstab
tmpfs   /var/lib/sqlite-ram/	tmpfs   rw,nodev,nosuid,uid=zabbix,gid=zabbix,size=50M          0  0
$ grep DBName /etc/zabbix/zabbix_proxy.conf | grep -v ^#
DBName=/var/lib/sqlite-ram/zabbix.db

Et voilĂ , the proxy is now working and perfectly sufficient for this particular setup (monitoring himself + a bunch of ping on wireless AP).
Cheers

Comment by LivreAcesso.Pro [ 2024 Dec 02 ]

My contribution:

DBName=/run/zabbix/zabbix_proxy.db
Generated at Thu Apr 24 07:03:58 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.