[-]
[+]
|
Changed |
_service:set_version:ix-inventory-system.spec
|
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1827.tar.bz2/client/inventory-system.sh
^
|
@@ -1,8 +1,8 @@
#!/bin/bash
# Inventory System
# Author: Carsten Schoene
-# $LastChangedDate: 2012-09-11 17:01:05 +0200 (Tue, 11 Sep 2012) $
-# $Rev: 1772 $
+# $LastChangedDate: 2012-09-15 15:58:10 +0200 (Sat, 15 Sep 2012) $
+# $Rev: 1823 $
#
# Default options (can be changed by inventory-system.conf)
DEBUG="yes"
@@ -90,7 +90,7 @@
echo -e "\t--help\t\tShows this help"
echo -e "\t--uuid\t\tUUID of this system"
echo -e "\t--disk\t\tRoot disk size of this system"
- echo -e "\t--all-disks\t\tAll disk devices with size"
+ echo -e "\t--all-disks\tAll disk devices with size"
echo -e "\t--systemtype\tSystem image type"
echo -e "\t--serial\tSystem serial number (Service Tag)"
echo -e "\t--cpu\t\tCPU type"
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1827.tar.bz2/server/config-custom.inc.php
^
|
@@ -5,6 +5,9 @@
$config["isdf"]["dhcp"]["system"]["net4"] = "10.10.20.0/22";
$config["isdf"]["dhcp"]["systemmgmt"]["net4"] = "10.10.24.0/22";
$config["isdf"]["dhcp"]["systempxe"]["net4"] = "10.10.28.0/22";
+$config["isdf"]["dhcp"]["system"]["firstusable"] = "10.10.20.11";
+$config["isdf"]["dhcp"]["systemmgmt"]["firstusable"] = "10.10.24.11";
+$config["isdf"]["dhcp"]["systempxe"]["firstusable"] = "10.10.28.11";
$config["isdf"]["dhcp"]["system"]["net6"] = "";
$config["isdf"]["dhcp"]["systemmgmt"]["net6"] = "";
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1827.tar.bz2/server/config.inc.php
^
|
@@ -3,4 +3,5 @@
$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"]["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.rev1827.tar.bz2/server/get_dhcp.php
^
|
@@ -0,0 +1,63 @@
+#!/usr/bin/php
+<?php
+/*
+// isdf - dhcp generator
+// Author: Carsten Schoene
+//
+// $LastChangedDate: 2012-09-15 19:44:43 +0200 (Sat, 15 Sep 2012) $
+// $Rev: 1827 $
+*/
+
+// define our name
+define('MYNAME', "isdf");
+// 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");
+require_once(BASE . "/inet4.class.php");
+require_once(BASE . "/inv-dhcp4.class.php");
+require_once(BASE . "/dhcpconf.class.php");
+
+// create database connection
+$dbh =& MDB2::singleton($config['isdf']['db'], $config['mdb2']['options'] );
+
+// create inv-dhcp4 object
+$idhcp4 = new inv_dhcp4();
+
+$qrybkvm="SELECT value FROM inv_system_properties WHERE inv_system_id=(SELECT inv_system_id FROM inv_system_properties WHERE datakey='get_system_type_ix' and value='baremetal-kvm') AND datakey='get_system_net_info';";
+
+$dhcpmacs = array();
+
+$res = $dbh->query($qrybkvm);
+if (PEAR::isError($res)) {
+ syslog(LOG_ERR, "MDB2: " . $res->getMessage());
+} else {
+ while (( $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC) )) {
+ // each result is interface list with values of mac,interface,linkstatus
+ $intlist = preg_split('/\s/',$row['value']);
+ foreach ( $intlist as $macintlink ) {
+ list($mac,$int,$link) = explode(",", trim($macintlink));
+ if ($idhcp4->int_is_valid($mac,$int,$link)) {
+ // create dhcp entry - push to array
+ array_push($dhcpmacs, $mac);
+ }
+ }
+
+
+ }
+}
+
+print_r($dhcpmacs);
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1827.tar.bz2/server/inv-dhcp4.class.php
^
|
@@ -1,6 +1,6 @@
<?php
-// $LastChangedDate: 2012-08-12 20:31:53 +0200 (Sun, 12 Aug 2012) $
-// $Rev: 1697 $
+// $LastChangedDate: 2012-09-14 10:19:04 +0200 (Fri, 14 Sep 2012) $
+// $Rev: 1792 $
class inv_dhcp4 {
function mac_is_valid($mac)
@@ -35,6 +35,45 @@
}
}
+ function int_is_blacklisted($int)
+ {
+ global $config;
+ $int = strtolower(trim($int));
+ if ( $int == "none" )
+ {
+ return false;
+ }
+ elseif( $int == "" )
+ {
+ return false;
+ } else {
+ if ( array_search($int, $config["isdf"]["dhcp"]["intblacklist"]) === false )
+ {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ function int_is_valid($mac,$int,$link)
+ {
+ if ( $link == "yes" ) {
+ if ( $this->mac_is_valid($mac)) {
+ if ( $this->mac_is_blacklisted($mac)) {
+ return false;
+ } elseif ( $this->int_is_blacklisted($int)) {
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
}
?>
|