0% found this document useful (0 votes)
18 views1 page

Ecc

Uploaded by

r19512695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Ecc

Uploaded by

r19512695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

nano check_ecc.

sh

#!/bin/bash

# Check if the required directory exists


OUTPUT_DIR="./"
OUTPUT_FILE="${OUTPUT_DIR}eccerror.txt"

# Clear previous output


echo "" > "$OUTPUT_FILE"

# Check if dmidecode is installed


if ! command -v dmidecode &> /dev/null; then
echo "dmidecode is not installed on this node." >> "$OUTPUT_FILE"
echo "Unable to retrieve memory serial numbers." >> "$OUTPUT_FILE"
exit 1
fi

# Check for ECC errors using dmidecode


echo "Checking for ECC errors..."

# Get the memory details


MEMORY_INFO=$(dmidecode --type memory)

# Check for ECC errors


if echo "$MEMORY_INFO" | grep -q "Error Correction Type: Multi-bit ECC"; then
echo "ECC Errors detected!" >> "$OUTPUT_FILE"

# Extract relevant information and serial numbers


echo "$MEMORY_INFO" | awk '/^Handle/,/^}.*$/' >> "$OUTPUT_FILE"
echo "Serial numbers of memory modules:" >> "$OUTPUT_FILE"
echo "$MEMORY_INFO" | grep "Serial Number:" >> "$OUTPUT_FILE"

# Print a message with details


echo "ECC error details written to $OUTPUT_FILE"
else
echo "No ECC errors detected." >> "$OUTPUT_FILE"

# If no ECC errors, still log the serial numbers


echo "Serial numbers of memory modules:" >> "$OUTPUT_FILE"
echo "$MEMORY_INFO" | grep "Serial Number:" >> "$OUTPUT_FILE"
fi

./check_ecc.sh

sudo ./check_ecc.sh

You might also like