def stop(name): """ Start a new named measure session in background on all interested hosts. As for the start function, the hosts are retrieved from the interfaces setting directive and the stop command issued on each one. """ for host, interfaces in map_interfaces(): with shell.workon(host): for i in interfaces: tshark.stop(name, i)
def start(name): """ Start a new named measure session in background on all interested hosts. The hosts are retrieved from the ROLES setting directive and a measure is started for each one. """ dest = settings.PATHS["local-measures"][1] fltr = settings.CAPTURE_FILTER for host, interfaces in map_interfaces(): with shell.workon(host): shell.remote("rm -rf {0} ; mkdir {0}".format(dest), sudo=True) for i in interfaces: mname = "{0}.{1}".format(name, i) tshark.start(mname, i, "{0}/{1}.raw".format(dest, mname), fltr)