diff --git a/settings/autoconf.py b/settings/autoconf.py index cf30b63..5fdb349 100644 --- a/settings/autoconf.py +++ b/settings/autoconf.py @@ -294,17 +294,20 @@ def items(inv, nets): # Network MIDI: every peer in the sessions here and on the other Macs, at its wired address. midi_checks = [] # Whose session a peer is, by its name: a peer joined by name or by an IPv6 address gets that Mac's wired address. - owner = {sname: alias for alias, sessions in (inv.get("midi") or {}).items() if alias for sname in (sessions or {})} + owner = {sname: (alias or "ingest") for alias, sessions in (inv.get("midi") or {}).items() for sname in (sessions or {})} + ing = inv.get("ingest") or {} + ing_ips = [ip for ip in [(ing.get("wired") or {}).get("ip")] + list(ing.get("ips") or []) if ip] for host, sessions in (inv.get("midi") or {}).items(): for sname, sess in (sessions or {}).items(): for p in sess.get("peers") or []: addr = p.get("address") or "" if not in_nets(nets, addr): alias = owner.get(p.get("name")) or computer_named(inv, p.get("name")) - ip = alias and next((i for i in comps[alias].get("ips") or [] if in_nets(nets, i)), None) + ips = ing_ips if alias == "ingest" else (comps.get(alias) or {}).get("ips") or [] if alias else [] + ip = next((i for i in ips if in_nets(nets, i)), None) if not ip: continue # no wired address known: the wired check will name it - port = (((inv.get("midi") or {}).get(alias) or {}).get(p.get("name")) or {}).get("port") or 5004 + port = (((inv.get("midi") or {}).get("" if alias == "ingest" else alias) or {}).get(p.get("name")) or {}).get("port") or 5004 addr = "%s:%d" % (ip, port) chk = {"type": "midi_peer", "session": sname, "peer": p["name"], "address": addr, "fix": "midi_reconnect", "tag": tag_for(p["name"])} @@ -320,7 +323,8 @@ def items(inv, nets): return any("state" in p for p in (((inv.get("midi") or {}).get(host) or {}).get(sname) or {}).get("peers") or []) by_pair = {} for ident, c in midi_checks: - other = owner.get(c["peer"]) or computer_by_ip(inv, ip_of(c["address"])) or c["peer"] + ip = ip_of(c["address"]) + other = owner.get(c["peer"]) or ("ingest" if ip and ip in ing_ips else None) or computer_by_ip(inv, ip) or c["peer"] pair = frozenset((end_of(c.get("host", "")), other)) best = by_pair.get(pair) if best is None or (reports_state(c.get("host", ""), c["session"]) and not reports_state(best[1].get("host", ""), best[1]["session"])): diff --git a/sites/ws/config.json b/sites/ws/config.json index e6836bf..2735a37 100644 --- a/sites/ws/config.json +++ b/sites/ws/config.json @@ -1,62 +1,6 @@ { - "site": { - "id": "ws", - "name": "Woonsocket", - "ingest_name": "WS ProPresenter", - "ingest_hostname": "WS-ProPresenter-3.local", - "ingest_ips": [ - "10.2.2.210", - "169.254.104.16" - ], - "contacts": "", - "live_services": [], - "editing_code": "9248" - }, - "companion": { - "host": "127.0.0.1", - "port": 8000 - }, - "page": 19, - "page_name": "19\\nStatus", - "page_hold_ms": 2000, - "variables": { - "state": "sp_state", - "heartbeat": "sp_hb", - "command": "sp_cmd" - }, - "timing": { - "fix_cooldown_seconds": 60, - "alert_after_seconds": 30 - }, "auto_fix": { "after_seconds": 20, - "max_tries": 2, - "retry_seconds": 90, - "pause_after_network_seconds": 60, - "restart_connections": true, - "windows": [ - { - "days": [ - "tue" - ], - "start": "14:00", - "end": "22:00" - }, - { - "days": [ - "wed" - ], - "start": "09:00", - "end": "21:00" - }, - { - "days": [ - "sun" - ], - "start": "05:00", - "end": "14:00" - } - ], "fixes": [ "superrack_ws_foh", "x32edit_ws_foh", @@ -64,384 +8,191 @@ "ableton_ws_tracks", "propresenter_ingest", "midi_reconnect" + ], + "max_tries": 2, + "pause_after_network_seconds": 60, + "restart_connections": true, + "retry_seconds": 90, + "windows": [ + { + "days": [ + "tue" + ], + "end": "22:00", + "start": "14:00" + }, + { + "days": [ + "wed" + ], + "end": "21:00", + "start": "09:00" + }, + { + "days": [ + "sun" + ], + "end": "14:00", + "start": "05:00" + } ] }, - "tiles": [ - { - "id": "all", - "label": "ALL", - "pos": [ - 0, - 1 - ], - "kind": "master" - }, - { - "id": "service", - "label": "ALARMS", - "pos": [ - 3, - 0 - ], - "kind": "service" - }, - { - "id": "net", - "label": "NET", - "pos": [ - 3, - 7 - ], - "kind": "network" - }, - { - "id": "superrack", - "label": "SUPERRACK", - "checks": [ - { - "type": "remote", - "template": "mac_program", - "params": { - "host": "ws_foh", - "process": "SuperRack SoundGrid" - }, - "msg": "SUPERRACK NOT RUNNING", - "fix": "superrack_ws_foh", - "host": "ws_foh", - "cmd": "pgrep -xq 'SuperRack SoundGrid'" - }, - { - "type": "remote", - "template": "soundgrid", - "params": { - "host": "ws_foh" - }, - "msg": "SOUNDGRID LOST", - "host": "ws_foh", - "cmd": "lsof -nP -iTCP -sTCP:ESTABLISHED -a -c SuperRack 2>/dev/null | grep -q ':19000 (ESTABLISHED)'" - } - ], - "pos": [ - 0, - 2 - ] - }, - { - "id": "x32_edit", - "label": "X32 EDIT", - "checks": [ - { - "type": "remote", - "template": "mac_program", - "params": { - "host": "ws_foh", - "process": "X32-Edit" - }, - "msg": "X32 EDIT NOT RUNNING", - "fix": "x32edit_ws_foh", - "host": "ws_foh", - "cmd": "pgrep -xq X32-Edit" - } - ], - "pos": [ - 0, - 3 - ] - }, - { - "id": "m32", - "label": "M32", - "checks": [ - { - "type": "conn", - "conn": "m32" - } - ], - "pos": [ - 0, - 4 - ] - }, - { - "id": "vista", - "label": "VISTA", - "checks": [ - { - "type": "remote", - "template": "mac_program", - "params": { - "host": "ws_lights", - "process": "Vista" - }, - "msg": "VISTA NOT RUNNING", - "fix": "vista_ws_lights", - "host": "ws_lights", - "cmd": "pgrep -xq Vista" - } - ], - "pos": [ - 0, - 5 - ] - }, - { - "id": "ableton", - "label": "ABLETON", - "checks": [ - { - "type": "remote", - "template": "mac_program", - "params": { - "host": "ws_tracks", - "process": "Live" - }, - "msg": "ABLETON NOT RUNNING", - "fix": "ableton_ws_tracks", - "host": "ws_tracks", - "cmd": "pgrep -xq Live" - } - ], - "pos": [ - 0, - 6 - ] - }, - { - "id": "prop", - "label": "PROP", - "checks": [ - { - "type": "conn", - "conn": "Propresenter-API" - }, - { - "type": "process", - "match": "/Applications/ProPresenter.app/Contents/MacOS/ProPresenter", - "name": "PROP", - "fix": "propresenter_ingest" - } - ], - "pos": [ - 0, - 7 - ] - }, - { - "id": "midi", - "label": "MIDI", - "checks": [ - { - "type": "midi_peer", - "session": "WS FOH Mac mini", - "peer": "WS Tracks", - "address": "10.2.1.219:5004", - "fix": "midi_reconnect", - "tag": "WS TRACKS", - "host": "ws_foh" - }, - { - "type": "midi_peer", - "session": "Lighting", - "peer": "WS Tracks", - "address": "10.2.1.219:5004", - "fix": "midi_reconnect", - "tag": "WS TRACKS", - "host": "ws_lights" - }, - { - "type": "midi_wired", - "nets": [ - "10.2.0.0/16" - ], - "fix": "midi_reconnect" - } - ], - "pos": [ - 1, - 1 - ] - }, - { - "id": "atem", - "label": "ATEM", - "checks": [ - { - "type": "conn", - "conn": "ATEM" - } - ], - "pos": [ - 1, - 2 - ] - }, - { - "id": "resi", - "label": "RESI", - "checks": [ - { - "type": "conn", - "conn": "Resi" - }, - { - "type": "ping", - "conn": "Resi" - } - ], - "pos": [ - 1, - 3 - ] - } - ], + "companion": { + "host": "127.0.0.1", + "port": 8000 + }, + "debounce_seconds": 3, + "discover": { + "auto": true + }, "fixes": { - "superrack_ws_foh": { - "template": "mac_start", - "params": { - "host": "ws_foh", - "process": "SuperRack SoundGrid", - "app": "/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app" - }, - "label": "start SuperRack on WS FOH if it is not running", - "short": "SUPERRACK", - "kind": "ssh", - "host": "ws_foh", - "run": "pgrep -xq 'SuperRack SoundGrid' || open '/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app'" - }, - "restart_superrack_ws_foh": { - "template": "mac_restart", - "params": { - "host": "ws_foh", - "process": "SuperRack SoundGrid", - "app": "/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app", - "wait_seconds": 10, - "force": true, - "background": false, - "stop_children": false, - "newest_of": "" - }, - "label": "restart SuperRack on WS FOH (closes it first)", - "short": "SUPERRACK", - "kind": "ssh", - "host": "ws_foh", - "run": "pkill -TERM -x 'SuperRack SoundGrid'; i=0; while pgrep -xq 'SuperRack SoundGrid' && [ $i -lt 20 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq 'SuperRack SoundGrid' && pkill -KILL -x 'SuperRack SoundGrid'; sleep 1; open '/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app'" - }, - "x32edit_ws_foh": { - "template": "mac_start", - "params": { - "host": "ws_foh", - "process": "X32-Edit", - "app": "/Applications/X32-Edit.app" - }, - "label": "start X32-Edit on WS FOH if it is not running", - "short": "X32 EDIT", - "kind": "ssh", - "host": "ws_foh", - "run": "pgrep -xq X32-Edit || open /Applications/X32-Edit.app" - }, - "vista_ws_lights": { - "template": "mac_start", - "params": { - "host": "ws_lights", - "process": "Vista", - "app": "/Applications/Vista.app" - }, - "label": "start Vista on WS Lights if it is not running", - "short": "VISTA", - "kind": "ssh", - "host": "ws_lights", - "run": "pgrep -xq Vista || open /Applications/Vista.app" - }, - "restart_vista_ws_lights": { - "template": "mac_restart", - "params": { - "host": "ws_lights", - "process": "Vista", - "app": "/Applications/Vista.app", - "wait_seconds": 10, - "force": true, - "background": false, - "stop_children": false, - "newest_of": "" - }, - "label": "restart Vista on WS Lights (closes it first)", - "short": "VISTA", - "kind": "ssh", - "host": "ws_lights", - "run": "pkill -TERM -x Vista; i=0; while pgrep -xq Vista && [ $i -lt 20 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq Vista && pkill -KILL -x Vista; sleep 1; open /Applications/Vista.app" - }, "ableton_ws_tracks": { - "template": "ableton", + "host": "ws_tracks", + "kind": "ssh", + "label": "start Ableton on WS Tracks if it is not running", "params": { - "host": "ws_tracks", "app": "Ableton Live 11 Suite", + "host": "ws_tracks", "restart": false, "wait_seconds": 15 }, - "label": "start Ableton on WS Tracks if it is not running", + "run": "pgrep -xq Live || { L=$(ls -td ~/Library/Preferences/Ableton/Live*/ | head -1); S=$(grep -a 'info: Loading document \"' \"${L}Log.txt\" | grep -v '/Templates/' | tail -1 | sed -E 's/^.*Loading document \"(.*)\"[^\"]*$/\\1/'); if [ -n \"$S\" ] && [ -f \"$S\" ]; then open -a 'Ableton Live 11 Suite' \"$S\"; else open -a 'Ableton Live 11 Suite'; fi; }", "short": "ABLETON", - "kind": "ssh", - "host": "ws_tracks", - "run": "pgrep -xq Live || { L=$(ls -td ~/Library/Preferences/Ableton/Live*/ | head -1); S=$(grep -a 'info: Loading document \"' \"${L}Log.txt\" | grep -v '/Templates/' | tail -1 | sed -E 's/^.*Loading document \"(.*)\"[^\"]*$/\\1/'); if [ -n \"$S\" ] && [ -f \"$S\" ]; then open -a 'Ableton Live 11 Suite' \"$S\"; else open -a 'Ableton Live 11 Suite'; fi; }" - }, - "restart_ableton_ws_tracks": { - "template": "ableton", - "params": { - "host": "ws_tracks", - "app": "Ableton Live 11 Suite", - "restart": true, - "wait_seconds": 15 - }, - "label": "restart Ableton on WS Tracks (closes it first)", - "short": "ABLETON", - "kind": "ssh", - "host": "ws_tracks", - "run": "L=$(ls -td ~/Library/Preferences/Ableton/Live*/ | head -1); S=$(grep -a 'info: Loading document \"' \"${L}Log.txt\" | grep -v '/Templates/' | tail -1 | sed -E 's/^.*Loading document \"(.*)\"[^\"]*$/\\1/'); pkill -TERM -x Live; i=0; while pgrep -xq Live && [ $i -lt 30 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq Live && pkill -KILL -x Live; sleep 1; if [ -n \"$S\" ] && [ -f \"$S\" ]; then open -a 'Ableton Live 11 Suite' \"$S\"; else open -a 'Ableton Live 11 Suite'; fi" - }, - "propresenter_ingest": { - "template": "mac_start", - "params": { - "host": "ingest", - "process": "ProPresenter", - "app": "/Applications/ProPresenter.app" - }, - "label": "start ProPresenter on this Mac if it is not running", - "short": "PROP", - "kind": "local", - "run": "pgrep -xq ProPresenter || open /Applications/ProPresenter.app" - }, - "restart_propresenter_ingest": { - "template": "mac_restart", - "params": { - "host": "ingest", - "process": "ProPresenter", - "app": "/Applications/ProPresenter.app", - "wait_seconds": 10, - "force": true, - "background": false, - "stop_children": false, - "newest_of": "" - }, - "label": "restart ProPresenter on this Mac (closes it first)", - "short": "PROP", - "kind": "local", - "run": "pkill -TERM -x ProPresenter; i=0; while pgrep -xq ProPresenter && [ $i -lt 20 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq ProPresenter && pkill -KILL -x ProPresenter; sleep 1; open /Applications/ProPresenter.app" + "template": "ableton" }, "midi_reconnect": { "kind": "midi_connect", - "template": "midi_connect", + "label": "reconnect the peer to the network MIDI session it dropped out of (like Connect in Audio MIDI Setup), at its wired address", "params": {}, "short": "RECONNECT", - "label": "reconnect the peer to the network MIDI session it dropped out of (like Connect in Audio MIDI Setup), at its wired address" + "template": "midi_connect" + }, + "propresenter_ingest": { + "kind": "local", + "label": "start ProPresenter on this Mac if it is not running", + "params": { + "app": "/Applications/ProPresenter.app", + "host": "ingest", + "process": "ProPresenter" + }, + "run": "pgrep -xq ProPresenter || open /Applications/ProPresenter.app", + "short": "PROP", + "template": "mac_start" + }, + "restart_ableton_ws_tracks": { + "host": "ws_tracks", + "kind": "ssh", + "label": "restart Ableton on WS Tracks (closes it first)", + "params": { + "app": "Ableton Live 11 Suite", + "host": "ws_tracks", + "restart": true, + "wait_seconds": 15 + }, + "run": "L=$(ls -td ~/Library/Preferences/Ableton/Live*/ | head -1); S=$(grep -a 'info: Loading document \"' \"${L}Log.txt\" | grep -v '/Templates/' | tail -1 | sed -E 's/^.*Loading document \"(.*)\"[^\"]*$/\\1/'); pkill -TERM -x Live; i=0; while pgrep -xq Live && [ $i -lt 30 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq Live && pkill -KILL -x Live; sleep 1; if [ -n \"$S\" ] && [ -f \"$S\" ]; then open -a 'Ableton Live 11 Suite' \"$S\"; else open -a 'Ableton Live 11 Suite'; fi", + "short": "ABLETON", + "template": "ableton" + }, + "restart_propresenter_ingest": { + "kind": "local", + "label": "restart ProPresenter on this Mac (closes it first)", + "params": { + "app": "/Applications/ProPresenter.app", + "background": false, + "force": true, + "host": "ingest", + "newest_of": "", + "process": "ProPresenter", + "stop_children": false, + "wait_seconds": 10 + }, + "run": "pkill -TERM -x ProPresenter; i=0; while pgrep -xq ProPresenter && [ $i -lt 20 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq ProPresenter && pkill -KILL -x ProPresenter; sleep 1; open /Applications/ProPresenter.app", + "short": "PROP", + "template": "mac_restart" + }, + "restart_superrack_ws_foh": { + "host": "ws_foh", + "kind": "ssh", + "label": "restart SuperRack on WS FOH (closes it first)", + "params": { + "app": "/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app", + "background": false, + "force": true, + "host": "ws_foh", + "newest_of": "", + "process": "SuperRack SoundGrid", + "stop_children": false, + "wait_seconds": 10 + }, + "run": "pkill -TERM -x 'SuperRack SoundGrid'; i=0; while pgrep -xq 'SuperRack SoundGrid' && [ $i -lt 20 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq 'SuperRack SoundGrid' && pkill -KILL -x 'SuperRack SoundGrid'; sleep 1; open '/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app'", + "short": "SUPERRACK", + "template": "mac_restart" + }, + "restart_vista_ws_lights": { + "host": "ws_lights", + "kind": "ssh", + "label": "restart Vista on WS Lights (closes it first)", + "params": { + "app": "/Applications/Vista.app", + "background": false, + "force": true, + "host": "ws_lights", + "newest_of": "", + "process": "Vista", + "stop_children": false, + "wait_seconds": 10 + }, + "run": "pkill -TERM -x Vista; i=0; while pgrep -xq Vista && [ $i -lt 20 ]; do sleep 0.5; i=$((i+1)); done; pgrep -xq Vista && pkill -KILL -x Vista; sleep 1; open /Applications/Vista.app", + "short": "VISTA", + "template": "mac_restart" + }, + "superrack_ws_foh": { + "host": "ws_foh", + "kind": "ssh", + "label": "start SuperRack on WS FOH if it is not running", + "params": { + "app": "/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app", + "host": "ws_foh", + "process": "SuperRack SoundGrid" + }, + "run": "pgrep -xq 'SuperRack SoundGrid' || open '/Applications/Waves/SuperRack SoundGrid/SuperRack SoundGrid.app'", + "short": "SUPERRACK", + "template": "mac_start" + }, + "vista_ws_lights": { + "host": "ws_lights", + "kind": "ssh", + "label": "start Vista on WS Lights if it is not running", + "params": { + "app": "/Applications/Vista.app", + "host": "ws_lights", + "process": "Vista" + }, + "run": "pgrep -xq Vista || open /Applications/Vista.app", + "short": "VISTA", + "template": "mac_start" + }, + "x32edit_ws_foh": { + "host": "ws_foh", + "kind": "ssh", + "label": "start X32-Edit on WS FOH if it is not running", + "params": { + "app": "/Applications/X32-Edit.app", + "host": "ws_foh", + "process": "X32-Edit" + }, + "run": "pgrep -xq X32-Edit || open /Applications/X32-Edit.app", + "short": "X32 EDIT", + "template": "mac_start" } }, + "gear": {}, "hosts": { "ingest": { - "self": true, "name": "WS ProPresenter", - "role": "the watchdog, Companion, the settings page", - "os": "mac", "networks": [], + "os": "mac", + "role": "the watchdog, Companion, the settings page", "runs": [ { "kind": "launchagent", @@ -454,114 +205,113 @@ "name": "the settings page" }, { + "http": "http://127.0.0.1:8000/api/connections", "kind": "app", - "process": "Companion", "name": "Companion", - "http": "http://127.0.0.1:8000/api/connections" + "process": "Companion" } - ] + ], + "self": true }, "ws_foh": { "name": "WS FOH", "os": "mac", - "ssh": "watersmedia@10.2.1.12", "role": "found by auto-setup", "runs": [ { "kind": "sshd" } - ] + ], + "ssh": "watersmedia@10.2.1.12" }, "ws_lights": { "name": "WS Lights", "os": "mac", - "ssh": "wslighting@10.2.2.2", "role": "found by auto-setup", "runs": [ { "kind": "sshd" } - ] + ], + "ssh": "wslighting@10.2.2.2" }, "ws_tracks": { "name": "WS Tracks", "os": "mac", - "ssh": "wstracks@10.2.1.219", "role": "found by auto-setup", "runs": [ { "kind": "sshd" } - ] + ], + "ssh": "wstracks@10.2.1.219" } }, - "gear": {}, - "debounce_seconds": 3, - "network": { - "interface": "en14", - "gateway": "10.2.0.1", - "burst_connections": 4, - "burst_groups": 3, - "burst_window_seconds": 10, - "remember_seconds": 300 - }, + "nav_hold_ms": 1000, "nav_keys": [ "pagenum" ], - "nav_hold_ms": 1000, "nav_tap_page": 1, - "discover": { - "auto": true + "network": { + "burst_connections": 4, + "burst_groups": 3, + "burst_window_seconds": 10, + "gateway": "10.2.0.1", + "interface": "en14", + "remember_seconds": 300 }, + "page": 19, + "page_hold_ms": 2000, + "page_name": "19\\nStatus", "restart_page": { - "page": 20, - "page_name": "20\\nRestart", - "jump_pos": [ - 3, - 6 - ], "back_pos": [ 3, 0 ], + "jump_pos": [ + 3, + 6 + ], "keys": [ { + "fix": "restart_superrack_ws_foh", "id": "rs_superrack", "label": "SUPERRACK", - "fix": "restart_superrack_ws_foh", "pos": [ 0, 1 ] }, { + "fix": "restart_vista_ws_lights", "id": "rs_vista", "label": "VISTA", - "fix": "restart_vista_ws_lights", "pos": [ 0, 2 ] }, { + "fix": "restart_ableton_ws_tracks", "id": "rs_ableton", "label": "ABLETON", - "fix": "restart_ableton_ws_tracks", "pos": [ 0, 3 ] }, { + "fix": "restart_propresenter_ingest", "id": "rs_prop", "label": "PROP", - "fix": "restart_propresenter_ingest", "pos": [ 0, 4 ] } - ] + ], + "page": 20, + "page_name": "20\\nRestart" }, "service_windows": [ { @@ -574,8 +324,266 @@ "sat", "sun" ], - "start": "00:00", - "end": "23:59" + "end": "23:59", + "start": "00:00" } - ] + ], + "site": { + "contacts": "", + "editing_code": "9248", + "id": "ws", + "ingest_hostname": "WS-ProPresenter-3.local", + "ingest_ips": [ + "10.2.2.210", + "169.254.104.16" + ], + "ingest_name": "WS ProPresenter", + "live_services": [], + "name": "Woonsocket" + }, + "tiles": [ + { + "id": "all", + "kind": "master", + "label": "ALL", + "pos": [ + 0, + 1 + ] + }, + { + "id": "service", + "kind": "service", + "label": "ALARMS", + "pos": [ + 3, + 0 + ] + }, + { + "id": "net", + "kind": "network", + "label": "NET", + "pos": [ + 3, + 7 + ] + }, + { + "checks": [ + { + "cmd": "pgrep -xq 'SuperRack SoundGrid'", + "fix": "superrack_ws_foh", + "host": "ws_foh", + "msg": "SUPERRACK NOT RUNNING", + "params": { + "host": "ws_foh", + "process": "SuperRack SoundGrid" + }, + "template": "mac_program", + "type": "remote" + }, + { + "cmd": "lsof -nP -iTCP -sTCP:ESTABLISHED -a -c SuperRack 2>/dev/null | grep -q ':19000 (ESTABLISHED)'", + "host": "ws_foh", + "msg": "SOUNDGRID LOST", + "params": { + "host": "ws_foh" + }, + "template": "soundgrid", + "type": "remote" + } + ], + "id": "superrack", + "label": "SUPERRACK", + "pos": [ + 0, + 2 + ] + }, + { + "checks": [ + { + "cmd": "pgrep -xq X32-Edit", + "fix": "x32edit_ws_foh", + "host": "ws_foh", + "msg": "X32 EDIT NOT RUNNING", + "params": { + "host": "ws_foh", + "process": "X32-Edit" + }, + "template": "mac_program", + "type": "remote" + } + ], + "id": "x32_edit", + "label": "X32 EDIT", + "pos": [ + 0, + 3 + ] + }, + { + "checks": [ + { + "conn": "m32", + "type": "conn" + } + ], + "id": "m32", + "label": "M32", + "pos": [ + 0, + 4 + ] + }, + { + "checks": [ + { + "cmd": "pgrep -xq Vista", + "fix": "vista_ws_lights", + "host": "ws_lights", + "msg": "VISTA NOT RUNNING", + "params": { + "host": "ws_lights", + "process": "Vista" + }, + "template": "mac_program", + "type": "remote" + } + ], + "id": "vista", + "label": "VISTA", + "pos": [ + 0, + 5 + ] + }, + { + "checks": [ + { + "cmd": "pgrep -xq Live", + "fix": "ableton_ws_tracks", + "host": "ws_tracks", + "msg": "ABLETON NOT RUNNING", + "params": { + "host": "ws_tracks", + "process": "Live" + }, + "template": "mac_program", + "type": "remote" + } + ], + "id": "ableton", + "label": "ABLETON", + "pos": [ + 0, + 6 + ] + }, + { + "checks": [ + { + "conn": "Propresenter-API", + "type": "conn" + }, + { + "fix": "propresenter_ingest", + "match": "/Applications/ProPresenter.app/Contents/MacOS/ProPresenter", + "name": "PROP", + "type": "process" + } + ], + "id": "prop", + "label": "PROP", + "pos": [ + 0, + 7 + ] + }, + { + "checks": [ + { + "address": "10.2.1.219:5004", + "fix": "midi_reconnect", + "host": "ws_foh", + "peer": "WS Tracks", + "session": "WS FOH Mac mini", + "tag": "WS TRACKS", + "type": "midi_peer" + }, + { + "address": "10.2.1.219:5004", + "fix": "midi_reconnect", + "host": "ws_lights", + "peer": "WS Tracks", + "session": "Lighting", + "tag": "WS TRACKS", + "type": "midi_peer" + }, + { + "address": "10.2.2.2:5004", + "fix": "midi_reconnect", + "peer": "Lighting", + "session": "ProPresenter", + "tag": "PROP LIGHTS", + "type": "midi_peer" + }, + { + "fix": "midi_reconnect", + "nets": [ + "10.2.0.0/16" + ], + "type": "midi_wired" + } + ], + "id": "midi", + "label": "MIDI", + "pos": [ + 1, + 1 + ] + }, + { + "checks": [ + { + "conn": "ATEM", + "type": "conn" + } + ], + "id": "atem", + "label": "ATEM", + "pos": [ + 1, + 2 + ] + }, + { + "checks": [ + { + "conn": "Resi", + "type": "conn" + }, + { + "conn": "Resi", + "type": "ping" + } + ], + "id": "resi", + "label": "RESI", + "pos": [ + 1, + 3 + ] + } + ], + "timing": { + "alert_after_seconds": 30, + "fix_cooldown_seconds": 60 + }, + "variables": { + "command": "sp_cmd", + "heartbeat": "sp_hb", + "state": "sp_state" + } } diff --git a/tests/test_campus.py b/tests/test_campus.py index 60ec53d..27463ee 100644 --- a/tests/test_campus.py +++ b/tests/test_campus.py @@ -133,6 +133,16 @@ class TestBuild(unittest.TestCase): cfg, _ = ac.build(BASE, inv, {"id": "ws", "name": "Woonsocket"}, "1234") midi = next(t for t in cfg["tiles"] if t["label"] == "MIDI") got = sorted((c.get("host"), c["peer"], c["address"]) for c in midi["checks"] if c["type"] == "midi_peer") + inv["midi"][""] = {"ProPresenter": {"port": 5004, "peers": [{"name": "Lighting", "address": "10.4.2.2:5006", "state": "running"}]}} + inv["midi"]["lights"]["Lighting"]["peers"].append({"name": "ProPresenter", "address": "10.4.1.1:5004", "state": "running"}) + cfg, _ = ac.build(BASE, inv, {"id": "ws", "name": "Woonsocket"}, "1234") + midi = next(t for t in cfg["tiles"] if t["label"] == "MIDI") + pairs = [(c.get("host"), c["peer"]) for c in midi["checks"] if c["type"] == "midi_peer"] + self.assertEqual(len([p for p in pairs if "ProPresenter" in p or ("lights" not in p and "Lighting" in p and None in p)]), 1) # the Companion Mac's link counted once + inv["midi"][""] = {} + inv["midi"]["lights"]["Lighting"]["peers"].pop() + cfg, _ = ac.build(BASE, inv, {"id": "ws", "name": "Woonsocket"}, "1234") + midi = next(t for t in cfg["tiles"] if t["label"] == "MIDI") # One check per link: Tracks-Lights from Lights (it reports the state), Tracks-FOH from one end only. self.assertEqual(got, [("lights", "WS Tracks", "10.4.1.219:5004"), ("tracks", "WS FOH Mac mini", "10.4.1.12:5004")]) self.assertEqual(schema.validate(cfg)[0], [])