3. OS이야기/03. Shell Script

시스템에서 사용중인 PCI Slot 할당 내역 조회 스크립트

OSSW(Open Source System SoftWare 2014. 7. 17. 10:04

시스템에 할당되어 있는 PCI Slot의 사용내역을 확인하는 스크립트 입니다.

 

SLot별로 어떤 Device가 연결되어 있는지 직관적으로 파악이 가능합니다.

 

 

1. 스크립트 (slot.sh)

-----------------------------------------------------------------

#!/bin/sh

 

cnt=1

 

NET_DIR="/sys/class/net"

DISK_DIR="/sys/class/scsi_disk"

TAPE_DIR="/sys/class/scsi_tape"

 

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 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)

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 etwork Connection (rev 01)

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 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)

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 etwork Connection (rev 01)

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 NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01) 03:00.2 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01) 03:00.3 Ethe rnet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)

eth4

eth5

eth6

eth7

>> Slot8 02:00.0 RAID bus controller: Hewlett-Packard Company Device 323b (rev 01)

 

 

 

by 이찬호