Inserting records for business hours aggregation

Perform the following steps to insert records into the reporting database. The code in this procedure is for demonstration purposes only. This example assumes that you have two data centers (Austin and Bangalore) already defined and the metrics you want to filter on are called analytics_test1 and analytics_test2:
  1. Log in to the Analytics reporting database as the root user or a user with administrative permissions.
    mysql -u root reporting
  2. Enter the following commands at the prompt substituting values that apply to your company's situation. The first section of the following inserts groups. If you already have groups, ignore this section and customize the commands to your situation:
    insert into dim_group
       (group_key, sid, zenoss_instance_key, id, device_organizer_name, device_key,
           device_organizer_uid)
    values
       (1001, '8525e4e2-4da4-4da5-8d4c-20ec70eaae0b/analytics_test_1', 1, 'AustinDataCenter',
          'AustinDataCenter', 1, '/zport/dmd/Groups/AustinDataCenter'),
       (1002, '8525e4e2-4da4-4da5-8d4c-20ec70eaae0b/analytics_test_3', 1, 'AustinDataCenter',
          'AustinDataCenter', 3, '/zport/dmd/Groups/AustinDataCenter'),
       (1003, '8525e4e2-4da4-4da5-8d4c-20ec70eaae0b/analytics_test_2', 1, 'BangaloreDataCenter',
          'BangaloreDataCenter', 2, '/zport/dmd/Groups/BangaloreDataCenter'),
       (1004, '8525e4e2-4da4-4da5-8d4c-20ec70eaae0b/analytics_test_4', 1, 'BangaloreDataCenter',
          'BangaloreDataCenter', 4, '/zport/dmd/Groups/BangaloreDataCenter');
      
    insert into group_filter
       (name, description, zenoss_instance_key, device_organizer_uid)
    values
       ('austin', 'Devices in the Austin data center', 1, '/zport/dmd/Groups/AustinDataCenter'),
       ('bangalore', 'Devices in the Bangalore data center', 1,
           '/zport/dmd/Groups/BangaloreDataCenter');
    
    
    insert into meta_metric (metric_name)
    values ('analytics_test1'), ('analytics_test2');
    
    
    insert into business_hours_config
       (name, description, shift_by, shift_start_time, shift_end_time)
    values
       ('austin', 'Austin data center', '-06:00', '8:00', '16:00'),
       ('bangalore', 'Bangalore data center', '-09:30', '7:00', '17:00');
    
    insert into business_hours_group_assoc
       (business_hours_config_id, group_filter_id)
    values
       (
          (select id from business_hours_config where name='austin'),
          (select id from group_filter where name='austin')
       ),
       (
          (select id from business_hours_config where name='bangalore'),
          (select id from group_filter where name='bangalore')
       );
    
    insert into business_hours_metric_assoc
       (business_hours_config_id, metric_key)
    values
       (
          (select id from business_hours_config where name='austin'),
          (select metric_key from meta_metric where metric_name='analytics_test1')
       ),
       (
          (select id from business_hours_config where name='austin'),
          (select metric_key from meta_metric where metric_name='analytics_test2')
       ),
       (
          (select id from business_hours_config where name='bangalore'),
          (select metric_key from meta_metric where metric_name='analytics_test1')
       ),
       (
          (select id from business_hours_config where name='bangalore'),
          (select metric_key from meta_metric where metric_name='analytics_test2')
       );