Created
December 4, 2022 18:58
-
-
Save ikidd/04cce49481e04c3945388a41014dbbc0 to your computer and use it in GitHub Desktop.
Monitors ping to OpnSense WG endpoint and restarts if too long
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "76ce4664.bf196", | |
"type": "ping", | |
"z": "c612d869.d3336", | |
"mode": "timed", | |
"name": "Ping through VPN", | |
"host": "10.200.100.1", | |
"timer": "20", | |
"inputs": 0, | |
"x": 120, | |
"y": 480, | |
"wires": [ | |
[ | |
"561b7924.3da8f" | |
] | |
] | |
}, | |
{ | |
"id": "561b7924.3da8f", | |
"type": "switch", | |
"z": "c612d869.d3336", | |
"name": "", | |
"property": "payload", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "false" | |
}, | |
{ | |
"t": "gt", | |
"v": "0", | |
"vt": "str" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 2, | |
"x": 320, | |
"y": 540, | |
"wires": [ | |
[ | |
"4c632439.11c204" | |
], | |
[ | |
"850ccd9e.badfc", | |
"49ba5ee7.ba1168", | |
"55de8362.7d5ab4" | |
] | |
] | |
}, | |
{ | |
"id": "4c632439.11c204", | |
"type": "exec", | |
"z": "c612d869.d3336", | |
"command": "sudo systemctl restart wg-quick@wg0", | |
"addpay": false, | |
"append": "", | |
"useSpawn": "false", | |
"timer": "15", | |
"oldrc": false, | |
"name": "restart tunnel", | |
"x": 570, | |
"y": 520, | |
"wires": [ | |
[], | |
[], | |
[ | |
"bdf29893.8d0888" | |
] | |
] | |
}, | |
{ | |
"id": "850ccd9e.badfc", | |
"type": "ui_text", | |
"z": "c612d869.d3336", | |
"group": "e2001e28.1210f8", | |
"order": 5, | |
"width": 0, | |
"height": 0, | |
"name": "", | |
"label": "Last tunnel ping:", | |
"format": "{{msg.payload}} ms", | |
"layout": "row-spread", | |
"x": 580, | |
"y": 620, | |
"wires": [] | |
}, | |
{ | |
"id": "49ba5ee7.ba1168", | |
"type": "influxdb out", | |
"z": "c612d869.d3336", | |
"influxdb": "553c7a0a.db2da4", | |
"name": "Log ping response", | |
"measurement": "wg0_ping", | |
"precision": "", | |
"retentionPolicy": "", | |
"database": "database", | |
"precisionV18FluxV20": "ms", | |
"retentionPolicyV18Flux": "", | |
"org": "organisation", | |
"bucket": "bucket", | |
"x": 590, | |
"y": 660, | |
"wires": [] | |
}, | |
{ | |
"id": "94a1cb94.153f1", | |
"type": "ui_text", | |
"z": "c612d869.d3336", | |
"group": "e2001e28.1210f8", | |
"order": 8, | |
"width": 0, | |
"height": 0, | |
"name": "", | |
"label": "Last tunnel restart: ", | |
"format": "{{msg.payload.time}}", | |
"layout": "row-spread", | |
"x": 970, | |
"y": 520, | |
"wires": [] | |
}, | |
{ | |
"id": "bdf29893.8d0888", | |
"type": "function", | |
"z": "c612d869.d3336", | |
"name": "", | |
"func": "msg.payload.time=new Date().toLocaleString();\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"x": 760, | |
"y": 520, | |
"wires": [ | |
[ | |
"94a1cb94.153f1" | |
] | |
] | |
}, | |
{ | |
"id": "55de8362.7d5ab4", | |
"type": "ui_chart", | |
"z": "c612d869.d3336", | |
"name": "", | |
"group": "e2001e28.1210f8", | |
"order": 7, | |
"width": 0, | |
"height": 0, | |
"label": "VPN Ping", | |
"chartType": "line", | |
"legend": "false", | |
"xformat": "HH:mm:ss", | |
"interpolate": "linear", | |
"nodata": "", | |
"dot": false, | |
"ymin": "", | |
"ymax": "", | |
"removeOlder": 1, | |
"removeOlderPoints": "", | |
"removeOlderUnit": "3600", | |
"cutout": 0, | |
"useOneColor": false, | |
"useUTC": false, | |
"colors": [ | |
"#1f77b4", | |
"#aec7e8", | |
"#ff7f0e", | |
"#2ca02c", | |
"#98df8a", | |
"#d62728", | |
"#ff9896", | |
"#9467bd", | |
"#c5b0d5" | |
], | |
"outputs": 1, | |
"x": 560, | |
"y": 580, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "e2001e28.1210f8", | |
"type": "ui_group", | |
"name": "MCU", | |
"tab": "fc1c779c.bdae18", | |
"order": 1, | |
"disp": true, | |
"width": "6", | |
"collapse": false | |
}, | |
{ | |
"id": "553c7a0a.db2da4", | |
"type": "influxdb", | |
"hostname": "10.10.251.8", | |
"port": "8086", | |
"protocol": "http", | |
"database": "camper", | |
"name": "", | |
"usetls": false, | |
"tls": "", | |
"influxdbVersion": "1.x", | |
"url": "http://10.10.251.8:8086", | |
"rejectUnauthorized": false | |
}, | |
{ | |
"id": "fc1c779c.bdae18", | |
"type": "ui_tab", | |
"name": "MCU", | |
"icon": "dashboard", | |
"order": 2, | |
"disabled": false, | |
"hidden": false | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment