Page 1 of 1
watchdog or monit Domoticz crashing
Posted: Sunday 11 March 2018 11:23
by lsp242
Hi,
Just a question what the best way to monitor domoticz to be offline..
since 2 days's my domoticz got offline sometimes. I'm setting up my system, so it's no problem, but i've some questions:
1. what is the best way to scan on bugs/failures [logfiles]
2. What is better for domoticz running on raspberry py to automaticly restart when crashed, watchdog or monit?
regards
leon
Re: watchdog or monit
Posted: Sunday 11 March 2018 11:35
by SweetPants
lsp242 wrote: Sunday 11 March 2018 11:23
1. what is the best way to scan on bugs/failures [logfiles]
domoticz.log
lsp242 wrote: Sunday 11 March 2018 11:23
2. What is better for domoticz running on raspberry py to automaticly restart when crashed, watchdog or monit?
I use monit for years now, advantage is you can monitor/auto(re)start other services also
Re: watchdog or monit
Posted: Sunday 11 March 2018 12:58
by lsp242
Thnx..
In the wiki i can 't find to start writhing the logfile with...
sudo nano /etc/init.d/domoticz.sh
Re: watchdog or monit
Posted: Sunday 11 March 2018 14:45
by waaren
My configfile to check domoticz with monit (in monit.d)
Code: Select all
#
# Check domoticz
#
check process Domoticz with pidfile /var/run/domoticz.pid
start program = "/etc/init.d/domoticz.sh start"
stop program = "/etc/init.d/domoticz.sh stop"
if not exist for 8 cycles then restart
if failed
url http://xxx.xxx.xxx.xxx:domoticz-port/json.htm?type=command¶m=getversion # change to yourIP:yourPort
and content = '"status" : "OK"'
for 9 cycles then restart
if memory usage > 80% then restart
if 5 restarts within 5 cycles then alert
alert [email protected] # change to your Pushover Email adress
#end
Re: watchdog or monit domoticz crashing!!
Posted: Monday 12 March 2018 8:17
by lsp242
I can't get the logfile written, how does the start file domoticz have to look like in domoticz.sh
Domoticz crashed again and manual start gives the folowing
Code: Select all
./domoticz
2018-03-12 08:09:35.362 Domoticz V3.8153 (c)2012-2017 GizMoCuz
2018-03-12 08:09:35.363 Build Hash: 494fff7, Date: 2017-07-30 12:19:41
2018-03-12 08:09:35.363 System: Raspberry Pi
2018-03-12 08:09:35.363 Startup Path: /home/pi/domoticz/
2018-03-12 08:09:35.365 Error: SQL Query("SELECT name FROM sqlite_master WHERE type='table' AND name='DeviceStatus'") : unable to open database file
2018-03-12 08:09:35.365 Error: SQL Query("CREATE TABLE IF NOT EXISTS [DeviceStatus] ([ID] INTEGER PRIMARY KEY, [HardwareID] INTEGER NOT NULL, [DeviceID] VARCHAR(25) NOT NULL, [Unit] INTEGER DEFAULT 0, [Name] VARCHAR(100) DEFAULT Unknown, [Used] INTEGER DEFAULT 0, [Type] INTEGER NOT NULL, [SubType] INTEGER NOT NULL, [SwitchType] INTEGER DEFAULT 0, [Favorite] INTEGER DEFAULT 0, [SignalLevel] INTEGER DEFAULT 0, [BatteryLevel] INTEGER DEFAULT 0, [nValue] INTEGER DEFAULT 0, [sValue] VARCHAR(200) DEFAULT null, [LastUpdate] DATETIME DEFAULT (datetime('now','localtime')),[Order] INTEGER BIGINT(10) default 0, [AddjValue] FLOAT DEFAULT 0, [AddjMulti] FLOAT DEFAULT 1, [AddjValue2] FLOAT DEFAULT 0, [AddjMulti2] FLOAT DEFAULT 1, [StrParam1] VARCHAR(200) DEFAULT '', [StrParam2] VARCHAR(200) DEFAULT '', [LastLevel] INTEGER DEFAULT 0, [Protected] INTEGER DEFAULT 0, [CustomImage] INTEGER DEFAULT 0, [Description] VARCHAR(200) DEFAULT '', [Options] TEXT DEFAULT null);") : unable to open database file
2018-03-12 08:09:35.366 Error: SQL Query("CREATE TRIGGER IF NOT EXISTS devicestatusupdate AFTER INSERT ON DeviceStatus
BEGIN
UPDATE DeviceStatus SET [Order] = (SELECT MAX([Order]) FROM DeviceStatus)+1 WHERE DeviceStatus.ID = NEW.ID;
END;
") : unable to open database file
2018-03-12 08:09:35.366 Error: SQL Query("CREATE TABLE IF NOT EXISTS [EventActions] ([ID] INTEGER PRIMARY KEY, [ConditionID] INTEGER NOT NULL, [ActionType] INTEGER NOT NULL, [DeviceRowID] INTEGER DEFAULT 0, [Param1] VARCHAR(120), [Param2] VARCHAR(120), [Param3] VARCHAR(120), [Param4] VARCHAR(120), [Param5] VARCHAR(120), [Order] INTEGER BIGINT(10) default 0);") : unable to open database file
2018-03-12 08:09:35.366 Error: SQL Query("CREATE TRIGGER IF NOT EXISTS eventactionsstatusupdate AFTER INSERT ON EventActions
BEGIN
UPDATE EventActions SET [Order] = (SELECT MAX([Order]) FROM EventActions)+1 WHERE EventActions.ID = NEW.ID;
END;
") : unable to open database file
2018-03-12 08:09:35.367 Error: SQL Query("CREATE TABLE IF NOT EXISTS [LightingLog] ([DeviceRowID] BIGINT(10) NOT NULL, [nValue] INTEGER DEFAULT 0, [sValue] VARCHAR(200), [User] VARCHAR(100) DEFAULT (''), [Date] DATETIME DEFAULT (datetime('now','localtime')));") : unable to open database file
2018-03-12 08:09:35.367 Error: SQL Query("CREATE TABLE IF NOT EXISTS [SceneLog] ([SceneRowID] BIGINT(10) NOT NULL, [nValue] INTEGER DEFAULT 0, [Date] DATETIME DEFAULT (datetime('now','localtime')));") : unable to open database file
2018-03-12 08:09:35.367 Error: SQL Query("CREATE TABLE IF NOT EXISTS [Preferences] ([Key] VARCHAR(50) NOT NULL, [nValue] INTEGER DEFAULT 0, [sValue] VARCHAR(200));") : unable to open database file
2018-03-12 08:09:35.367 Error: SQL Query("CREATE TABLE IF NOT EXISTS [Rain] ([DeviceRowID] BIGINT(10) NOT NULL, [Total] FLOAT NOT NULL, [Rate] INTEGER DEFAULT 0, [Date] DATETIME DEFAULT (datetime('now','localtime')));") : unable to open database file
2018-03-12 08:09:35.368 Error: SQL Query("CREATE TABLE IF NOT EXISTS [Rain_Calendar] ([DeviceRowID] BIGINT(10) NOT NULL, [Total] FLOAT NOT NULL, [Rate] INTEGER DEFAULT 0, [Date] DATE NOT NULL);") : unable to open database file
and it is mutch longer, but when i restart rasp berry the system is running again..
Re: watchdog or monit Domoticz crashing
Posted: Wednesday 14 March 2018 20:32
by lsp242
Anybody an idea about the crash

Re: watchdog or monit Domoticz crashing
Posted: Wednesday 14 March 2018 20:40
by franzelare
i used the watchdog on the domoticz.log file, but i located the file now on a ramdisk, in order not to exhaust my sd card and slow down my system
i noticed that my system crashes less after i made this change
first i created a folder to map the ramdisk to
sudo mkdir -p /media/ramdisk
than i added the creation of a ramdisk to fstab
nano /etc/fstab
none /media/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=300M 0 0
in order to keep the file size in control i run truncate from crontab at one o'clock at night
nano crontab -e
0 1 * * * truncate -s 0 /media/ramdisk/domoticz.log
Re: watchdog or monit Domoticz crashing
Posted: Wednesday 14 March 2018 22:57
by lsp242