Changes of Revision 30
[-] | Changed | _service:set_version:inventory-system.spec |
1
2 %define pkgname inventory-system 3 Name: inventory-system 4 Release: 0 5 -Version: 0.0.rev1484 6 +Version: 0.0.rev1486 7 Url: http://www.linux-administrator.com/ 8 License: GPLv2 9 Group: System 10 |
||
[+] | Changed | _service:recompress:tar_scm:inventory-system-0.0.rev1486.tar.bz2/client/inventory-system.sh ^ |
@@ -114,17 +114,45 @@ ${ETHTOOL} ${IFACE} | ${GREP} -i "Link detected:" | ${AWK} '{print tolower($NF)}' } +# get system type +function get_system_type { + RETVAL=`${VIRTWHAT}` + if [ $? == 0 ] ; then + TYPE=`${VIRTWHAT} | ${TAIL} -n1` + if [ "${TYPE}" == "" ] ; then + TYPE="baremetal" + fi + debug "SYSTEM-TYOE: ${TYPE}" + echo ${TYPE} + else + debug "VIRT-WHAT ERROR: ${RETVAL}" + fi +} + # get system cpu type function get_system_cpu { - ${LSHW} -quiet -C processor | ${GREP} "version:" | ${AWK} -F"version: " '{ print $NF}' | ${SED} -e 's@\s\+@ @g' + CPU=`${LSHW} -quiet -C processor | ${GREP} "version:" | ${AWK} -F"version: " '{ print $NF}' | ${SED} -e 's@\s\+@ @g'` + if [ "${CPU}" == "" ] || [ "`get_system_type`" == "vmware" ]; then + CPU=`${LSHW} -quiet -C processor | ${GREP} "product:" | ${AWK} -F"product: " '{ print $NF}' | ${SED} -e 's@\s\+@ @g'` + fi + debug "SYSTEM-CPU: ${CPU}" + echo ${CPU} } # get system memory in MB function get_system_memory { INSTMEM=0 - for MODULE in `${DMIDECODE} -t memory | ${GREP} "^\s*Size" | ${GREP} -iv "No Module Installed" | ${AWK} '{print $(NF-1)}'` ; do - INSTMEM=`${EXPR} ${INSTMEM} + ${MODULE}` - done + case `get_system_type` in + xen-domU) + INSTMEM=`${CAT} /proc/meminfo | ${GREP} "^MemTotal:" | ${AWK} '{print int($2/1024)}'` + ;; + *) + for MODULE in `${DMIDECODE} -t memory | ${GREP} "^\s*Size" | ${GREP} -iv "No Module Installed" | ${AWK} '{print $(NF-1)}'` + do + INSTMEM=`${EXPR} ${INSTMEM} + ${MODULE}` + done + ;; + esac debug "SYSTEM-MEMORY: ${INSTMEM}" echo ${INSTMEM} } @@ -159,49 +187,6 @@ done } -## REPLACED by get_system_type using virt-what -## more info -> http://people.redhat.com/~rjones/virt-what/virt-what.txt -### get xen active info -##function get_system_running_xen { -## if [ -d /proc/xen ] ; then -## echo 1 -## else -## echo 0 -## fi -##} -## -### get kvm active info -##function get_system_running_kvm { -## if [ -n "`${GREP} ^kvm /proc/modules`" ] ; then -## echo 1 -## else -## echo 0 -## fi -##} -## -### get vz active info -##function get_system_running_vz { -## if [ -d /proc/vz ] ; then -## echo 1 -## else -## echo 0 -## fi -##} - -# get system type -function get_system_type { - RETVAL=`${VIRTWHAT}` - if [ $? == 0 ] ; then - TYPE=`${VIRTWHAT} | ${TAIL} -n1` - if [ "${TYPE}" == "" ] ; then - TYPE="baremetal" - fi - debug "SYSTEM-TYOE: ${TYPE}" - echo ${TYPE} - else - debug "VIRT-WHAT ERROR: ${RETVAL}" - fi -} # get kernel version function get_system_kernelversion { KERNEL=`${UNAME} -r` | ||
[+] | Changed | _service:recompress:tar_scm:inventory-system-0.0.rev1486.tar.bz2/server/config.inc.php ^ |
@@ -2,4 +2,7 @@ $config["isdf"]["postvars"] = array("get_system_uuid","get_system_serial","get_system_cpu","get_system_memory","get_system_manufacturer","get_system_productname","get_system_biosversion","get_system_net_info","get_system_default_ip","get_system_ipv4","get_system_ipv6","get_system_hostname","get_system_type","get_system_kernelversion","get_system_arch","get_system_os"); +$config["isdf"]["get_system_ipv4"]["action"] = "serialize"; +$config["isdf"]["get_system_ipv6"]["action"] = "serialize"; + ?> |