Subversion Repositories computer_asset_manager_v1

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php
2
 
3
   global $BACKUP_DATA;
4
   $BACKUP_DATA['unknown_entry'] = array(
5
      'table' => 'unknown_entry',
6
      'fields' => array(  'client_name',
7
                          'device_name',
8
                          'report_date',
9
                          'processed_date',
10
                          'processed_by',
11
                        ),
12
                     'query' => 'select client_name,device_name,report_date,processed_date,login.email processed_by
13
                                 from unknown_entry join login on processed_by = login_id',
14
                     'insert' => 'insert into unknown_entry(client_name,device_name,report_date,processed_date,processed_by)
15
                                  select <client_name>,<device_name>,<report_date>,<processed_date>,login_id from login where email = <processed_by>'
16
     );
17
 
18
   $BACKUP_DATA['operating_system'] = array(
19
   'table' => 'operating_system',
20
   'fields' => array( 'name',
21
                        'version',
22
                        'kernel',
23
                        'distro',
24
                        'distro_description',
25
                        'distro_release',
26
                        'distro_codename',
27
                        'added_date',
28
                        'removed_date'
29
                     ),
30
 
31
 
32
                     'query' => 'select name,version,kernel,distro,distro_description,distro_release,distro_codename,added_date,removed_date from operating_system',
33
                     'insert' => 'insert into operating_system(name,version,kernel,distro,distro_description,distro_release,distro_codename,added_date,removed_date) 
34
                                  select <name>,<version>,<kernel>,<distro>,<distro_description>,<distro_release>,<distro_codename>,<added_date>,<removed_date>'
35
   );
36
 
37
   $BACKUP_DATA['software'] = array(
38
   'table' => 'software',
39
   'fields' => array( 'package_name',
40
                        'description',
41
                        'added_date',
42
                        'removed_date'
43
                     ),
44
                     'query' => 'select package_name,description,added_date,removed_date from software',
45
                     'insert' => 'insert into software(package_name,description,added_date,removed_date) 
46
                                  select <package_name>,<description>,<added_date>,<removed_date>'
47
   );
48
 
49
   $BACKUP_DATA['software_version'] = array(
50
   'table' => 'software_version',
51
   'fields' => array( 'version',
52
                        'added_date',
53
                        'removed_date'
54
                     ),
55
                     'query' => 'select version,added_date,removed_date from software_version',
56
                     'insert' => 'insert into software_version(version,added_date,removed_date) 
57
                                  select <version>,<added_date>,<removed_date>'
58
   );
59
 
60
   $BACKUP_DATA['computer_uptime'] = array(
61
   'table' => 'computer_uptime',
62
   'fields' => array(   'last_reboot',
63
                        'added_date',
64
                        'removed_date',
65
                        'client',
66
                        'site',
67
                        'device'
68
                     ),
69
                     'query' => 'select client.name client,site.name site,device.name device, computer_uptime.last_reboot,computer_uptime.added_date,computer_uptime.removed_date
70
                                 from computer_uptime join device using (device_id) join site using (site_id) join client using (client_id)',
71
                     'insert' => 'insert into computer_uptime (device_id,last_reboot,added_date,removed_date)
72
                                 select device.device_id,<last_reboot>,<added_date>,<removed_date> 
73
                                 from device join site using (site_id) join client using (client_id)
74
                                 where client.name = <client>
75
                                       and site.name = <site>
76
                                       and device.name = <device>'
77
   );
78
 
79
   $BACKUP_DATA['pci_devices'] = array (
80
                         'table' => 'device',
81
                         'fields' => array(  'client',
82
                                             'site',
83
                                             'device_type',
84
                                             'part_of',
85
                                             'name',
86
                                             'notes',
87
                                             'added_date',
88
                                             'removed_date'
89
                                          ),
90
                         'query' => " select client.name client, site.name site, device_type.name device_type, parent.name part_of, device.name,device.notes,device.added_date,device.removed_date
91
                                      from device join device_type using (device_type_id) join site using (site_id) join client using (client_id) join device parent on device.part_of = parent.device_id
92
                                      where device_type.show_as_system != 'Y'
93
                                    ",
94
                         'insert' => 'insert into device(site_id,device_type_id,part_of,name,notes,added_date,removed_date)
95
                                      select site.site_id,device_type.device_type_id,parent.device_id,<name>,<notes>,<added_date>,<removed_date> 
96
                                      from client join site using (client_id) join device parent, device_type 
97
                                      where client.name = <client> and site.name=<site> and device_type.name=<device_type> and parent.name = <part_of>'
98
      );
99
 
