Changes of Revision 15
[-] | Changed | _service:set_version:ix-inventory-system.spec |
x 1
2 %define pkgname inventory-system 3 Name: ix-inventory-system 4 Release: 0 5 -Version: 0.0.rev1890 6 +Version: 0.0.rev4265 7 Url: http://www.internetx.com/ 8 License: GPLv2 9 Group: System 10
11 %else 12 Requires: pmtools 13 %endif 14 +%if 0%{?sles_version} == 10 15 +Requires: lsb 16 +%else 17 Requires: lsb-release 18 +%endif 19 Requires: awk 20 %else 21 Requires: dmidecode 22
23 %config(noreplace) %{wwwdir}/config-custom.inc.php 24 %config(noreplace) %{wwwdir}/db.inc.php 25 %{wwwdir}/isdf.php 26 +%{wwwdir}/search.php 27 %{wwwdir}/status.php 28 %{wwwdir}/dhcpconf.class.php 29 %{wwwdir}/inet4.class.php 30 |
||
[+] | Changed | _service:recompress:tar_scm:inventory-system-0.0.rev4265.tar.bz2/client/inventory-system.sh ^ |
@@ -1,8 +1,8 @@ #!/bin/bash # Inventory System # Author: Carsten Schoene -# $LastChangedDate: 2012-09-17 21:53:15 +0200 (Mon, 17 Sep 2012) $ -# $Rev: 1851 $ +# $LastChangedDate: 2012-11-07 20:11:02 +0100 (Wed, 07 Nov 2012) $ +# $Rev: 4265 $ # # Default options (can be changed by inventory-system.conf) DEBUG="yes" @@ -195,7 +195,7 @@ # autoupdate function function autoupdate { [ "`is_disabled $FUNCNAME`" == "1" ] && return - PKG=`rpm -qf --queryformat '%{name}\n' $0 | ${GREP} -v "^file /"` + PKG=`${RPM} -qf --queryformat '%{name}\n' $0 | ${GREP} -v "^file /"` YUM=`which yum 2>/dev/null` ZYP=`which zypper 2>/dev/null` if [ -n "${PKG}" ] ; then @@ -230,14 +230,6 @@ echo ${UUID} } -# read serialnumber / service tag with dmidecode -function get_system_serial { - [ "`is_disabled $FUNCNAME`" == "1" ] && return - SYSSERIAL=`${DMIDECODE} -s system-serial-number` - debug "SYSTEM-SERIAL: ${SYSSERIAL}" - echo ${SYSSERIAL} -} - # get list of MAC addresses from lshw function get_system_macs { [ "`is_disabled $FUNCNAME`" == "1" ] && return @@ -277,6 +269,21 @@ fi } +# read serialnumber / service tag with dmidecode +function get_system_serial { + [ "`is_disabled $FUNCNAME`" == "1" ] && return + case `get_system_type` in + xen-dom0|baremetal) + SYSSERIAL=`${DMIDECODE} -s system-serial-number` + ;; + *) + SYSSERIAL="n/a" + ;; + esac + debug "SYSTEM-SERIAL: ${SYSSERIAL}" + echo ${SYSSERIAL} +} + # get system cpu type function get_system_cpu { [ "`is_disabled $FUNCNAME`" == "1" ] && return @@ -393,7 +400,14 @@ # get product name function get_system_productname { [ "`is_disabled $FUNCNAME`" == "1" ] && return - PRODNAME=`${DMIDECODE} -s system-product-name` + case `get_system_type` in + xen-dom0|baremetal) + PRODNAME=`${DMIDECODE} -s system-product-name` + ;; + *) + PRODNAME="n/a" + ;; + esac debug "SYSTEM-PRODUCTNAME: ${PRODNAME}" echo ${PRODNAME} } @@ -401,15 +415,41 @@ # get system vendor function get_system_manufacturer { [ "`is_disabled $FUNCNAME`" == "1" ] && return - SYSMANUF=`${DMIDECODE} -s system-manufacturer` + case `get_system_type` in + xen-dom0|baremetal) + SYSMANUF=`${DMIDECODE} -s system-manufacturer` + ;; + *) + SYSMANUF="n/a" + ;; + esac debug "SYSTEM-MANUFACTURER: ${SYSMANUF}" echo ${SYSMANUF} } +# get express service code for dell systems +function get_system_dell_express_service_code { + [ "`is_disabled $FUNCNAME`" == "1" ] && return + if [ -n "`get_system_manufacturer | grep -i dell`" ] ; then + ST=`get_system_serial` + if [ -n "${ST}" ] ; then + EC=$((36#${ST})) + debug "SYSTEM-DELL-EXPRESS-SERVICE-CODE: ${EC}" + echo "${EC}" + fi + fi +} # get system bios version function get_system_biosversion { [ "`is_disabled $FUNCNAME`" == "1" ] && return - BIOSV=`${DMIDECODE} -s bios-version` + case `get_system_type` in + xen-dom0|baremetal) + BIOSV=`${DMIDECODE} -s bios-version` + ;; + *) + BIOSV="n/a" + ;; + esac debug "BIOS-VERSION: ${BIOSV}" echo ${BIOSV} } @@ -444,7 +484,7 @@ # get distribution function get_system_os { [ "`is_disabled $FUNCNAME`" == "1" ] && return - OSREL=`${LSB_RELEASE} -d | ${AWK} -F":\t" '{print $NF}'` + OSREL=`${LSB_RELEASE} -d | ${AWK} -F":\t" '{print $NF}' | ${SED} -r -e 's#(.*)\(.*\)#\1#g'` debug "SYSTEM-OS: ${OSREL}" echo ${OSREL} } @@ -617,6 +657,7 @@ get_system_cpu \ get_system_memory \ get_system_manufacturer \ + get_system_dell_express_service_code \ get_system_productname \ get_system_biosversion \ get_system_net_info \ | ||
[+] | Changed | _service:recompress:tar_scm:inventory-system-0.0.rev4265.tar.bz2/server/config.inc.php ^ |
@@ -1,6 +1,6 @@ <?php -$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_mgmt_mac","get_system_mgmt_ip","get_system_type","get_system_kernelversion","get_system_arch","get_system_os","get_system_software","get_system_date","get_system_disk_size_bootdev","get_system_disk_sizes"); +$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_mgmt_mac","get_system_mgmt_ip","get_system_type","get_system_kernelversion","get_system_arch","get_system_os","get_system_software","get_system_date","get_system_disk_size_bootdev","get_system_disk_sizes","get_system_dell_express_service_code"); $config["isdf"]["dhcp"]["macblacklist"] = array("00:00:00:00:00:00","ff:ff:ff:ff:ff:ff"); $config["isdf"]["dhcp"]["intblacklist"] = array("virbr0"); | ||
[+] | Added | _service:recompress:tar_scm:inventory-system-0.0.rev4265.tar.bz2/server/search.php ^ |
@@ -0,0 +1,104 @@ +<?php +/* +// isdf - inventory system search +// Author: Carsten Schoene +// +// $LastChangedDate: 2012-07-20 21:09:25 +0200 (Fr, 20. Jul 2012) $ +// $Rev: 1619 $ +*/ + +// define our name +define('MYNAME', "isdf-search"); +// open syslog connection +openlog(MYNAME,LOG_PID | LOG_ODELAY,LOG_MAIL); + +// check for required extensions +if ( ! extension_loaded("mysql") ) { + if ( ! dl("mysql") ) { + syslog(LOG_ERR,"mysql extension not loaded!"); + exit; + } +} + +// load additional files +define('BASE',dirname(__FILE__)); +require_once("MDB2.php"); +require_once(BASE . "/config.inc.php"); +require_once(BASE . "/config-custom.inc.php"); +require_once(BASE . "/db.inc.php"); + +echo '<html><head> +<title>inventory system - search web</title> +</head> +<body> +<form action="' . $_SERVER['PHP_SELF'] . '"><table> +<tr><td>Search property:</td> + <td><select name="systemid"> +'; +// create database connection +$dbh =& MDB2::singleton($config['isdf']['db'], $config['mdb2']['options'] ); + +//$uuidsql = "SELECT id,system_uuid FROM inv_system"; +// datakeys +$datakeysql = "select datakey from inv_system_properties GROUP BY datakey"; +$options = ""; +$res = $dbh->query($datakeysql); +if (PEAR::isError($res)) { + syslog(LOG_ERR, "MDB2 res: " . $res->getMessage()); +} else { + echo '<option value="all">All</option>'; + while (( $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC) )) { + /* if ( isset($_GET['systemid'])) { + if ( $row['id'] == $_GET['systemid'] ) { + echo '<option selected value="' . $row['id'] . '">' . $row['system_uuid'] . '</option>'; + } else { + echo '<option value="' . $row['id'] . '">' . $row['system_uuid'] . '</option>'; + } + } else { */ + $options .= '<option value="' . $row['datakey'] . '">' . $row['datakey'] . '</option>'; + /* } */ + } +} +echo $options; +$options = preg_replace('#<option#','<option selected="selected"',$options); +echo ' +</select></td><td><input type="text" size="27" name="search"></td></tr> +<tr><td colspan="2" valign="top">Select fields for output result:</td><td><select name="output[]" multiple="multiple" size="5">'.$options.'</select></td></tr> +<tr><td colspan="3" align="right"><input type="submit" value="Search"></td></tr></table></form> +'; + +if ( isset($_GET['systemid']) && isset($_GET['search']) && isset($_GET['output'])) { + $systemid = $_GET['systemid']; + $search = $dbh->escape($_GET['search']); + $output = $_GET['output']; + if ( $systemid == "all" ) { + $idsql = "SELECT inv_system_id FROM inv_system_properties WHERE value LIKE '%$search%' GROUP BY inv_system_id"; + } else { + $idsql = "SELECT inv_system_id FROM inv_system_properties WHERE datakey = '$systemid' AND value LIKE '%$search%' GROUP BY inv_system_id"; + } + + $idres = $dbh->query($idsql); + if (PEAR::isError($idres)) { + syslog(LOG_ERR, "MDB2 idres: " . $idres->getMessage()); + } else { + while (( $idrow = $idres->fetchRow(MDB2_FETCHMODE_ASSOC) )) { + $datasql = "SELECT datakey, value FROM inv_system_properties WHERE inv_system_id = '". $idrow['inv_system_id'] . "'"; + $datares = $dbh->query($datasql); + if (PEAR::isError($datares)) { + syslog(LOG_ERR, "MDB2 datares: " . $datares->getMessage()); + } else { + echo '<table>'; + echo '<tr><th>Key:</th><th>Value:</th></tr>'; + while (( $row = $datares->fetchRow(MDB2_FETCHMODE_ASSOC) )) { + if ( in_array($row['datakey'], $output) ) { + echo '<tr><td valign="top">' . $row['datakey'] . '</td><td>' . $row['value'] . '</td></tr>'; + } + } + echo '</table>'; + } + } + } +} +echo '</body></html>'; +$dbh->disconnect(); +?> |