Normally it should happen automatically for events SYS_NODE_DOWN if topology is known to the server. If server is able to determine route from itself to unreachable node, it will check all intermediate nodes, and generate SYS_NODE_DOWN only for router closest to the server, and SYS_NODE_UNREACHABLE for nodes down the line.
For more complex logic you can use script filters - all kind of topology information is available in scripts, so you can filter events based on peer nodes, routing information, etc.
Best regards,
Victor