Page 2 of 3
Re: Domoticz database check script
Posted: Wednesday 08 January 2020 23:38
by MikeF
PS: also works like a charm for me - thx!
Re: Domoticz database check script
Posted: Wednesday 08 January 2020 23:42
by MikeF
MikeF wrote: ↑Wednesday 08 January 2020 17:07
Hi waaren,
In your script, you have 'afterSuccesCommand' in 'main program', but 'aftersuccessCommand in 'Settings'
Sorry - you still have 'afterSuccesCommand' in 'main program' - single, not double, 's'.
Re: Domoticz database check script
Posted: Thursday 09 January 2020 0:16
by waaren
MikeF wrote: ↑Wednesday 08 January 2020 23:42
Sorry - you still have 'afterSuccesCommand' in 'main program' - single, not double, 's'.
Thx again. Two typo's in one word
It's a miracle that some of my code actually works
Re: Domoticz database check script
Posted: Thursday 09 January 2020 10:11
by EdwinK
Works
Now i need to figure out what the 'unknown error' is.
Re: Domoticz database check script
Posted: Thursday 09 January 2020 10:18
by waaren
EdwinK wrote: ↑Thursday 09 January 2020 10:11
Now i need to figure out what the 'unknown error' is.
If you set the scriptlogging to DEBUG and share the loglines maybe we can help ?
Re: Domoticz database check script
Posted: Thursday 09 January 2020 17:39
by EdwinK
waaren wrote: ↑Thursday 09 January 2020 10:18
EdwinK wrote: ↑Thursday 09 January 2020 10:11
Now i need to figure out what the 'unknown error' is.
If you set the scriptlogging to DEBUG and share the loglines maybe we can help ?
It seems it was easy to fix
Just wrong path to the database
O, and that evil 'database malformed' error, that I can't get rid of
Re: Domoticz database check script
Posted: Tuesday 14 January 2020 15:52
by EdwinK
When looking at the log it now shows:
Code: Select all
2020-01-14 14:05:11.232 Error: dzVents: Error: (2.5.5) DB check: pragma integrity_check; result ==>> Failed: The database disk image is malformed*** in database main ***
2020-01-14 14:05:11.232 Page 226: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 263: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 223: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 225: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 222: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 228: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 227: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 259: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 258: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 On tree page 14 cell 0: 2nd reference to page 66250
2020-01-14 14:05:11.232 On tree page 14 cell 2: 2nd reference to page 66375
2020-01-14 14:05:11.232 On tree page 14 cell 1: 2nd reference to page 14045
2020-01-14 14:05:11.232 On tree page 13314 cell 90: Rowid 235640 out of order
2020-01-14 14:05:11.232 On tree page 98 cell 0: 2nd reference to page 32742
2020-01-14 14:05:11.232 On tree page 98 cell 1: 2nd reference to page 30388
2020-01-14 14:05:11.232 On tree page 98 cell 0: 2nd reference to page 27249
2020-01-14 14:05:11.232 On tree page 39 cell 1: 2nd reference to page 13314
2020-01-14 14:05:11.232 wrong # of entries in index sqlite_autoindex_UserSessions_2
2020-01-14 14:05:11.232 (11)
2020-01-14 14:05:11.234 Error: dzVents: Error: (2.5.5) DB check: ------ Finished DB Check after >11 seconds. (using 0.406 seconds CPU time !)
Re: Domoticz database check script
Posted: Tuesday 14 January 2020 16:24
by waaren
EdwinK wrote: ↑Tuesday 14 January 2020 15:52
When looking at the log it now shows:
Code: Select all
2020-01-14 14:05:11.232 Error: dzVents: Error: (2.5.5) DB check: pragma integrity_check; result ==>> Failed: The database disk image is malformed*** in database main ***
2020-01-14 14:05:11.234 Error: dzVents: Error: (2.5.5) DB check: ------ Finished DB Check after >11 seconds. (using 0.406 seconds CPU time !)
The script identified some errors in the domoticz database. Best to make a copy now of the database and try to repair asap.
Re: Domoticz database check script
Posted: Wednesday 22 January 2020 16:37
by gjaa
What am I doing wrong
This is what I see in the logging
There is no device with that name or id: dbCheck result
Error: dzVents: Error: (2.5.5) DB check: An error occurred when calling event handler dzVents_DBcheck
Error: dzVents: Error: (2.5.5) DB check: ...cz/scripts/dzVents/generated_scripts/dzVents_DBcheck.lua:159: attempt to index a nil value
Re: Domoticz database check script
Posted: Wednesday 22 January 2020 17:59
by waaren
gjaa wrote: ↑Wednesday 22 January 2020 16:37
What am I doing wrong
You left
alert = true on line 42 but have not defined a device with devicetype alert and/or used a wrong name in line 43
Re: Domoticz database check script
Posted: Wednesday 22 January 2020 19:36
by EdwinK
Tried DB browser to check the database, but it couldn't open the database file
Re: Domoticz database check script
Posted: Monday 06 July 2020 20:44
by salopette
Hi, I created this today, but there is an error.
Can you help me?
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: There is no device with that name or id: dbCheck result
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: An error occurred when calling event handler DB_Check
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: .../domoticz/scripts/dzVents/generated_scripts/DB_Check.lua:159: attempt to index a nil value
Re: Domoticz database check script
Posted: Monday 06 July 2020 22:18
by waaren
salopette wrote: ↑Monday 06 July 2020 20:44
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: .../domoticz/scripts/dzVents/generated_scripts/DB_Check.lua:159: attempt to index a nil value
If you have active = true in line 42, you need to create an alert device with the name you entered in line 43.
Re: Domoticz database check script
Posted: Tuesday 07 July 2020 5:22
by salopette
many thanks
Re: Domoticz database check script
Posted: Wednesday 06 January 2021 12:15
by Calzor Suzay
I have some errors and weirdness in my log but will post a separate post on that, as a consequence though I implemented this script as it seemed quick and easy to perform a DB check on a regular basis (not sure why this couldn't be added by default TBH) but the script itself 'seems' to I'm not sure cause issues.
Like I say i've had issues recently with the website dying so have been running sudo systemctl status domoticz.service this all seemed fine till I added the script and now I get as below.
Code: Select all
pi@raspberrypi4:~ $ sudo systemctl status domoticz.service
* domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh; generated)
Active: active (running) since Tue 2021-01-05 10:38:40 GMT; 24h ago
Docs: man:systemd-sysv-generator(8)
Process: 474 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)
Tasks: 26 (limit: 4915)
CGroup: /system.slice/domoticz.service
`-583 /home/pi/domoticz/domoticz -daemon -www 8090 -sslwww 443
Jan 06 11:00:00 raspberrypi4 sudo[17794]: pam_unix(sudo:session): session closed for user root
Jan 06 11:00:00 raspberrypi4 sudo[17797]: root : TTY=unknown ; PWD=/home/pi/domoticz ; USER=root ; COMMAND=/usr/bin/sqlite3 /home/pi/domoticz/domoticz.db .
Jan 06 11:00:00 raspberrypi4 sudo[17797]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 06 11:00:00 raspberrypi4 sudo[17797]: pam_unix(sudo:session): session closed for user root
Jan 06 11:00:00 raspberrypi4 sudo[17800]: root : TTY=unknown ; PWD=/home/pi/domoticz ; USER=root ; COMMAND=/usr/bin/sqlite3 /home/pi/domoticz/domoticz.db p
Jan 06 11:00:00 raspberrypi4 sudo[17800]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 06 11:00:00 raspberrypi4 sudo[17800]: pam_unix(sudo:session): session closed for user root
Jan 06 11:00:00 raspberrypi4 sudo[17803]: root : TTY=unknown ; PWD=/home/pi/domoticz ; USER=root ; COMMAND=/usr/bin/sqlite3 /home/pi/domoticz/domoticz.db p
Jan 06 11:00:00 raspberrypi4 sudo[17803]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 06 11:00:00 raspberrypi4 sudo[17803]: pam_unix(sudo:session): session closed for user root
with debug on I see this in the logs
2021-01-06 11:13:00.210 Status: dzVents: Info: DB check: ------ Start internal script: DB_Check:, trigger: "at 11:13"
2021-01-06 11:13:00.253 Status: dzVents: Debug: DB check: Command select count(id) from deviceStatus; result ==>> OK
2021-01-06 11:13:00.289 Status: dzVents: Debug: DB check: Command .schema result ==>> OK
2021-01-06 11:13:00.477 Status: dzVents: Debug: DB check: Command pragma integrity_check; result ==>> OK
2021-01-06 11:13:00.512 Status: dzVents: Debug: DB check: Command pragma foreign_key_check; result ==>> OK
2021-01-06 11:13:00.512 Status: dzVents: Info: DB check: ------ Finished DB_Check
Everything is running but I see the session open session closed messages and have to Ctrl-C out of the query now.
Re: Domoticz database check script
Posted: Wednesday 06 January 2021 12:41
by waaren
Calzor Suzay wrote: ↑Wednesday 06 January 2021 12:15
Everything is running but I see the session open session closed messages and have to Ctrl-C out of the query now.
Seems quite legit to me. The log is showing what the script does.
Re: Domoticz database check script
Posted: Wednesday 06 January 2021 13:15
by Calzor Suzay
Ok just making sure, just have to Ctrl-C out of running the status update now, assumed it was stuck doing something and I have to quit it.
Re: Domoticz database check script
Posted: Wednesday 27 January 2021 11:45
by bertbigb
I have installed this script but it reports the following error.
Code: Select all
2021-01-27 11:10:01.487 Error: dzVents: Error: (3.0.2) DB check: Method updateAlertSensor is not available for device "dbCheckResult" (deviceType=General, deviceSubType=Text). If you believe this is not correct, please report.
I can't see myself why this error is reported
I hope someone can help me or guide me what to do?
Re: Domoticz database check script
Posted: Wednesday 27 January 2021 11:47
by waaren
bertbigb wrote: ↑Wednesday 27 January 2021 11:45
I have installed this script but it reports the following error.
Code: Select all
2021-01-27 11:10:01.487 Error: dzVents: Error: (3.0.2) DB check: Method updateAlertSensor is not available for device "dbCheckResult" (deviceType=General, deviceSubType=Text). If you believe this is not correct, please report.
You created device "dbCheckResult" as a type text device and it should be a type alert device
Re: Domoticz database check script
Posted: Wednesday 27 January 2021 11:58
by bertbigb
Thank you Waaren, that was indeed the problem, how stupid of me.