Changes between Version 20 and Version 21 of Internal/InventoryV3
- Timestamp:
- Nov 24, 2009, 4:37:13 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Internal/InventoryV3
v20 v21 1 1 James is working on a second generation inventory script. 2 2 3 Currently on: reorganising code3 Currently on: integrate lshw fully, verify data, tweak writer 4 4 5 5 Versions: 6 6 7 Gather:0.878 Writer:0.9 7 * Gather:0.87 8 * Writer:0.97 9 9 10 10 It's plan is to be simpler and less ambitious than it's predecessor, but still respect the sql table structure ("as much as possible.") … … 14 14 1. executer: runs either wget or apt-get install and copies the latest version of the other parts of the scripts then 15 15 executes them 16 1. gatherer: collects information using only operating system based facilities (dmesg, lsusb, lspci, ifconfig, /sys). 16 '''DEPRECIATED''' - In lieu of image updates. 17 1. gatherer: collects information using only operating system based facilities (dmesg, lsusb, lspci, ifconfig, /sys, lshw). 17 18 1. Writer: checks the mysql repository for changes from the current state. If different changes them. 18 19 19 '''NOTE''' Gatherer and Writer are being merged into a single file which I will call inventory2_client.rb20 20 21 21 The sql structure is a bit of a bit mess, the major tables of interest are: … … 23 23 1. devices - List of deviced "connected" to mother boards 24 24 1. device_kinds - type identifier for connected devices (an attribute of a device). 25 1. locations - Converts x,y coordinates to a single integer that maps directly to a mother board. 25 1. locations - Converts x,y,testbed_id coordinates to a single integer 26 1. nodes - maps motherboard to locations, also has an id for said mapping 26 27 1. inventories - records the start and stop time of the inventory pass. 27 28 1. testbeds - gives a testbed id for the specific domain, thus disambiguating node1-1 … … 29 30 A lot of the tables are full of unused colums. I guess we'll just ignore them for now. 30 31 The basic crux of an update should be the following: 31 1. examine our IP to determine our current location32 1. examine our IP (and hostname) to determine our current location 32 33 1. We gather information about the mother board: 33 34 1. '''Gatherer:''' … … 35 36 1. Memory Size (dmesg) 36 37 1. Cpu number (dmesg) 38 1. motherboard serial number (lshw) 37 39 1. Gather information about attached devices: 38 40 1. 2 wired Ethernet addresses (ifconfig, /sys) 39 41 1. 2 wireless Ethernet addresses (ifconfig, /sys) 40 42 1. any usb devices (lsusb, /sys) 43 1. export to xml 44 41 45 1. '''Writer:''' 42 1. get the mother board id from the location table 43 1. update mother board information if diffrent, and stamp with current inventory number 46 1. import xml output from gatherer 47 1. collect identifiers from mysql based on gathered infromation (domain => testbed_id ;x,y,testbed_id => loc_id; 48 mb_ser => mb_id ; loc_id => node_id ; ) 49 1. update mother board information if different, and stamp with current inventory number 44 50 1. add kinds if they don't exist already 45 51 1. update devices if diffrent and stamp with inventory number 52 1. update node mb_id if loc, mb pair don't match 46 53 1. profit. 47 54 … … 245 252 pretty close to this, but needs a little work. 246 253 254 === 11/23/09 === 255 256 The previous was completed. There was a two bugs that needed tweaking 257 * Update node did not update the inventory when it updated a node info. 258 * Had to add a hack to prevent unknown dev_ids from getting double entered in update_adds when the id is unknown. If the device has 259 multiple instances of a pice of unknown hardware (like 2 new Ethernet cards), the current routine will double add them. 260 * this hack should be re-visited for efficiency, currently it double checks for a kind (in case one was added after the adds_array 261 was populated). This is very wasteful as the missing kinds should be a rare event. I should probably switch to a different function 262 or something if I've entered the rare "never seen it before" scenario.