Handy snippet of Python Fabric code to accumulate results  over multiple hosts and combine the output and collect the totals

The example below is a toy example that demonstrates how to do a fan out-in with fabric to collect the results into a single method for aggregation of stats or information on a series of remote machines.

The example connects to multiple remote servers and returns back the number of ESTABLISHED connections on the target servers via lsof.

Results