| 1 | James is working on a second generation inventory script. |
| 2 | |
| 3 | Currently on: Gatherer |
| 4 | |
| 5 | |
| 6 | 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.") |
| 7 | |
| 8 | As I see it there should be 3 parts to this script: |
| 9 | |
| 10 | 1. executer: runs either wget or apt-get install and copies the latest version of the other parts of the scripts then |
| 11 | executes them |
| 12 | 1. gatherer: collects information using only operating system based facilities (dmesg, lsusb, lspci, ifconfig, /sys). |
| 13 | 1. Writer: checks the mysql repository for changes from the current state. If different changes them. |
| 14 | |
| 15 | |
| 16 | The sql structure is a bit of a bit mess, the major tables of interest are: |
| 17 | 1. motherboards - List of things that can be connected to, has its own id used to tie other tables to it |
| 18 | 1. devices - List of deviced "connected" to mother boards |
| 19 | 1. device_kinds - type identifier for connected devices (an attribute of a device). |
| 20 | 1. locations - Converts x,y coordinates to a single integer that maps directly to a mother board. |
| 21 | 1. inventories - records the start and stop time of the inventory pass. |
| 22 | |
| 23 | A lot of the tables are full of unused colums. I guess we'll just ignore them for now. |
| 24 | The basic crux of an update should be the following: |
| 25 | 1. examine our IP to determine our current location |
| 26 | 1. We gather information about the mother board: |
| 27 | 1. Disk Size (dmesg) |
| 28 | 1. Memory Size (dmesg) |
| 29 | 1. Gather information about attached devices: |
| 30 | 1. 2 wired Ethernet addresses (ifconfig, /sys) |
| 31 | 1. 2 wireless Ethernet addresses (ifconfig, /sys) |
| 32 | 1. any usb devices (lsusb, /sys) |
| 33 | 1. get the mother board id from the location table |
| 34 | 1. update mother board information if diffrent, and stamp with current inventory number |
| 35 | 1. update devices if diffrent and stamp with inventory number |
| 36 | 1. profit. |
| 37 | |
| 38 | ---- |
| 39 | Gatherer: |
| 40 | The disk size and memory size are a quick scan from dmesg. The disk size matches, but the memory size is a little off. It probably has to do with the way dmesg reports memory vs /sys reports memeory. It would be nice to find the /sys entry for consistency. |
| 41 | |
| 42 | In /sys/devices/pci0000:00 are the sub directories correlated with the specific Ethernet hardware. In each directory that correlated to an Ethernet device there will be a symbolic link with the operating system name of the device. This will allow us to match up the pci address(name of the subdirectory of /sys/devices/pci0000:00) to the mac address (from ifconfig). lspci can tell us the associated pci address and a hardware identifier string. |
| 43 | |