[-]
[+]
|
Changed |
_service:set_version:ix-inventory-system.spec
|
|
[-]
[+]
|
Changed |
ix-inventory-system.spec
^
|
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev4264.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 19:39:32 +0100 (Wed, 07 Nov 2012) $
+# $Rev: 4264 $
#
# 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
@@ -406,6 +406,18 @@
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
@@ -444,7 +456,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 +629,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.rev4264.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.rev4264.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();
+?>
|