From a37484a5ff9976eabdb094c44f910c05b42a5bc4 Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Tue, 13 Dec 2016 18:31:14 -0600 Subject: [PATCH] Correcciones a scanners de discos y de red --- scripts/scan-dmidecode | 12 ++++++++++-- scripts/scan-hdd | 17 ++++++++++------- scripts/scan-netdev | 8 ++++++-- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/scripts/scan-dmidecode b/scripts/scan-dmidecode index 1351c3c..55c9a94 100755 --- a/scripts/scan-dmidecode +++ b/scripts/scan-dmidecode @@ -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/ +} + diff --git a/scripts/scan-hdd b/scripts/scan-hdd index 197f111..a294ac9 100755 --- a/scripts/scan-hdd +++ b/scripts/scan-hdd @@ -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 diff --git a/scripts/scan-netdev b/scripts/scan-netdev index 850e74a..3ec7c82 100755 --- a/scripts/scan-netdev +++ b/scripts/scan-netdev @@ -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