Answered step by step
Verified Expert Solution
Link Copied!

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. (10 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:
1. Disk Usage Monitoring: The script should check the disk usage of the server and send an alert if
the usage exceeds a certain threshold (e.g.,30%).
2. CPU Usage Monitoring: Monitor CPU usage and send an alert if the CPU usage exceeds a specified
threshold (e.g.,30%).
3. Memory Usage Monitoring: Monitor memory (RAM) usage and send an alert if the available
memory falls below a specified threshold (e.g.,10% free).
4. Log Rotation: Implement log rotation for a specified log file, ensuring that it does not grow beyond
a certain size (e.g.,10MB).
Requirements:
1. Create a shell script named server_monitor.sh.
2. Implement the tasks mentioned in the scenario.
3. The script should log all activities and alerts to a log file.
4. You should use conditional statements (if-else) to check thresholds and generate alerts.
5. Use appropriate commands and tools (e.g., df, top, ps, tar, logrotate, etc.) to achieve the tasks.
6. Ensure that your script is well-commented to explain the purpose of each section.
7. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions