Subversion Repositories computer_asset_manager_v2

Rev

Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 24
Line -... Line 1...
-
 
1
<html>
-
 
2
   <body>
-
 
3
      <p>
1
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.
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>
2
 
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.
3
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>
4
 
9
      <p>
5
This document describes the structure of the basic database, without modules.
10
         This document describes the structure of the basic database, without modules.
-
 
11
      </p>
6
 
12
      <p>
7
CAMP has two types of tables; system and data. System tables are preceded by an underscore, and are used for program flow.
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>
8
 
15
      <p>
9
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.
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.
10
 
17
      </p>
-
 
18
      <table border='1'>
-
 
19
         <tr>
-
 
20
            <td valign='top'>_system</td>
-
 
21
            <td valign='top'>
11
_system - configuration of system, similar to an INI file structure
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 />
12
_menu - describes the menuing system used in the program
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>
13
_user - defines access to the program, but see below
29
            <td valign='top'>_menu</td>
14
 
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
         <tr>
-
 
33
            <td valign='top'>_user</td>
15
_user entries should never be removed as the can be linked to various modules. Thus, it has two date fields; added_date and removed_date to allow removal from access while maintaining structual integrity.
34
            <td valign='top'>defines access to the program. However, _user entries should never be removed as the can be linked to various modules. Thus, it has two date fields; added_date and removed_date to allow removal from access while maintaining structual integrity.</td>
-
 
35
         </tr>
-
 
36
      </table>
16
 
37
      <p>
17
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:
38
         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:
18
mark "deleted" row with removed_date = a non-null value
39
         mark "deleted" row with removed_date = a non-null value
19
copy the newly removed row's data to new row, modifying the fields necessary (added_date always)
40
         copy the newly removed row's data to new row, modifying the fields necessary (added_date always)
-
 
41
      </p>
-
 
42
      <p>
20
 
43
         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.
21
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.
44
      </p>
22
 
45
      <p>
-
 
46
         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.
-
 
47
      </p>
-
 
48
      <table border='1'>
-
 
49
         <tr>
23
device <- client_device -> client
50
            <th>Linkage Table</th>
-
 
51
            <th>Connection 1</th>
-
 
52
            <th>Connection 2</th>
24
device <- client_site -> site
53
            <th>Notes</th>
-
 
54
         </tr>
-
 
55
         <tr>
-
 
56
            <td valign='top'>client_device</td>
25
site <- client_site -> client
57
            <td valign='top'>client</td>
-
 
58
            <td valign='top'>device</td>
-
 
59
            <td valign='top'>A client "owns" a device, but this can change.</td>
-
 
60
         </tr>
26
 
61
         <tr>
-
 
62
            <td valign='top'>client_site</td>
-
 
63
            <td valign='top'>client</td>
-
 
64
            <td valign='top'>site</td>
27
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.
65
            <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>
-
 
66
         </tr>
-
 
67
         <tr>
-
 
68
            <td valign='top'>site_device</td>
-
 
69
            <td valign='top'>site</td>
-
 
70
            <td valign='top'>device</td>
-
 
71
            <td valign='top'>A device is at a particular site (which may not be the owners site)</td>
-
 
72
         </tr>
28
 
73
         <tr>
29
device <- device_device -> device
74
            <td valign='top'>device_device</td>
-
 
75
            <td valign='top'>device</td>
-
 
76
            <td valign='top'>device (parent)</td>
-
 
77
            <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>
-
 
78
         </tr>
-
 
79
      </table>
30
 
80
      <p>
31
The current (2017) plan is that linkage tables will only be one-to-one.
81
         The current (2017) plan is that linkage tables will only be one-to-one.
-
 
82
      </p>
-
 
83
      <p>
32
 
84
         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.
33
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.
85
      </p>
34
 
86
      <p>
35
Finally, there is one weird table, alias. I found computer names change over a period of time, and there can actually be multiple names for a device at the same time, especially when automated reporting is done.
87
         Finally, there is one weird table, alias. I found computer names change over a period of time, and there can actually be multiple names for a device at the same time, especially when automated reporting is done.
-
 
88
      </p>
-
 
89
      <p>
36
 
90
         alias is not a true relational table. Instead, it tracks aliases for devices, sites or clients, depending on the source column; a 64 varchar which is designed to store the table name it is aliasing. This is a kludge to solve a problem that exists in real life, but has no elegant solution in a DBMS.
37
alias is not a true relational table. Instead, it tracks aliases for devices, sites or clients, depending on the source column; a 64 varchar which is designed to store the table name it is aliasing. This is a kludge to solve a problem that exists in real life, but has no elegant solution in a DBMS.
91
      </p>
38
 
92
      <p>
39
See database.png for a diagram of the basic database.
93
         See database.png for a diagram of the basic database.
-
 
94
      </p>
-
 
95
      <p>
40
 
96
         IMPORTANT: This document describes the actual database layout. However, CAMP does not read the layout from the database. Instead, it uses a hash to describe the database and some PHP classes that automate a lot of the screens. After the database is defined, the hash must be created. See DatabaseDefinition.php in the include directory.
-
 
97
      </p>
41
IMPORTANT: This document describes the actual database layout. However, CAMP does not read the layout from the database. Instead, it uses a hash to describe the database and some PHP classes that automate a lot of the screens. After the database is defined, the hash must be created. See DatabaseDefinition.php in the include directory.
98
      <table border='1'>
-
 
99
         <tr>
-
 
100
            <th>
-
 
101
               Table
-
 
102
            </th>
-
 
103
            <th>
-
 
104
               Description
-
 
105
            </th>
-
 
106
         </tr>
-
 
107
         <tr>
-
 
108
            <td valign='top'>
-
 
109
               device
-
 
110
            </td>
-
 
111
            <td valign='top'>
-
 
112
               Holds some basic information about a device; name, device_type and any notes you may want
-
 
113
            </td>
-
 
114
         </tr>
-
 
115
         <tr>
-
 
116
            <td valign='top'>
-
 
117
               client
-
 
118
            </td>
-
 
119
            <td valign='top'>
-
 
120
               Holds information about a particular client, such as name, notes, and private notes which are available to limited visitors
-
 
121
            </td>
-
 
122
         </tr>
-
 
123
         <tr>
-
 
124
            <td valign='top'>
-
 
125
               site
-
 
126
            </td>
-
 
127
            <td valign='top'>
-
 
128
               Physical sites which may house devices. Table holds information such as name and any special notes.
-
 
129
            </td>
-
 
130
         </tr>
-
 
131
         <tr>
-
 
132
            <td valign='top'>
-
 
133
               alias
-
 
134
            </td>
-
 
135
            <td valign='top'>
42
 
136
               things get renamed occasionally. Sites may go by one or two names, clients can change names, and devices especially can change names when pulled and redeployed. However, they are still the same item. This is especially important when automated processes (backups, sysinfo) can update the database and use a different name than is stored her, or when a device has a name change.
-
 
137
               <br />while aliases mainly concern devices, the table is set up to also handle site and client, by the field <b>source</b> which holds the name of the table for which this alias refers.
-
 
138
            </td>
-
 
139
         </tr>
-
 
140
      </table>
-
 
141
   </body>
-
 
142
</html>