Question: You will create a shell script for this project to automate the management and monitoring of server resources. You will be given a scenario in
You will create a shell script for this project to automate the management and monitoring of server
resources. You will be given a scenario in which you must write a script to carry out various server resource
management and monitoring duties. Marks
Scenario Description:
Imagine you are a system administrator responsible for managing a group of Linux servers. Your task is to
create a shell script that will help you perform the following tasks:
Disk Usage Monitoring: The script should check the disk usage of the server and send an alert if
the usage exceeds a certain threshold eg
CPU Usage Monitoring: Monitor CPU usage and send an alert if the CPU usage exceeds a specified
threshold eg
Memory Usage Monitoring: Monitor memory RAM usage and send an alert if the available
memory falls below a specified threshold eg free
Log Rotation: Implement log rotation for a specified log file, ensuring that it does not grow beyond
a certain size egMB
Requirements:
Create a shell script named servermonitor.sh
Implement the tasks mentioned in the scenario.
The script should log all activities and alerts to a log file.
You should use conditional statements ifelse to check thresholds and generate alerts.
Use appropriate commands and tools eg df top, ps tar, logrotate etc. to achieve the tasks.
Ensure that your script is wellcommented to explain the purpose of each section.
Include error handling to gracefully handle any potential issues that may arise during script
execution.
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
