I am still working on the idea, but this is the "problem" as of now.
I have 'n' machines tasked with pinging two addresses.
All machines:
Say: Address 1 and address 2.
If Address 1 is not ping-able, address 2 is Unknown.
Address status is ONLINE, OFFLINE, UNKNOWN.
I sort of have how each device does this, but I am not 100% sure just yet. It is still "work in progress".
All three devices then send their data back to a device. (One of the three, but I don't think that has any bearing on the problem, so to keep things separated, I'll say another machine.)
This other machine gets the 3 lots of messages from the devices and needs to then pick the "best" one and display it.
So, say:
Machine 1: ONLINE, OFFLINE
Machine 2: OFFLINE, UNKNOWN
Machine 3 ONLINE, UNKNOWN
I want to see Machine 1's messge.
I think it is something like (either) assigning a priority or weight to the messages.
As I see it, it is like this: ONLINE - Highest weight. OFFLINE - second. UNKNOWN - third.
Also - yeah, I know.... - I want to save any message in the event any of the machines can't send their message back to the main one.
I've seen this msg.queue
node (this one) but I am not quite getting how it works.
I am not understand how the connected
and disconnected
parts are detected.
So back to what I want to do.
I just thought that rather than all machines send two messages of the state, the messages are combined into one and sent, making it a bit easier (?well....) on the fourth.
It only needs to parse one message to determine the weight of that one to then compare to the others.
Then there is the case of two or three have the same weight. Who gets priority?
In that case I guess it can be the first one in the list of received messages.
Thanks in advance.