Checking to see if domoticz is still working on Synology NAS

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
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Checking to see if domoticz is still working on Synology NAS

Post by idonl »

Hi,

I found this easy solution to monitor if Domoticz is still working, if its not, it will start Domoticz
https://www.domoticz.com/wiki/Monitorin ... ive_script

This probably works on a RPI, but the folders on a Synology are different, also there is no synology.sh file (or I cant find it)

How can I implement this script on a Synology NAS?

kind regards

Ido
steef84
Posts: 37
Joined: Friday 30 August 2013 20:24
Target OS: NAS (Synology & others)
Domoticz version: DS213+
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by steef84 »

You can install Monit on Synology. Just add SynoCommunity as package source and install Monit for Synology.
- Stefan
User avatar
mvveelen
Posts: 687
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by mvveelen »

I had this script running:

check_online.sh

Code: Select all

#!/bin/sh
# check domoticz

status=`curl -s -o /dev/null -I -w "%{http_code}" http://192.168.0.124:8084/json.htm?type=command&param=getversion`
if [ $status -eq 200 ]
then

echo "Domoticz is al gestart"

else

synopkg restart domoticz

/bin/sh /volume1/@appstore/domoticz/var/scripts/prowl.sh "Domoticz" 0 "Status" "Domoticz was gestopt."

fi
and ran it with a cron job every 5 or 10 minutes.

But now I switched to Monit and like that a lot more.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by idonl »

Thank you for the replies.

Script looks simple, but you prefer monit anyway, good to know.
Can you perhaps share your config file with monitor configurations, the domoticz monit example is also RPI based and not synology based
User avatar
Ferpando
Posts: 30
Joined: Friday 23 October 2015 9:45
Target OS: NAS (Synology & others)
Domoticz version:
Location: Spain
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by Ferpando »

steef84 wrote:You can install Monit on Synology. Just add SynoCommunity as package source and install Monit for Synology.
Hi,

Could you post the details on using monit on a synology nas?

I installed the app from the package center but the info on the wiki is not accurate and does not work.
steef84
Posts: 37
Joined: Friday 30 August 2013 20:24
Target OS: NAS (Synology & others)
Domoticz version: DS213+
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by steef84 »

Sure will post the config files later today when home...

EDIT:

ssh / scp into your Synology. Create file /usr/local/monit/var/monit.d/domoticz with following contents

Code: Select all

#check domoticz is running
check process domoticz with pidfile /usr/local/domoticz/var/domoticz.pid
    start program = "/var/packages/domoticz/scripts/start-stop-status start"
    stop program  = "/var/packages/domoticz/scripts/start-stop-status stop"
    if failed host localhost port 8084 then restart
    if 3 restarts within 5 cycles then timeout
    if memory > 110 MB then restart
#done
Monit is available on your ip:2812. Default username and password is monit / monit. You can adjust the parameters if you want.
- Stefan
User avatar
Ferpando
Posts: 30
Joined: Friday 23 October 2015 9:45
Target OS: NAS (Synology & others)
Domoticz version:
Location: Spain
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by Ferpando »

Ok, I did figured out the location of the PID file, but didn't know hot to restart it.
I did find the start-stop-status script, but I thought it had something to do with package center.
So i was not too far away :-)
I see you also removed the reboot from the wiki script, which indeed rebooted the whole nas.

Thanks for the pointers.
User avatar
Ferpando
Posts: 30
Joined: Friday 23 October 2015 9:45
Target OS: NAS (Synology & others)
Domoticz version:
Location: Spain
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by Ferpando »

I did change the script but i just can't stop domoticz to test it.
If I stop it in the package center, it shows stopped but the process is still running.
Algo if I shut it down from the menu, says
2015-10-24 14:34:40.389 Error: Error executing shutdown command. returned: 32512
So I don't know hot to test it
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by idonl »

Perfect, figured it out, there is a sample script folder in the monit folder, which also contains a script for domotics.

I still have to figure out how to monitor my mysql database, and probably others. If people are willing to share their monit @ synology, then please, saves me a lot of time researching
Skippiemanz
Posts: 230
Joined: Sunday 14 July 2013 20:21
Target OS: Linux
Domoticz version: 4.10233
Location: Alkmaar, The Netherlands
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by Skippiemanz »

