A
A
Alexander2012-12-14 13:45:27
SQL
Alexander, 2012-12-14 13:45:27

Open sqlite3 DB read-only?

Good afternoon.
I'll tell you a little background ...
There is software - Eaton Intelligent Power® Protector, installed on Linux servers to which UPS is connected.
The software monitors the status of the UPS and writes them to the adjacent sqlite database.
It was required to monitor the status of UPSs in Zabbix, we solved it simply:
Added monitoring parameters to zabbix-agentd.conf.

UserParameter=upsd.voltagein, /usr/bin/sqlite3 /usr/local/Eaton/IntelligentPowerProtector/db/mc2.db "select value from status where object = 'UPS.PowerConverter.Input[1].Voltage'"

those. using sqlite3 I read the necessary values ​​​​from the database once a minute.
But over time, a problem was discovered, after a lapse of time (usually 3-4 hours), the database gets into locked mode and sqlite3 cannot lament anything more from it, while Eaton's software also stops writing anything to it, but keeps the database open.
Restarting the service from Eaton solves the problem for the same 3-4 hours ...
Apparently, the plug occurs when Eaton and sqlite3 try to access the database at the same time.
Tell me, can I somehow tell sqlite3 to open the database as read-only? I assume that the gag is due to the fact that Eaton and sqlite3 open the database for writing at the same time.
Thank you for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ixSci, 2012-12-14
@AbyssMoon

www.sqlite.org/c3ref/open.html
SQLITE_OPEN_READONLY

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question