100
   $BACKUP_DATA['pci_attribs'] = array(
101
                          'table' => 'device_attrib',
102
                          'fields' => array('client',
103
                                             'site',
104
                                             'device',
105
                                             'part_of',
106
                                             'attrib',
107
                                             'value',
108
                                             'added_date',
109
                                             'removed_date'
110
                                      ),
111
                     'query' => "select client.name client,
112
                                       site.name site,
113
                                       device.name device,
114
                                       parent.name part_of,
115
                                       attrib.name attrib,
116
                                       device_attrib.value value,
117
                                       device_attrib.added_date,
118
                                       device_attrib.removed_date
119
                                 from device_attrib join device on device_attrib.device_id=device.device_id 
120
                                       join device parent on device.part_of = parent.device_id
121
                                       join site on device.site_id = site.site_id 
122
                                       join client on site.client_id=client.client_id
123
                                       join attrib on device_attrib.attrib_id=attrib.attrib_id
124
                                       join device_type on device.device_type_id=device_type.device_type_id
125
                                 where device_type.show_as_system != 'Y'",
126
                     'insert' => 'insert into device_attrib(device_id,attrib_id,value,added_date,removed_date)
127
                                      select device.device_id,attrib.attrib_id,<value>,<added_date>,<removed_date> 
128
                                      from client join site using (client_id) 
129
                                           join device using (site_id) 
130
                                           join device parent on device.part_of = parent.device_id,
131
                                           attrib
132
                                      where client.name = <client> 
133
                                            and site.name=<site> 
134
                                            and device.name=<device> 
135
                                            and parent.name = <part_of> 
136
                                            and attrib.name = <attrib>'
137
   );
138
 
139
   $BACKUP_DATA['device_operating_system'] = array(
140
   'table' => 'device_operating_system',
141
   'fields' => array(   'name',
142
                        'kernel',
143
                        'distro',
144
                        'release',
145
                        'added_date',
146
                        'removed_date',
147
                        'client',
148
                        'site',
149
                        'device'
150
                     ),
151
                     'query' => 'select client.name client,
152
                                       site.name site,
153
                                       device.name device,
154
                                       operating_system.name name,
155
                                       operating_system.kernel "kernel",
156
                                       operating_system.distro "distro",
157
                                       operating_system.distro_release "release",
158
                                       device_operating_system.added_date,
159
                                       device_operating_system.removed_date
160
                                 from device_operating_system join device using (device_id) join site using (site_id) join client using (client_id) join operating_system using (operating_system_id)',
161
                     'insert' => 'insert into device_operating_system (device_id,operating_system_id,added_date,removed_date)
162
                                 select device.device_id,operating_system_id,<added_date>,<removed_date> 
163
                                 from device join site using (site_id) join client using (client_id), operating_system
164
                                 where client.name = <client>
165
                                       and site.name = <site>
166
                                       and device.name = <device>
167
                                       and operating_system.name = <name>
168
                                       and operating_system.kernel = <kernel>
169
                                       and operating_system.distro = <distro>
170
                                       and operating_system.distro_release = <release>'
171
   );
172
 
173
   $BACKUP_DATA['disk_info'] = array(
174
   'table' => 'disk_info',
175
   'fields' => array(   'disk_device',
176
                        'filesystem',
177
                        'mount_point',
178
                        'capacity',
179
                        'added_date',
180
                        'removed_date',
181
                        'client',
182
                        'site',
183
                        'device'
184
                     ),
185
                     'query' => 'select client.name client,
186
                                       site.name site,
187
                                       device.name device,
188
                                       disk_info.disk_device,
189
                                       disk_info.filesystem,
190
                                       disk_info.mount_point,
191
                                       disk_info.capacity,
192
                                       disk_info.added_date,
193
                                       disk_info.removed_date
194
                                 from disk_info join device using (device_id) join site using (site_id) join client using (client_id)',
195
                     'insert' => 'insert into disk_info (device_id,disk_device,filesystem,mount_point,capacity,added_date,removed_date)
196
                                 select device.device_id,<disk_device>,<filesystem>,<mount_point>,<capacity>,<added_date>,<removed_date> 
197
                                 from device join site using (site_id) join client using (client_id)
198
                                 where client.name = <client>
199
                                       and site.name = <site>
200
                                       and device.name = <device>'
201
   );
202
 
