시스템에 할당되어 있는 PCI Slot의 사용내역을 확인하는 스크립트 입니다.
SLot별로 어떤 Device가 연결되어 있는지 직관적으로 파악이 가능합니다.
1. 스크립트 (slot.sh)
------------------------------
#!/bin/sh
cnt=1
NET_DIR="/sys/class/net"
DISK_DIR="/sys/class/scsi_
TAPE_DIR="/sys/class/scsi_
clear
echo "#############################
echo -n "HOSTNAME :"
hostname
dmidecode | grep "Product Name"
echo "#############################
for i in `dmidecode | grep Bus | grep -v Type | sed -e 's/0000://' | sed -e 's/\.0//' | awk '{print $3}'`
do
BUS=`lspci | grep $i`
echo ">> Slot"$cnt " " $BUS
ls -al $NET_DIR | grep $i | awk '{print " " $9}'
ls -al $DISK_DIR | grep $i | awk '{print " " $9}'
ls -al $TAPE_DIR | grep $i | awk '{print " " $9}' | grep nst
cnt=$(($cnt+1))
done
------------------------------
2. 수행결과
##############################
HOSTNAME :OOO DB1
Product Name: ProLiant DL380p Gen8
##############################
>> Slot1 04:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01) 04:00.1 Ethernet controller: Intel Corporation
eth8
eth9
>> Slot2 07:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 07:00.1 Ethernet controller: Intel Corporation I350 Gigabit N
eth0
eth1
>> Slot3 0a:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03) 0a:00.1 Fibre Channel: Emulex Corporation Saturn-X : LightPulse Fibre Channel Host Adapter (rev 03)
nst0
nst1
nst2
nst3
nst4
>> Slot4 21:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01) 21:00.1 Ethernet controller: Intel Corporation
eth10
eth11
>> Slot5 24:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 24:00.1 Ethernet controller: Intel Corporation I350 Gigabit N
eth2
eth3
>> Slot6 27:00.0 Fibre Channel: Emulex Corporation Saturn-X: LightPulse Fibre Channel Host Adapter (rev 03) 27:00.1 Fibre Channel: Emulex Corporation Saturn-X : LightPulse Fibre Channel Host Adapter (rev 03)
nst5
nst6
nst7
nst8
nst9
>> Slot7 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01) 03:00.1 Ethernet controller: Broadcom Corporation
eth4
eth5
eth6
eth7
>> Slot8 02:00.0 RAID bus controller: Hewlett-Packard Company Device 323b (rev 01)
by 이찬호
'3. OS이야기 > 03. Shell Script' 카테고리의 다른 글
[UNIX/LINUX] 1분 단위 netstat 상태값 로깅 스크립트 (0) | 2014.08.01 |
---|---|
[UNIX/LINUX] File Size 체크 스크립트 (0) | 2014.07.01 |
linux 전체 파일시스템 용량 및 사용량 확인 스크립트 (2) | 2014.06.18 |
[UNIX/LINUX] 파일시스템 사용량 체크 스크립트 (0) | 2014.06.05 |
History에 날짜 넣기 !!! (0) | 2014.05.29 |