@@ -1,8 +1,8 @@
#!/bin/bash
# Inventory System
# Author: Carsten Schoene
-# $LastChangedDate: 2012-07-21 11:27:04 +0200 (Sat, 21 Jul 2012) $
-# $Rev: 1623 $
+# $LastChangedDate: 2012-07-21 12:05:42 +0200 (Sat, 21 Jul 2012) $
+# $Rev: 1624 $
#
# Default options (can be changed by inventory-system.conf)
DEBUG="yes"
@@ -257,39 +257,53 @@
# get ipmi mac
function get_system_mgmt_mac {
- ${MODPROBE} ipmi_devintf 2&>1 >/dev/null
- ${MODPROBE} ipmi_si 2&>1 >/dev/null
- if [ $? == 0 ] ; then
- ${IPMITOOL} lan print 2&>1 >/dev/null
- if [ $? == 0 ] ; then
- MAC=`${IPMITOOL} lan print 1 | ${GREP} -E '(^MAC Address)' | ${AWK} '{print tolower($NF)}' | \
- ${GREP} -i -E '([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})'`
- fi
- if [ -z "${MAC}" ] ; then
+ case `get_system_type` in
+ xen-dom0|baremetal)
+ ${MODPROBE} ipmi_devintf 2&>1 >/dev/null
+ ${MODPROBE} ipmi_si 2&>1 >/dev/null
+ if [ $? == 0 ] ; then
+ ${IPMITOOL} lan print 2&>1 >/dev/null
+ if [ $? == 0 ] ; then
+ MAC=`${IPMITOOL} lan print 1 | ${GREP} -E '(^MAC Address)' | ${AWK} '{print tolower($NF)}' | \
+ ${GREP} -i -E '([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})'`
+ fi
+ if [ -z "${MAC}" ] ; then
+ MAC="none"
+ fi
+ else
+ MAC="none"
+ fi
+ ;;
+ *)
MAC="none"
- fi
- else
- MAC="none"
- fi
+ ;;
+ esac
debug "SYSTEM-MGMT-MAC: ${MAC}"
echo ${MAC}
}
# get ipmi ip
function get_system_mgmt_ip {
- ${MODPROBE} ipmi_devintf 2&>1 >/dev/null
- ${MODPROBE} ipmi_si 2&>1 >/dev/null
- if [ $? == 0 ] ; then
- ${IPMITOOL} lan print 1 2&>1 >/dev/null
- if [ $? == 0 ] ; then
- MGMTIP=`${IPMITOOL} lan print 1 | ${GREP} -E '(^IP Address) ' | ${AWK} '{print $NF}'`
- fi
- if [ -z "${MGMTIP}" ] ; then
+ case `get_system_type` in
+ xen-dom0|baremetal)
+ ${MODPROBE} ipmi_devintf 2&>1 >/dev/null
+ ${MODPROBE} ipmi_si 2&>1 >/dev/null
+ if [ $? == 0 ] ; then
+ ${IPMITOOL} lan print 1 2&>1 >/dev/null
+ if [ $? == 0 ] ; then
+ MGMTIP=`${IPMITOOL} lan print 1 | ${GREP} -E '(^IP Address) ' | ${AWK} '{print $NF}'`
+ fi
+ if [ -z "${MGMTIP}" ] ; then
+ MGMTIP="none"
+ fi
+ else
+ MGMTIP="none"
+ fi
+ ;;
+ *)
MGMTIP="none"
- fi
- else
- MGMTIP="none"
- fi
+ ;;
+ esac
debug "SYSTEM-MGMT-IP: ${MGMTIP}"
echo ${MGMTIP}
}
|