Subversion Repositories computer_asset_manager_v2

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
24 rodolico 1
<html>
2
   <body>
3
      <p>
4
         CAMP is designed to be run with a relational database which is supported by the PHP PDO class. It has been developed and tested using MariaDB.
5
      </p>
6
      <p>
7
         Version 2 is a complete rewrite, with emphasis on getting the basic system right, then adding functionality through modules. Thus, the decision was made to only include the minimum functionality required to track an asset (called a device in the app) through sites and clients. Since modules are not allowed to modify the structure of any tables, this basic database structure will be static, requiring a major revision to modify.
8
      </p>
9
      <p>
10
         This document describes the structure of the basic database, without modules.
11
      </p>
12
      <p>
13
         CAMP has two types of tables; system and data. System tables are preceded by an underscore, and are used for program flow.
14
      </p>
15
      <p>
16
         System tables can have rows edited, updated, added and deleted as necessary. For example, adding a new module often requires adding rows to _system and _menu, and removing a module will remove those entries.
17
      </p>
18
      <table border='1'>
19
         <tr>
20
            <td valign='top'>_system</td>
21
            <td valign='top'>
22
                configuration of system, similar to an INI file structure. Contains columns group_name, key_name and theValue, corresponding to<br />
23
                [group_name]<br />
24
                key_name=theValue<br />
25
                This is modified programmatically any time a module is added or removed, or if system wide configurations need to be made.
26
            </td>
27
         </tr>
28
         <tr>
29
            <td valign='top'>_menu</td>
30
            <td valign='top'>describes the menuing system used in the program. This is based on the library DBHierarchialHash (DBMenu extends it). Each entry is a menu, with a (possibly null) parent, a caption, and a URL to go to if the menu item is selected.<br />This is modified by modules, with menu items added when a module is activated</td>
31
         </tr>
32
      </table>
33
      <p>
34
         The remaining tables should never have rows deleted under normal circumstances, in or to track history and/or maintain data integrity. They have two additional date fields, added_date and removed_date. An edit of any of these tables proceeds as follows:
35
         mark "deleted" row with removed_date = a non-null value
36
         copy the newly removed row's data to new row, modifying the fields necessary (added_date always)
37
      </p>
38
      <p>
39
         The basis of the whole system is the device (aka asset). An asset has an owner (client) and a location (site). Since we don't want to lose historical data, the linkage between devices, clients and sites is done through join tables, named by the tables they join, thus, client_device links the client and device tables. Additionally, a site is owned by a client, so there is a client_site table.
40
      </p>
41
      <p>
42
         A device can also be a part of another device in the table. An example is a virtual machine which is hosted by a physical machine. In this case, we use a separate table to mark the "part of" relationship.
43
      </p>
44
      <table border='1'>
45
         <tr>
46
            <th>Linkage Table</th>
47
            <th>Connection 1</th>
48
            <th>Connection 2</th>
49
            <th>Notes</th>
50
         </tr>
51
         <tr>
52
            <td valign='top'>client_device</td>
53
            <td valign='top'>client</td>
54
            <td valign='top'>device</td>
55
            <td valign='top'>A client "owns" a device, but this can change.</td>
56
         </tr>
57
         <tr>
58
            <td valign='top'>client_site</td>
59
            <td valign='top'>client</td>
60
            <td valign='top'>site</td>
61
            <td valign='top'>A client "owns" a site. This client is not necessarily the same as the owner of a device on that site</td>
62
         </tr>
63
         <tr>
64
            <td valign='top'>site_device</td>
65
            <td valign='top'>site</td>
66
            <td valign='top'>device</td>
67
            <td valign='top'>A device is at a particular site (which may not be the owners site)</td>
68
         </tr>
69
         <tr>
70
            <td valign='top'>device_device</td>
71
            <td valign='top'>device</td>
72
            <td valign='top'>device (parent)</td>
73
            <td valign='top'>A device can be part of another device. For example, a USB printer can be part of a computer, or a Xen DOMU may be on a physical DOM0</td>
74
         </tr>
75
      </table>
76
      <p>
77
         The current (2017) plan is that linkage tables will only be one-to-one.
78
      </p>
79
      <p>
80
         A device also has one child table, device_type. device_type allows us to categorize devices by function; router, server, workstation, virtual. This relationship does not involve link tables; one of the columns in device is device_type_id, so a device can only have one type.
81
      </p>
82
      <p>
33 rodolico 83
         Device has three additional fields for unique identification:
84
         <table border='1'>
85
            <tr><th>Name</th><th>Definition</th><th>Notes</th></tr>
86
            <tr>
87
               <td>uuid</td>
88
               <td>varchar(32)</td>
89
               <td>UUID of the machine, if available</td>
90
            </tr>
91
            <tr>
92
               <td>serial</td>
93
               <td>varchar(32)</td>
94
               <td>Manufacturer's Serial Number of machine, if available</td>
95
            </tr>
96
            <tr>
97
               <td>name</td>
98
               <td>varchar(64)</td>
99
               <td>Name of machine (can change)</td>
100
            </tr>
101
         </table>
102
         These are arbitrary, but the combination should uniquely determine any entry. This is designed to allow automated processes to locate a specific machine, and to allow export/import of data in a consistent manner. While UUID may be enough by itself, it is not always unique, even amongst server class machines. All of these may be null except name. NOTE: name can be changed. Internally, devices are identified by the key field, device_id.
24 rodolico 103
      </p>
104
      <table border='1'>
105
         <tr>
106
            <th>
107
               Table
108
            </th>
109
            <th>
110
               Description
111
            </th>
112
         </tr>
113
         <tr>
114
            <td valign='top'>
115
               device
116
            </td>
117
            <td valign='top'>
33 rodolico 118
               Holds some basic information about a device; name, device_type, uuid and/or serial number
24 rodolico 119
            </td>
120
         </tr>
121
         <tr>
122
            <td valign='top'>
123
               client
124
            </td>
125
            <td valign='top'>
33 rodolico 126
               Holds the name of particular client (ownership)
24 rodolico 127
            </td>
128
         </tr>
129
         <tr>
130
            <td valign='top'>
131
               site
132
            </td>
133
            <td valign='top'>
33 rodolico 134
               Physical sites which may house devices. Table holds name.
24 rodolico 135
            </td>
136
         </tr>
137
      </table>
33 rodolico 138
      <p>
139
         Originally, additional information was to be stored in the device/client/site tables, but they have been removed to decrease the complexity of the base program. Instead, this information will be managed by the modules aliases and notes.
140
      </p>
24 rodolico 141
   </body>
142
</html>