203
   $BACKUP_DATA['disk_space'] = array(
204
   'table' => 'disk_space',
205
   'fields' => array(   'client',
206
                        'site',
207
                        'device',
208
                        'disk_device',
209
                        'filesystem',
210
                        'mount_point',
211
                        'capacity',
212
                        'space_used',
213
                        'added_date',
214
                        'removed_date'
215
                     ),
216
                     'query' => 'select client.name client,
217
                                       site.name site,
218
                                       device.name device,
219
                                       disk_info.disk_device,
220
                                       disk_info.filesystem,
221
                                       disk_info.mount_point,
222
                                       disk_info.capacity,
223
                                       disk_space.space_used,
224
                                       disk_space.added_date,
225
                                       disk_space.removed_date
226
                                 from disk_space join disk_info using (disk_info_id) join device using (device_id) join site using (site_id) join client using (client_id)',
227
                     'insert' => 'insert into disk_space (disk_info_id,space_used,added_date,removed_date)
228
                                    select disk_info_id,<space_used>,<added_date>,<removed_date> 
229
                                    from disk_info join device using (device_id) join site using (site_id) join client using (client_id)
230
                                    where client.name = <client>
231
                                          and site.name = <site>
232
                                          and device.name = <device>
233
                                          and disk_info.disk_device = <disk_device>
234
                                          and disk_info.filesystem = <filesystem>
235
                                          and disk_info.mount_point = <mount_point>
236
                                          and disk_info.capacity = <capacity>'
237
   );
238
 
239
   $BACKUP_DATA['installed_packages'] = array(
240
   'table' => 'installed_packages',
241
   'fields' => array( 'client',
242
                        'site',
243
                        'device',
244
                        'software',
245
                        'software_version',
246
                        'added_date',
247
                        'removed_date'
248
                     ),
249
                     'query' => 'select client.name client,
250
                                       site.name site,
251
                                       device.name device,
252
                                       software.package_name software,
253
                                       software_version.version software_version,
254
                                       installed_packages.added_date,
255
                                       installed_packages.removed_date
256
                                 from installed_packages join device using (device_id) join site using (site_id) join client using (client_id)
257
                                    join software using (software_id) join software_version using (software_version_id)',
258
                     'insert' => 'insert into installed_packages (device_id,software_id,software_version_id, added_date,removed_date)
259
                                 select device_id,software_id,software_version_id,<added_date>,<removed_date> 
260
                                 from device join site using (site_id) join client using (client_id),
261
                                      software, 
262
                                      software_version
263
                                 where client.name = <client>
264
                                       and site.name = <site>
265
                                       and device.name = <device>
266
                                       and software.package_name = <software>
267
                                       and software_version.version = <software_version>'
268
   );
269
 
270
   $BACKUP_DATA['network'] = array(
271
   'table' => 'network',
272
   'fields' => array( 'client',
273
                        'site',
274
                        'device',
275
                        'interface',
276
                        'address',
277
                        'netmask',
278
                        'ip6',
279
                        'ip6net',
280
                        'mtu',
281
                        'mac',
282
                        'added_date',
283
                        'removed_date'
284
                     ),
285
                     'query' => 'select client.name client,
286
                                       site.name site,
287
                                       device.name device,
288
                                       network.interface,
289
                                       network.address,
290
                                       network.netmask,
291
                                       network.ip6,
292
                                       network.ip6net,
293
                                       network.mtu,
294
                                       network.mac,
295
                                       network.added_date,
296
                                       network.removed_date
297
                                 from network join device using (device_id) join site using (site_id) join client using (client_id)',
298
                     'insert' => 'insert into network (device_id,interface,address,netmask,ip6,ip6net,mtu,mac,added_date,removed_date)
299
                                    select device_id,<interface>,<address>,<netmask>,<ip6>,<ip6net>,<mtu>,<mac>,<added_date>,<removed_date> 
300
                                    from device join site using (site_id) join client using (client_id)
301
                                    where client.name = <client>
302
                                          and site.name = <site>
303
                                          and device.name = <device>'
304
   );
305
 
306
   $BACKUP_DATA['sysinfo_report'] = array(
307
   'table' => 'sysinfo_report',
308
   'fields' => array( 'client',
309
                        'site',
310
                        'device',
311
                        'version',
312
                        'added_date',
313
                        'report_date'
314
                     ),
315
                     'query' => 'select client.name client,
316
                                       site.name site,
317
                                       device.name device,
318
                                       sysinfo_report.version,
319
                                       sysinfo_report.added_date,
320
                                       sysinfo_report.report_date
321
                                 from sysinfo_report join device using (device_id) join site using (site_id) join client using (client_id)',
322
                     'insert' => 'insert into sysinfo_report(device_id,version,added_date,report_date) 
323
                                  select device_id,<version>,<added_date>,<report_date>
324
                                    from device join site using (site_id) join client using (client_id)
325
                                    where client.name = <client>
326
                                          and site.name = <site>
327
                                          and device.name = <device>'
328
   );
329
 
330
 
331
 
332
 
333
 
334
 
335
?>