pi #2 check if domoticz running on pi #1 is online
Moderator: leecollings
-
- Posts: 28
- Joined: Monday 05 March 2018 3:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
pi #2 check if domoticz running on pi #1 is online
Hi,
I am setting up a second raspberry setup with domoticz as a failsafe for some critical stuff. That second raspberry will run only some relais directly on his gpio pins, so far so good.
Now this second raspberry pi must continue check if domoticz is running on my main raspberry pi domoticz setup. How can i do that?
I already have the second raspberry setup pinging the main raspberry, that works good for a total failure of the main raspberry, main raspberry offline? the second raspberry will turn all relais off instantly. But, in case of a domoticz crash on the main raspberry, the main raspberry will ofcourse still return the ping so its not totally safe.
How can i make a domoticz service checker on the second raspberry, that will check if domoticz is running on the main raspberry? And, i want that checker to trigger a dummy, so i can use that dummy switch in the same way as the pinger in my failsafe events.
So in case of a domoticz service crash or failure on the first raspberry with the main domoticz, i want that to trigger a dummy switch to "off" on the second raspberry, so i can make scripts on the second raspberry that with that dummy to open all relays on its gpio's.
Can i do that with master and slave domoticz? I really don't need master and slave for its Original features, pure only for checking if domoticz is online.
Thanks!
I am setting up a second raspberry setup with domoticz as a failsafe for some critical stuff. That second raspberry will run only some relais directly on his gpio pins, so far so good.
Now this second raspberry pi must continue check if domoticz is running on my main raspberry pi domoticz setup. How can i do that?
I already have the second raspberry setup pinging the main raspberry, that works good for a total failure of the main raspberry, main raspberry offline? the second raspberry will turn all relais off instantly. But, in case of a domoticz crash on the main raspberry, the main raspberry will ofcourse still return the ping so its not totally safe.
How can i make a domoticz service checker on the second raspberry, that will check if domoticz is running on the main raspberry? And, i want that checker to trigger a dummy, so i can use that dummy switch in the same way as the pinger in my failsafe events.
So in case of a domoticz service crash or failure on the first raspberry with the main domoticz, i want that to trigger a dummy switch to "off" on the second raspberry, so i can make scripts on the second raspberry that with that dummy to open all relays on its gpio's.
Can i do that with master and slave domoticz? I really don't need master and slave for its Original features, pure only for checking if domoticz is online.
Thanks!
-
- Posts: 132
- Joined: Monday 07 August 2017 17:17
- Target OS: Linux
- Domoticz version: Latest β
- Location: Near London (Saaarf!)
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
You can use node-red with a webhook
from same machine or with network IP from another.
I use it to monitor Domoticz then restart it if it has failed.
Here is the original thread by the person who created the flow that I used. https://www.domoticz.com/forum/viewtopi ... 64&t=25314
Here is the basis of the flow for import:
Code: Select all
http://127.0.0.1:8080/json.htm?type=command¶m=getversion
I use it to monitor Domoticz then restart it if it has failed.
Here is the original thread by the person who created the flow that I used. https://www.domoticz.com/forum/viewtopi ... 64&t=25314
Here is the basis of the flow for import:
Code: Select all
[{"id":"8e8cb6.4da8a348","type":"tab","label":"Domoticz WatchDog","disabled":false,"info":""},{"id":"f88340b.d7622c","type":"inject","z":"8e8cb6.4da8a348","name":"Get Domoticz Status","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"onceDelay":"200","x":160,"y":180,"wires":[["b901bb5e.0c4cf8"]]},{"id":"b901bb5e.0c4cf8","type":"http request","z":"8e8cb6.4da8a348","name":"Get Domoticz Status","method":"GET","ret":"obj","url":"http://127.0.0.1:8080/json.htm?type=command¶m=getversion","tls":"","x":380,"y":180,"wires":[["14baaaec.7b67e5"]]},{"id":"14baaaec.7b67e5","type":"switch","z":"8e8cb6.4da8a348","name":"Check Domoticz Status","property":"payload.status","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":640,"y":180,"wires":[["5cccaa0f.0c3014"],["d389dd1c.557e5"]]},{"id":"7e000b47.8aabb4","type":"debug","z":"8e8cb6.4da8a348","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":970,"y":360,"wires":[]},{"id":"d389dd1c.557e5","type":"function","z":"8e8cb6.4da8a348","name":"Count","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = flow.get('count')||0;\ncount += 1;\n// store the value back\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":320,"wires":[["162b88eb.838a77"]]},{"id":"5cccaa0f.0c3014","type":"function","z":"8e8cb6.4da8a348","name":"Count Reset","func":"// Reset the counter\nvar count = 0;\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":160,"wires":[[]]},{"id":"162b88eb.838a77","type":"switch","z":"8e8cb6.4da8a348","name":"Count Evaluation","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":320,"wires":[["e84b593.00fa3a8"]]},{"id":"76d51280.e07dfc","type":"exec","z":"8e8cb6.4da8a348","command":"sudo /etc/init.d/domoticz.sh","addpay":false,"append":"stop","useSpawn":"false","timer":"30","oldrc":false,"name":"Domoticz stop","x":740,"y":320,"wires":[["7e000b47.8aabb4"],[],["413344cf.755bcc"]]},{"id":"92bc8257.56a74","type":"exec","z":"8e8cb6.4da8a348","command":"sudo /etc/init.d/domoticz.sh","addpay":false,"append":"start","useSpawn":"false","timer":"","oldrc":false,"name":"Domoticz start","x":740,"y":420,"wires":[["7e000b47.8aabb4"],["2bfe221b.1ba35e"],["2bfe221b.1ba35e"]]},{"id":"2bfe221b.1ba35e","type":"function","z":"8e8cb6.4da8a348","name":"Count Reset","func":"// Reset the counter\nvar count = 0;\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":970,"y":480,"wires":[[]]},{"id":"413344cf.755bcc","type":"delay","z":"8e8cb6.4da8a348","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":560,"y":420,"wires":[["92bc8257.56a74"]]},{"id":"e84b593.00fa3a8","type":"time-range-switch","z":"8e8cb6.4da8a348","name":"","lat":"51.433","lon":"-0.378","startTime":"02:00","endTime":"02:15","startOffset":0,"endOffset":0,"x":530,"y":320,"wires":[[],["76d51280.e07dfc"]]}]
Domoticz Latest β, RPi 4B with 110Gb SSD for Domoticz, RPi 4B with 110Gb SSD for Node-Red & a RPi 2B for logging / IP addressing. RFXCOM, PiZiGate, Z-Wave, Harmony, Hue lamps and a bit of Broadlink.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
Search for monit on this forum and Google. Already many posts on this excellent monitor-, alert- and correction tool.ActionHenk wrote: ↑Wednesday 20 March 2019 1:12 second raspberry pi must continue check if domoticz is running on my main raspberry pi domoticz setup. How can i do that?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 28
- Joined: Monday 05 March 2018 3:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
I have heard of monit, can monit monitor a remote domoticz and then trigger a dummy switch in domoticz on the same host if the remote domoticz service is offline? Thanks!waaren wrote: ↑Wednesday 20 March 2019 2:40Search for monit on this forum and Google. Already many posts on this excellent monitor-, alert- and correction tool.ActionHenk wrote: ↑Wednesday 20 March 2019 1:12 second raspberry pi must continue check if domoticz is running on my main raspberry pi domoticz setup. How can i do that?
Last edited by ActionHenk on Wednesday 20 March 2019 8:35, edited 2 times in total.
-
- Posts: 28
- Joined: Monday 05 March 2018 3:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
i'm gonna check this out, thanks!alanlsmith wrote: ↑Wednesday 20 March 2019 2:01 You can use node-red with a webhook
from same machine or with network IP from another.Code: Select all
http://127.0.0.1:8080/json.htm?type=command¶m=getversion
I use it to monitor Domoticz then restart it if it has failed.
Here is the original thread by the person who created the flow that I used. https://www.domoticz.com/forum/viewtopi ... 64&t=25314
Here is the basis of the flow for import:Code: Select all
[{"id":"8e8cb6.4da8a348","type":"tab","label":"Domoticz WatchDog","disabled":false,"info":""},{"id":"f88340b.d7622c","type":"inject","z":"8e8cb6.4da8a348","name":"Get Domoticz Status","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"onceDelay":"200","x":160,"y":180,"wires":[["b901bb5e.0c4cf8"]]},{"id":"b901bb5e.0c4cf8","type":"http request","z":"8e8cb6.4da8a348","name":"Get Domoticz Status","method":"GET","ret":"obj","url":"http://127.0.0.1:8080/json.htm?type=command¶m=getversion","tls":"","x":380,"y":180,"wires":[["14baaaec.7b67e5"]]},{"id":"14baaaec.7b67e5","type":"switch","z":"8e8cb6.4da8a348","name":"Check Domoticz Status","property":"payload.status","propertyType":"msg","rules":[{"t":"eq","v":"OK","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":640,"y":180,"wires":[["5cccaa0f.0c3014"],["d389dd1c.557e5"]]},{"id":"7e000b47.8aabb4","type":"debug","z":"8e8cb6.4da8a348","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":970,"y":360,"wires":[]},{"id":"d389dd1c.557e5","type":"function","z":"8e8cb6.4da8a348","name":"Count","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = flow.get('count')||0;\ncount += 1;\n// store the value back\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":320,"wires":[["162b88eb.838a77"]]},{"id":"5cccaa0f.0c3014","type":"function","z":"8e8cb6.4da8a348","name":"Count Reset","func":"// Reset the counter\nvar count = 0;\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":160,"wires":[[]]},{"id":"162b88eb.838a77","type":"switch","z":"8e8cb6.4da8a348","name":"Count Evaluation","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":320,"wires":[["e84b593.00fa3a8"]]},{"id":"76d51280.e07dfc","type":"exec","z":"8e8cb6.4da8a348","command":"sudo /etc/init.d/domoticz.sh","addpay":false,"append":"stop","useSpawn":"false","timer":"30","oldrc":false,"name":"Domoticz stop","x":740,"y":320,"wires":[["7e000b47.8aabb4"],[],["413344cf.755bcc"]]},{"id":"92bc8257.56a74","type":"exec","z":"8e8cb6.4da8a348","command":"sudo /etc/init.d/domoticz.sh","addpay":false,"append":"start","useSpawn":"false","timer":"","oldrc":false,"name":"Domoticz start","x":740,"y":420,"wires":[["7e000b47.8aabb4"],["2bfe221b.1ba35e"],["2bfe221b.1ba35e"]]},{"id":"2bfe221b.1ba35e","type":"function","z":"8e8cb6.4da8a348","name":"Count Reset","func":"// Reset the counter\nvar count = 0;\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":970,"y":480,"wires":[[]]},{"id":"413344cf.755bcc","type":"delay","z":"8e8cb6.4da8a348","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":560,"y":420,"wires":[["92bc8257.56a74"]]},{"id":"e84b593.00fa3a8","type":"time-range-switch","z":"8e8cb6.4da8a348","name":"","lat":"51.433","lon":"-0.378","startTime":"02:00","endTime":"02:15","startOffset":0,"endOffset":0,"x":530,"y":320,"wires":[[],["76d51280.e07dfc"]]}]
-
- Posts: 28
- Joined: Monday 05 March 2018 3:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
hmm, it looks like both services only restart domoticz, but cannot trigger a dummy switch.
I need this for a fail safe, both raspberry #1 and #2 will run relais, those relais from #1 and #2 are in serial and will only power a device if both relais are switched on , so if domoticz #1 is offline, relay on domoticz #2 will be off or if domoticz #2 is offline, relay on domoticz #1 will be off, so in either case the device will also turn off.
Thats all, to bad there isn't a simple remote check plugin for this in the hardware tab
I need this for a fail safe, both raspberry #1 and #2 will run relais, those relais from #1 and #2 are in serial and will only power a device if both relais are switched on , so if domoticz #1 is offline, relay on domoticz #2 will be off or if domoticz #2 is offline, relay on domoticz #1 will be off, so in either case the device will also turn off.
Thats all, to bad there isn't a simple remote check plugin for this in the hardware tab
Re: pi #2 check if domoticz running on pi #1 is online
Monit can do all kind of stuff if a service is not responding in a certain fashion or is 'dead'
Look in the Monit manual or Google. Look for Alert messages.
It even can reboot the system, set email etc.....
Look in the Monit manual or Google. Look for Alert messages.
It even can reboot the system, set email etc.....
-
- Posts: 28
- Joined: Monday 05 March 2018 3:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
But i don't want it to reboot, or send a message, or a mail, i want it to turn off a dummy switch or a idx #
I readed the manual, but it seems thats not possible.
I think my best bet is to trigger a dummy relay with a 10 seconds timer, every 5 seconds domoticz will trigger that relay, if domoticz is down the dummy relay won't be triggered and the relais will be off within 10 seconds.
domoticz#2 will read out that relay and then when its off, a dummy switch is off wich in turn activates a event wich will closes the other relais.
I readed the manual, but it seems thats not possible.
I think my best bet is to trigger a dummy relay with a 10 seconds timer, every 5 seconds domoticz will trigger that relay, if domoticz is down the dummy relay won't be triggered and the relais will be off within 10 seconds.
domoticz#2 will read out that relay and then when its off, a dummy switch is off wich in turn activates a event wich will closes the other relais.
-
- Posts: 132
- Joined: Monday 07 August 2017 17:17
- Target OS: Linux
- Domoticz version: Latest β
- Location: Near London (Saaarf!)
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
I use this flow on a Raspberry Pi (running Domoticz as a slave, although that is not relevant in this case) to monitor My Main Ubuntu machine running Domoticz. It uses 'ping' to check that the machine is accessible and if it can't be reached then it toggles a switch (on the Raspberry Pi Domoticz) off and on to power cycle the Ubuntu machine.
A combination of the two flows where the first part checks that Domoticz is running and the second part actions a switch should satisfy your requirement.
As Node-Red uses a json webhook to trigger the switch it doesn't matter where the switch is located as long as it is a device in a Domoticz instance.
Flow to monitor Ubuntu box:
A combination of the two flows where the first part checks that Domoticz is running and the second part actions a switch should satisfy your requirement.
As Node-Red uses a json webhook to trigger the switch it doesn't matter where the switch is located as long as it is a device in a Domoticz instance.
Flow to monitor Ubuntu box:
Code: Select all
[{"id":"bd8798f2.ddb3a8","type":"tab","label":"Master alive check","disabled":false,"info":""},
{"id":"b9fb0fdc.565e2","type":"switch","z":"bd8798f2.ddb3a8","name":"Alive or not","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Alive","vt":"str"},{"t":"eq","v":"Dead","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":120,"wires":[["35846466.62b17c"],["10f13ff6.4b762"]]},{"id":"cd910f36.495ae","type":"http request","z":"bd8798f2.ddb3a8","name":"Turn off power","method":"GET","ret":"txt","url":"http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=23&switchcmd=Off","tls":"","x":560,"y":300,"wires":[["b29bfbc6.a9ce88"]]},{"id":"d23d1fd.8e72ce","type":"function","z":"bd8798f2.ddb3a8","name":"Convert boolean value","func":"if (msg.payload === false) \n{ msg.payload = \"Dead\"; }\nelse \n{ msg.payload = 'Alive'; }\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":120,"wires":[["b9fb0fdc.565e2"]]},{"id":"35846466.62b17c","type":"function","z":"bd8798f2.ddb3a8","name":"Count Reset","func":"// Reset the counter\nvar count = 0;\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":120,"wires":[[]]},{"id":"10f13ff6.4b762","type":"function","z":"bd8798f2.ddb3a8","name":"Count","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = flow.get('count')||0;\ncount += 1;\n// store the value back\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn msg;","outputs":1,"noerr":0,"x":170,"y":300,"wires":[["5e74b305.5d0cbc"]]},{"id":"5e74b305.5d0cbc","type":"switch","z":"bd8798f2.ddb3a8","name":"Continue if count = 3","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":360,"y":300,"wires":[["cd910f36.495ae"]]},{"id":"b29bfbc6.a9ce88","type":"delay","z":"bd8798f2.ddb3a8","name":"Wait one minute","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":760,"y":300,"wires":[["30b5ea43.d641d6"]]},{"id":"30b5ea43.d641d6","type":"http request","z":"bd8798f2.ddb3a8","name":"Turn on power","method":"GET","ret":"txt","url":"http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=23&switchcmd=On","tls":"","x":960,"y":300,"wires":[[]]},{"id":"47eb45fe.43cefc","type":"ping","z":"bd8798f2.ddb3a8","name":"Domoticz Master Keep Alive check","host":"192.168.0.10","timer":"20","x":179,"y":120,"wires":[["d23d1fd.8e72ce"]]}]
Domoticz Latest β, RPi 4B with 110Gb SSD for Domoticz, RPi 4B with 110Gb SSD for Node-Red & a RPi 2B for logging / IP addressing. RFXCOM, PiZiGate, Z-Wave, Harmony, Hue lamps and a bit of Broadlink.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
This monit check will do what you want.
Code: Select all
check process domoticz with pidfile /var/run/domoticz.pid
if failed
url http://PI-1:8084/json.htm?type=command¶m=getversion
and content = '"status" : "OK"'
then exec "/usr/bin/curl 'http:/PI-2:8084/json.htm?type=command¶m=switchlight&idx=1794&switchcmd=On'"
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 28
- Joined: Monday 05 March 2018 3:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: pi #2 check if domoticz running on pi #1 is online
I think a new time has come, i have to learn code. I Always ignored learning codes and finding other ways to get there and untill now i managed.
Thank you all for your kind help!
Thank you all for your kind help!
Who is online
Users browsing this forum: No registered users and 1 guest