Discover system health using Fabric

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' ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.