Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started