In this use case, we will utilize Fabric to develop a script that executes multiple commands on remote machines. The goal of the script is to gather two types of output: the discovery command and the health command. The discovery command gathers the uptime, hostname, kernel release, and both private and public IP addresses, while the health command gathers the used memory, CPU utilization, number of spawned processes, and disk usage. We will design fabfile so that we can scale our script and add more commands to it:
#!/usr/bin/python__author__ = "Bassim Aly"__EMAIL__ = "basim.alyy@gmail.com"from fabric.api import *from fabric.context_managers import *from pprint import pprintenv.hosts = [ '10.10.10.140' ...