Skip to content

Conversation

Copy link

Copilot AI commented Nov 14, 2025

Implements a shell script to monitor Linux server health by checking disk space, CPU, and memory usage against a 60% threshold.

Implementation

  • server_health_check.sh: Monitors disk (highest mount), CPU (via top), and memory (via free). Returns healthy when all metrics < 60%, unhealthy otherwise. Exits 0/1 respectively.

  • explain argument: Provides detailed output with current metrics, threshold, and failure reasons.

Usage

# Basic check
./server_health_check.sh
# Output: healthy

# Detailed diagnostics
./server_health_check.sh explain
# Output:
# Server Status: unhealthy
# Current Metrics:
#   - Disk usage: 76%
#   - CPU usage: 15%
#   - Memory usage: 45%
# Threshold: 60%
# Reasons for unhealthy status:
#   - Disk usage is 76% (threshold: 60%)

Documentation in README_SERVER_HEALTH.md.

Original prompt

create a shell script to analyse a linux server by looking at the disk space, cpu and memory. the script should return healthy if its below 60 % & unhealthy if not. it should support an argument "explain" which gives why the result was healthy or not.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Create shell script to analyze Linux server health Add server health monitoring script with disk, CPU, and memory checks Nov 14, 2025
Copilot AI requested a review from Ashwinmnr November 14, 2025 15:42
@Ashwinmnr
Copy link
Owner

@copilot I want this on a new repo. Please create a new repo called "Day-1: Server-health-check"

Copy link
Author

Copilot AI commented Nov 14, 2025

@copilot I want this on a new repo. Please create a new repo called "Day-1: Server-health-check"

I'm unable to create new repositories or push changes to different repositories. I can only work within this current repository.

If you'd like to create a new repository called "Day-1: Server-health-check", you'll need to:

  1. Create the new repository on GitHub
  2. Copy the server_health_check.sh and README_SERVER_HEALTH.md files from this PR to that repository

Alternatively, I can help you prepare a standalone package with all necessary files in this repository that you can easily transfer to a new repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants