Correcciones a scanners de discos y de red

This commit is contained in:
Sandino Araico Sanchez 2016-12-13 18:31:14 -06:00
parent 168c12784f
commit a37484a5ff
3 changed files with 26 additions and 11 deletions

View file

@ -2,11 +2,19 @@
MY_SERIAL=`dmidecode -s chassis-serial-number`
MY_DATETIME=`date +%Y-%m-%d_%H-%M-%S`
OUTPUT_DIR=/output/hwtests/$MY_SERIAL/$MY_DATETIME
OUTPUT_HOME=/output/hwtests
OUTPUT_DIR=$OUTPUT_HOME/$MY_SERIAL
SNAPSHOT_D=$OUTPUT_HOME/snapshot/$MY_SERIAL/$MY_DATETIME
export OUTPUT_DIR
mkdir -vp $OUTPUT_DIR
export SNAPSHOT_D
mkdir -p $OUTPUT_DIR
if [ ! -f $OUTPUT_DIR/dmidecode ] ; then
dmidecode > $OUTPUT_DIR/dmidecode
fi
function snapshot {
mkdir -vp $SNAPSHOT_D
cp -af $OUTPUT_DIR/* $SNAPSHOT_D/
}

View file

@ -4,15 +4,18 @@ if [ -z $OUTPUT_DIR ] ; then
source scan-dmidecode
fi
DISKS=`smartctl --scan | cut -d ' ' -f 1`
DISKS=/dev/sdb
for DISK in ${DISKS}
echo "#DEV:SERIAL" > $OUTPUT_DIR/disk.lst
for BLKDEV in /sys/block/sd*
do
echo -n "$DISK:" >> $OUTPUT_DIR/disk.lst
smartctl -i $DISK \
DISK=`basename $BLKDEV`
SERIAL=`smartctl -i /dev/$DISK \
| grep -i 'serial number' \
| cut -d ':' -f 2 \
| sed 's/\s\+//' \
>> $OUTPUT_DIR/disk.lst
| sed 's/\s\+//' `
if [ ! -z $SERIAL ] ; then
#echo "$DISK:$SERIAL"
echo "$DISK:$SERIAL" \
>> $OUTPUT_DIR/disk.lst
fi
done

View file

@ -4,10 +4,14 @@ if [ -z $OUTPUT_DIR ] ; then
source scan-dmidecode
fi
echo "#DEV MA:CA:DD:RE:SS" > $OUTPUT_DIR/netdev.lst
for DEV in \
`cat /proc/net/dev | grep ':' | cut -d ':' -f 1`
do
echo -n "$DEV " >> $OUTPUT_DIR/netdev.lst
ethtool -P $DEV >> $OUTPUT_DIR/netdev.lst
MAC=`ethtool -P $DEV | cut -d ':' -f 2-9 | sed 's/\s\+//g'`
if [ "$MAC" != "00:00:00:00:00:00" ] ; then
echo "$DEV $MAC"
echo "$DEV $MAC" >> $OUTPUT_DIR/netdev.lst
fi
done