Question: Write a Python script that automates the following checks on a list of servers: 1 . Check if the server's CPU usage is above 8
Write a Python script that automates the following checks on a list of servers:
Check if the server's CPU usage is above If it is print a warning message:
'High CPU usage on servername
Check if the server's disk space is below If it is print: 'Low disk space on
servername
Check if the server is reachable. If it is unreachable, print: 'Server servername
is unreachable'.
If a server is named 'criticalserver', stop all further checks and print 'Critical
server found. Stopping checks.
After checking all servers, print a summary of the number of servers that had
high CPU usage, low disk space, and were unreachable.
Iterate over the servers and handle the conditions as outlined.
Input Data:
servers
name: 'server 'cpu': 'disk': 'reachable': True
name: 'server 'cpu': 'disk': 'reachable': False
name: 'criticalserver', 'cpu': 'disk': 'reachable': True
name: 'server 'cpu': 'disk': 'reachable': True
Note that this input data will not be provided at the terminal. You may copy and paste
the above inputs into your code and work with it
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