Thanks! was looking for a way to monitor Domoticz on my DS 713+. First couldn't find the monit package. But now it was ther. installed it. Created the domoticz file and restarted monit and up and running!
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by ThinkPad »

Be sure to check it though...... (stopping the Domoticz package by hand & then wait to see if Monit kicks in).

I also use monit on the Ubuntu virtual machine that runs my Domoticz. Monit is very handy. Not only for taking action when Domoticz is down, but also to restart the Domoticz process when it consumes too much CPU (hanging). Maybe not the most ideal setup to find a solution, but for me it is the uptime & reliability that counts.
Having lights that won't respond will get my girlfriend annoyed veeeeeery quickly :roll:
I am not active on this forum anymore.
Skippiemanz
Posts: 230
Joined: Sunday 14 July 2013 20:21
Target OS: Linux
Domoticz version: 4.10233
Location: Alkmaar, The Netherlands
Contact:

Re: Checking to see if domoticz is still working on Synology

Post by Skippiemanz »

Thanks! I Will test it! Haha the girlfriend stuff sounds familiair! ;-)

*EDIT* Just tested and works flawlessly!
cherowley
Posts: 65
Joined: Tuesday 24 February 2015 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Checking to see if domoticz is still working on Synology NAS

Post by cherowley »

Just set this up (have had a few times where domoticz stops running but nothing in the log) and seems to work great except that after monit restarts domoticz, synology shows it as not running still.

I stopped domoticz by the package manager in the ui so I suspect we need a way to tell synology that monitor has started it?


Overall this is a great life, I mean, wife saver! A couple of times I've endured the wrath of swmbo when the kitchen lights have failed lol!
User avatar
gizmocuz
Posts: 2521
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Checking to see if domoticz is still working on Synology NAS

Post by gizmocuz »

That is also why you should not let your house depend on any software application, but see it as addon
So your kitchen lights, use zwave, you can always turn them on/off without software, but... can also control them by software
(433mhz kaku/coco will also work of course)
But... it gets addicted, for instance you have one remote button that turns out all lights in the living room (downstairs..), and turns on your bedroom light.
When this remote does not work (battery issue for instance) you have to go to all the lights to turn them off by hand... but at least you can turn them off.
I have not a single switch or power outlet in my house that we can not control without software, that is very pleasant for the WAF
.. But the whole house 'is' controlled, but can be overruled
Quality outlives Quantity!
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: RE: Re: Checking to see if domoticz is still working on Synology NAS

Post by stlaha2007 »

cherowley wrote:Just set this up (have had a few times where domoticz stops running but nothing in the log) and seems to work great except that after monit restarts domoticz, synology shows it as not running still.

I stopped domoticz by the package manager in the ui so I suspect we need a way to tell synology that monitor has started it?


Overall this is a great life, I mean, wife saver! A couple of times I've endured the wrath of swmbo when the kitchen lights have failed lol!
Own a Qnap so dont have the right solution... However on qnap there are commands to stop/start programs in a simular way.
I searched a little and found this: https://forum.synology.com/enu/viewtopi ... 0&t=107575
It recommands to create a task to stop/start a package... Perhaps adapting this commandline/script in monit will help...

Grtz,
Stephan
jurgen
Posts: 30
Joined: Friday 02 October 2015 19:09
Target OS: NAS (Synology & others)
Domoticz version: stable
Contact:

Re: Checking to see if domoticz is still working on Synology NAS

Post by jurgen »

cherowley wrote:Just set this up (have had a few times where domoticz stops running but nothing in the log) and seems to work great except that after monit restarts domoticz, synology shows it as not running still.

I stopped domoticz by the package manager in the ui so I suspect we need a way to tell synology that monitor has started it?


Overall this is a great life, I mean, wife saver! A couple of times I've endured the wrath of swmbo when the kitchen lights have failed lol!

HI All,

Is there anybody who know's how to tell synology that domoticz is started?

username@DS411:/usr/local/monit/var/monit.d$ sudo synopkg status domoticz

domoticz package is stopped
Status: [0]



username@DS411:/var/packages/domoticz/scripts$ sudo ./start-stop-status status
Domoticz is running
Post Reply

Who is online

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