I think I would probably use Indigo's RESTful API and Python to accomplish this. There are likely ways to add more robustness, but you could start with a broadcast method--any time a server's occupied status changes, it could broadcast its status to the other servers. Here's one way.
Each server has four variables: 'server1_occupied', 'server2_occupied', 'server3_occupied, server4_occupied.
Server 1 runs a trigger when 'server1_occupied' changes.
Trigger runs a short Python script to broadcast its status to the other servers (recommend using a linked script and not an embedded script)
- Code: Select all
import requests
from requests.auth import HTTPDigestAuth
server_list = ['10.0.1.2', '10.0.1.3', '10.0.1.4']
username = 'USERNAME'
password = 'PASSWORD'
status = indigo.variables['server1_occupied'].value
for server in server_list:
url = 'http://{0}:8176/variables/server1_occupied?_method=put&value={1}'.format(server, status)
result = requests.get(url, auth=HTTPDigestAuth(username, password))
indigo.server.log(str(result.status_code))
If each server has different log in credentials, you'll need to amend the script to account for that. Also, this method stores the username and password in clear text within the script, so take that into account for your security situation (and presumes you're requiring a username and password on each server in the first place). The code above may need a bit of tweaking to account for response times, although I believe that the requests module is blocking until a response is received (so it might be fine).
The code is untested, but should be pretty close. If there are problems, post back; I'm happy to help debug.