watchdog or monit Domoticz crashing

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
lsp242
Posts: 63
Joined: Sunday 04 February 2018 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 16960
Location: Netherlands
Contact:

watchdog or monit Domoticz crashing

Post 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
Last edited by lsp242 on Monday 12 March 2018 9:06, edited 1 time in total.
Gadget freak - Domoticz beginner - ios and android user
SweetPants

Re: watchdog or monit

Post 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
User avatar
lsp242
Posts: 63
Joined: Sunday 04 February 2018 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 16960
Location: Netherlands
Contact:

Re: watchdog or monit

Post by lsp242 »

Thnx..

In the wiki i can 't find to start writhing the logfile with...
sudo nano /etc/init.d/domoticz.sh
Gadget freak - Domoticz beginner - ios and android user
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: watchdog or monit

Post 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&param=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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
lsp242
Posts: 63
Joined: Sunday 04 February 2018 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 16960
Location: Netherlands
Contact:

Re: watchdog or monit domoticz crashing!!

Post 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..
Gadget freak - Domoticz beginner - ios and android user
User avatar
lsp242
Posts: 63
Joined: Sunday 04 February 2018 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 16960
Location: Netherlands
Contact:

Re: watchdog or monit Domoticz crashing

Post by lsp242 »

Anybody an idea about the crash :?: :?:
Gadget freak - Domoticz beginner - ios and android user
franzelare
Posts: 141
Joined: Thursday 19 February 2015 21:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: watchdog or monit Domoticz crashing

Post 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
User avatar
lsp242
Posts: 63
Joined: Sunday 04 February 2018 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 16960
Location: Netherlands
Contact:

Re: watchdog or monit Domoticz crashing

Post by lsp242 »

My systemen didn't crash before

Manuel schreef restart shows failure on datatabel 🤔

I truncate every night, but first crash in 2 days, restart only by Power off raspberry. Or reboot via ssh, start domototicz doesn't work while datatabel error. :?: :?: :?: :?: :?:
Gadget freak - Domoticz beginner - ios and android user
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest