Hi Everyone,
Hoping to get some direction here. I am trying to create a flow where I ping google every 10 mins, if ping is false, wait another 10 mins, ping again and if false, run ssh command to reboot the router (it an asus router that allows ssh). However, I am struggling with catching the output for a failed ping from the exec node and also the ssh command.
This is what my flow looks like:
I tried using putty to the router and once logged in all I need to do is type reboot and enter to reboot the router. But I can't seem to figure out how to do this in the ssh client node.
[
{
"id": "343e08a1.fc3668",
"type": "tab",
"label": "Reboot Router",
"disabled": false,
"info": ""
},
{
"id": "6370cfde.18eb7",
"type": "ping",
"z": "343e08a1.fc3668",
"name": "",
"host": "www.google.com",
"timer": "35",
"x": 100,
"y": 420,
"wires": [
[
"e50aae5f.5c05c"
]
]
},
{
"id": "e50aae5f.5c05c",
"type": "switch",
"z": "343e08a1.fc3668",
"name": "Is False or > 0",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "false"
},
{
"t": "gt",
"v": "0",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 300,
"y": 420,
"wires": [
[
"a3049fe5.bf31f"
],
[]
]
},
{
"id": "4d4b7c6d.4e71f4",
"type": "exec",
"z": "343e08a1.fc3668",
"command": "ping -c 2",
"addpay": false,
"append": "www.google.com",
"useSpawn": "false",
"timer": "20",
"oldrc": false,
"name": "",
"x": 680,
"y": 420,
"wires": [
[],
[],
[
"df76a9b1.ad3628",
"396bafc0.2d71d"
]
]
},
{
"id": "df76a9b1.ad3628",
"type": "switch",
"z": "343e08a1.fc3668",
"name": "?",
"property": "payload",
"propertyType": "msg",
"rules": [],
"checkall": "true",
"repair": false,
"outputs": 0,
"x": 850,
"y": 460,
"wires": []
},
{
"id": "9833a944.4ef348",
"type": "ssh-client",
"z": "343e08a1.fc3668",
"debug": false,
"ssh": "",
"hostname": "",
"name": "",
"x": 980,
"y": 380,
"wires": [
[]
]
},
{
"id": "a3049fe5.bf31f",
"type": "delay",
"z": "343e08a1.fc3668",
"name": "",
"pauseType": "delay",
"timeout": "10",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 510,
"y": 420,
"wires": [
[
"4d4b7c6d.4e71f4"
]
]
},
{
"id": "396bafc0.2d71d",
"type": "debug",
"z": "343e08a1.fc3668",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 850,
"y": 520,
"wires": []
}
]