Shell script to perform a Health Check of the Linux Server

In this post, I am sharing a shell script which will create a HTML output for a Linux OEL server health check.

You can change and Modify as per your needs. The script will generate a file named as server_health_report.html

[root@standby ~]# ls -ltr
total 8
-rw-r--r--. 1 root root 1177 Jun 22 04:25
-rw-r--r--. 1 root root 3262 Jun 22 04:25 server_health_report.html



# Output file for the health check report

# Function to generate formatted HTML report
generate_report() {
  echo "<html>
    <title>Server Health Check Report</title>
      body {
        font-family: Arial, sans-serif;
        margin: 20px;
      h1, h2, h3 {
        color: #333;
      table {
        border-collapse: collapse;
        width: 100%;
      th, td {
        padding: 8px;
        text-align: left;
        border-bottom: 1px solid #ddd;
    <h1>Server Health Check Report</h1>
    <h2>Date: $(date)</h2>

    <h3>System Information</h3>
      <tr><th>Kernel Version</th><td>$(uname -r)</td></tr>
      <tr><th>Uptime</th><td>$(uptime -p)</td></tr>

    <h3>CPU Information</h3>

    <h3>Memory Information</h3>
    <pre>$(free -h)</pre>

    <h3>Disk Usage</h3>
    <pre>$(df -h)</pre>
  </html>" >"$OUTPUT_FILE"

  echo "Server health check report generated: $OUTPUT_FILE"

# Main script

Output Format Screenshot:

If you like please follow and comment