Subversion Repositories computer_asset_manager_v1

Rev

Blame | Last modification | View Log | Download | RSS feed

<?php

   global $BACKUP_DATA;
   $BACKUP_DATA['unknown_entry'] = array(
      'table' => 'unknown_entry',
      'fields' => array(  'client_name',
                          'device_name',
                          'report_date',
                          'processed_date',
                          'processed_by',
                        ),
                     'query' => 'select client_name,device_name,report_date,processed_date,login.email processed_by
                                 from unknown_entry join login on processed_by = login_id',
                     'insert' => 'insert into unknown_entry(client_name,device_name,report_date,processed_date,processed_by)
                                  select <client_name>,<device_name>,<report_date>,<processed_date>,login_id from login where email = <processed_by>'
     );
   
   $BACKUP_DATA['operating_system'] = array(
   'table' => 'operating_system',
   'fields' => array( 'name',
                        'version',
                        'kernel',
                        'distro',
                        'distro_description',
                        'distro_release',
                        'distro_codename',
                        'added_date',
                        'removed_date'
                     ),
                     

                     'query' => 'select name,version,kernel,distro,distro_description,distro_release,distro_codename,added_date,removed_date from operating_system',
                     'insert' => 'insert into operating_system(name,version,kernel,distro,distro_description,distro_release,distro_codename,added_date,removed_date) 
                                  select <name>,<version>,<kernel>,<distro>,<distro_description>,<distro_release>,<distro_codename>,<added_date>,<removed_date>'
   );
   
   $BACKUP_DATA['software'] = array(
   'table' => 'software',
   'fields' => array( 'package_name',
                        'description',
                        'added_date',
                        'removed_date'
                     ),
                     'query' => 'select package_name,description,added_date,removed_date from software',
                     'insert' => 'insert into software(package_name,description,added_date,removed_date) 
                                  select <package_name>,<description>,<added_date>,<removed_date>'
   );
   
   $BACKUP_DATA['software_version'] = array(
   'table' => 'software_version',
   'fields' => array( 'version',
                        'added_date',
                        'removed_date'
                     ),
                     'query' => 'select version,added_date,removed_date from software_version',
                     'insert' => 'insert into software_version(version,added_date,removed_date) 
                                  select <version>,<added_date>,<removed_date>'
   );
   
   $BACKUP_DATA['computer_uptime'] = array(
   'table' => 'computer_uptime',
   'fields' => array(   'last_reboot',
                        'added_date',
                        'removed_date',
                        'client',
                        'site',
                        'device'
                     ),
                     'query' => 'select client.name client,site.name site,device.name device, computer_uptime.last_reboot,computer_uptime.added_date,computer_uptime.removed_date
                                 from computer_uptime join device using (device_id) join site using (site_id) join client using (client_id)',
                     'insert' => 'insert into computer_uptime (device_id,last_reboot,added_date,removed_date)
                                 select device.device_id,<last_reboot>,<added_date>,<removed_date> 
                                 from device join site using (site_id) join client using (client_id)
                                 where client.name = <client>
                                       and site.name = <site>
                                       and device.name = <device>'
   );
   
   $BACKUP_DATA['pci_devices'] = array (
                         'table' => 'device',
                         'fields' => array(  'client',
                                             'site',
                                             'device_type',
                                             'part_of',
                                             'name',
                                             'notes',
                                             'added_date',
                                             'removed_date'
                                          ),
                         '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
                                      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
                                      where device_type.show_as_system != 'Y'
                                    ",
                         'insert' => 'insert into device(site_id,device_type_id,part_of,name,notes,added_date,removed_date)
                                      select site.site_id,device_type.device_type_id,parent.device_id,<name>,<notes>,<added_date>,<removed_date> 
                                      from client join site using (client_id) join device parent, device_type 
                                      where client.name = <client> and site.name=<site> and device_type.name=<device_type> and parent.name = <part_of>'
      );
      
   $BACKUP_DATA['pci_attribs'] = array(
                          'table' => 'device_attrib',
                          'fields' => array('client',
                                             'site',
                                             'device',
                                             'part_of',
                                             'attrib',
                                             'value',
                                             'added_date',
                                             'removed_date'
                                      ),
                     'query' => "select client.name client,
                                       site.name site,
                                       device.name device,
                                       parent.name part_of,
                                       attrib.name attrib,
                                       device_attrib.value value,
                                       device_attrib.added_date,
                                       device_attrib.removed_date
                                 from device_attrib join device on device_attrib.device_id=device.device_id 
                                       join device parent on device.part_of = parent.device_id
                                       join site on device.site_id = site.site_id 
                                       join client on site.client_id=client.client_id
                                       join attrib on device_attrib.attrib_id=attrib.attrib_id
                                       join device_type on device.device_type_id=device_type.device_type_id
                                 where device_type.show_as_system != 'Y'",
                     'insert' => 'insert into device_attrib(device_id,attrib_id,value,added_date,removed_date)
                                      select device.device_id,attrib.attrib_id,<value>,<added_date>,<removed_date> 
                                      from client join site using (client_id) 
                                           join device using (site_id) 
                                           join device parent on device.part_of = parent.device_id,
                                           attrib
                                      where client.name = <client> 
                                            and site.name=<site> 
                                            and device.name=<device> 
                                            and parent.name = <part_of> 
                                            and attrib.name = <attrib>'
   );
   
   $BACKUP_DATA['device_operating_system'] = array(
   'table' => 'device_operating_system',
   'fields' => array(   'name',
                        'kernel',
                        'distro',
                        'release',
                        'added_date',
                        'removed_date',
                        'client',
                        'site',
                        'device'
                     ),
                     'query' => 'select client.name client,
                                       site.name site,
                                       device.name device,
                                       operating_system.name name,
                                       operating_system.kernel "kernel",
                                       operating_system.distro "distro",
                                       operating_system.distro_release "release",
                                       device_operating_system.added_date,
                                       device_operating_system.removed_date
                                 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)',
                     'insert' => 'insert into device_operating_system (device_id,operating_system_id,added_date,removed_date)
                                 select device.device_id,operating_system_id,<added_date>,<removed_date> 
                                 from device join site using (site_id) join client using (client_id), operating_system
                                 where client.name = <client>
                                       and site.name = <site>
                                       and device.name = <device>
                                       and operating_system.name = <name>
                                       and operating_system.kernel = <kernel>
                                       and operating_system.distro = <distro>
                                       and operating_system.distro_release = <release>'
   );
   
   $BACKUP_DATA['disk_info'] = array(
   'table' => 'disk_info',
   'fields' => array(   'disk_device',
                        'filesystem',
                        'mount_point',
                        'capacity',
                        'added_date',
                        'removed_date',
                        'client',
                        'site',
                        'device'
                     ),
                     'query' => 'select client.name client,
                                       site.name site,
                                       device.name device,
                                       disk_info.disk_device,
                                       disk_info.filesystem,
                                       disk_info.mount_point,
                                       disk_info.capacity,
                                       disk_info.added_date,
                                       disk_info.removed_date
                                 from disk_info join device using (device_id) join site using (site_id) join client using (client_id)',
                     'insert' => 'insert into disk_info (device_id,disk_device,filesystem,mount_point,capacity,added_date,removed_date)
                                 select device.device_id,<disk_device>,<filesystem>,<mount_point>,<capacity>,<added_date>,<removed_date> 
                                 from device join site using (site_id) join client using (client_id)
                                 where client.name = <client>
                                       and site.name = <site>
                                       and device.name = <device>'
   );
   
   $BACKUP_DATA['disk_space'] = array(
   'table' => 'disk_space',
   'fields' => array(   'client',
                        'site',
                        'device',
                        'disk_device',
                        'filesystem',
                        'mount_point',
                        'capacity',
                        'space_used',
                        'added_date',
                        'removed_date'
                     ),
                     'query' => 'select client.name client,
                                       site.name site,
                                       device.name device,
                                       disk_info.disk_device,
                                       disk_info.filesystem,
                                       disk_info.mount_point,
                                       disk_info.capacity,
                                       disk_space.space_used,
                                       disk_space.added_date,
                                       disk_space.removed_date
                                 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)',
                     'insert' => 'insert into disk_space (disk_info_id,space_used,added_date,removed_date)
                                    select disk_info_id,<space_used>,<added_date>,<removed_date> 
                                    from disk_info join device using (device_id) join site using (site_id) join client using (client_id)
                                    where client.name = <client>
                                          and site.name = <site>
                                          and device.name = <device>
                                          and disk_info.disk_device = <disk_device>
                                          and disk_info.filesystem = <filesystem>
                                          and disk_info.mount_point = <mount_point>
                                          and disk_info.capacity = <capacity>'
   );

   $BACKUP_DATA['installed_packages'] = array(
   'table' => 'installed_packages',
   'fields' => array( 'client',
                        'site',
                        'device',
                        'software',
                        'software_version',
                        'added_date',
                        'removed_date'
                     ),
                     'query' => 'select client.name client,
                                       site.name site,
                                       device.name device,
                                       software.package_name software,
                                       software_version.version software_version,
                                       installed_packages.added_date,
                                       installed_packages.removed_date
                                 from installed_packages join device using (device_id) join site using (site_id) join client using (client_id)
                                    join software using (software_id) join software_version using (software_version_id)',
                     'insert' => 'insert into installed_packages (device_id,software_id,software_version_id, added_date,removed_date)
                                 select device_id,software_id,software_version_id,<added_date>,<removed_date> 
                                 from device join site using (site_id) join client using (client_id),
                                      software, 
                                      software_version
                                 where client.name = <client>
                                       and site.name = <site>
                                       and device.name = <device>
                                       and software.package_name = <software>
                                       and software_version.version = <software_version>'
   );

   $BACKUP_DATA['network'] = array(
   'table' => 'network',
   'fields' => array( 'client',
                        'site',
                        'device',
                        'interface',
                        'address',
                        'netmask',
                        'ip6',
                        'ip6net',
                        'mtu',
                        'mac',
                        'added_date',
                        'removed_date'
                     ),
                     'query' => 'select client.name client,
                                       site.name site,
                                       device.name device,
                                       network.interface,
                                       network.address,
                                       network.netmask,
                                       network.ip6,
                                       network.ip6net,
                                       network.mtu,
                                       network.mac,
                                       network.added_date,
                                       network.removed_date
                                 from network join device using (device_id) join site using (site_id) join client using (client_id)',
                     'insert' => 'insert into network (device_id,interface,address,netmask,ip6,ip6net,mtu,mac,added_date,removed_date)
                                    select device_id,<interface>,<address>,<netmask>,<ip6>,<ip6net>,<mtu>,<mac>,<added_date>,<removed_date> 
                                    from device join site using (site_id) join client using (client_id)
                                    where client.name = <client>
                                          and site.name = <site>
                                          and device.name = <device>'
   );
   
   $BACKUP_DATA['sysinfo_report'] = array(
   'table' => 'sysinfo_report',
   'fields' => array( 'client',
                        'site',
                        'device',
                        'version',
                        'added_date',
                        'report_date'
                     ),
                     'query' => 'select client.name client,
                                       site.name site,
                                       device.name device,
                                       sysinfo_report.version,
                                       sysinfo_report.added_date,
                                       sysinfo_report.report_date
                                 from sysinfo_report join device using (device_id) join site using (site_id) join client using (client_id)',
                     'insert' => 'insert into sysinfo_report(device_id,version,added_date,report_date) 
                                  select device_id,<version>,<added_date>,<report_date>
                                    from device join site using (site_id) join client using (client_id)
                                    where client.name = <client>
                                          and site.name = <site>
                                          and device.name = <device>'
   );






?>

Generated by GNU Enscript 1.6.5.90.