-- CLOUD-12000 Disk R/W 메트릭 변경 - Read, Write 반대로 설정
UPDATE metric_meta2 SET expr = 'sum by(xm_clst_id, xm_pod_id, xm_cont_name, data_type) (label_replace(rate(container_fs_writes_bytes_total{xm_entity_type="Container",{filter}}[1m]), "data_type", "Write" ,  "", "") or label_replace(rate(container_fs_reads_bytes_total{xm_entity_type="Container",{filter}}[1m]), "data_type", "Read", "" ,  ""))' WHERE id ='container_disk_read_write_byte';
UPDATE metric_meta2 SET expr = 'sum by(xm_clst_id, xm_pod_id, data_type) (label_replace(rate(container_fs_writes_bytes_total{xm_entity_type="Container",{filter}}[1m]), "data_type", "Write" ,  "", "") or label_replace(rate(container_fs_reads_bytes_total{xm_entity_type="Container",{filter}}[1m]), "data_type", "Read", "" ,  ""))' WHERE id ='pod_disk_read_write_byte';
UPDATE menu_meta SET description = 'My List' WHERE url = 'documentDashboard';
UPDATE menu_meta SET description = 'Shared List' WHERE url = 'templateDashboard';
UPDATE auth_resource2 SET description = 'My List' WHERE id = 48;
UPDATE auth_resource2 SET description = 'Shared List' WHERE id = 49;
UPDATE auth_resource3 SET description = 'My List' WHERE id = 48;
UPDATE auth_resource3 SET description = 'Shared List' WHERE id = 49;
UPDATE auth_resource3 SET description = 'menu|Dashboards|My List' WHERE id = 110;
UPDATE auth_resource3 SET description = 'menu|Dashboards|hared List' WHERE id = 111;

-- Dashboard 추가 (Postgres , Redis , Traefik , MySQL / MariaDB , Nginx-Ingress)
INSERT INTO public.auth_resource3 (name, is_deleted, tenant_id) VALUES ('dashboard|admin|Postgres', false, null);
INSERT INTO public.auth_resource3 (name, is_deleted, tenant_id) VALUES ('dashboard|admin|Redis', false, null);
INSERT INTO public.auth_resource3 (name, is_deleted, tenant_id) VALUES ('dashboard|admin|Traefik', false, null);
INSERT INTO public.auth_resource3 (name, is_deleted, tenant_id) VALUES ('dashboard|admin|MySQL / MariaDB', false, null);
INSERT INTO public.auth_resource3 (name, is_deleted, tenant_id) VALUES ('dashboard|admin|Nginx-Ingress', false, null);

INSERT INTO public.dashboard2 (id, created_date, modified_date, layout, title, auth_resource_id, created_by, modified_by, description, "share")
  VALUES(nextval('hibernate_sequence'), '2020-04-28 09:23:14.286', '2020-04-28 09:23:44.213', '[{"i":"widget0","widget":{"header":"default-header","body":"label-view","title":" "},"w":48,"h":3,"minW":2,"minH":1,"maxW":48,"maxH":36,"component":{"api":{},"visualization":{"background":null,"fontSize":18,"textAlign":"left","padding":[0,18],"sideways":false,"fontWeight":"bold","text":"Resource Utilization"}},"x":0,"y":9,"static":true},{"i":"widget1","widget":{"header":"default-header","body":"line-chart-view","title":"CPU Usage (%)","description":"postgres에 대한 pod들의 cpu 사용량"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_cpu_usage_by_workload","entityId":"postgres","type":"workload"}},"visualization":{"showLegend":true}},"x":0,"y":12,"static":true},{"i":"widget2","widget":{"header":"default-header","body":"line-chart-view","title":"Memory Usage (GiB)"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_memory_working_set_bytes_by_workload","entityId":"postgres","type":"workload"}},"visualization":{"showLegend":true}},"x":12,"y":12,"static":true},{"i":"widget4","widget":{"header":"default-header","body":"line-chart-view","title":"Network Recieved (KiB)"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_network_receive_by_workload","entityId":"postgres","type":"workload"}},"visualization":{"showLegend":true,"background":null,"fontSize":12,"textAlign":"center","padding":[0,18],"sideways":false}},"x":36,"y":12,"static":true},{"i":"widget3","widget":{"header":"default-header","body":"line-chart-view","title":"Network Transmit (KiB)"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_network_transmit_by_workload","entityId":"postgres","type":"workload"}},"visualization":{"showLegend":true}},"x":24,"y":12,"static":true},{"i":"widget5","widget":{"header":"default-header","body":"label-view","title":" "},"w":48,"h":3,"minW":2,"minH":1,"maxW":48,"maxH":36,"component":{"api":{},"visualization":{"background":null,"fontSize":18,"textAlign":"left","padding":[0,18],"sideways":false,"fontWeight":"bold","text":"General Statics"}},"x":0,"y":22,"static":true},{"i":"widget6","widget":{"header":"default-header","body":"horizontal-bar-chart-view","title":"Lock mode"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"pg_count_by_lockmode","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":25,"static":true},{"i":"widget7","widget":{"header":"default-header","body":"horizontal-bar-chart-view","title":"Connection By DB and State"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"pg_count_by_dbname_state","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":25,"static":true},{"i":"widget8","widget":{"header":"default-header","body":"stat-view","title":"Number of Client Connection"},"w":17,"h":6,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_activity_count","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[],"showLegend":true}},"x":15,"y":3,"static":true},{"i":"widget9","widget":{"header":"default-header","body":"label-view","title":" "},"w":48,"h":3,"minW":2,"minH":1,"maxW":48,"maxH":36,"component":{"api":{},"visualization":{"background":null,"fontSize":18,"textAlign":"left","padding":[0,18],"sideways":false,"fontWeight":"bold","text":"Overview"}},"x":0,"y":0,"static":true},{"i":"widget11","widget":{"header":"default-header","body":"stat-view","title":"Lock Count"},"w":16,"h":6,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"pg_locks_count","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":32,"y":3,"static":true},{"i":"widget10","widget":{"header":"default-header","body":"stat-view","title":"Up"},"w":15,"h":6,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"pg_up","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[{"color":"#32AC2D","value":"1"}]}},"x":0,"y":3,"static":true},{"i":"widget12","widget":{"header":"default-header","body":"line-chart-view","title":"Buffer Cache Hit Ratio (%)"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_cache_hit_ratio","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true,"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":0,"y":36,"static":true},{"i":"widget13","widget":{"header":"default-header","body":"line-chart-view","title":"Read/Write spent time by file blocks"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_blk_read_write_time","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true,"row":8,"column":["date","value"]}},"x":24,"y":36,"static":true},{"i":"widget14","widget":{"header":"default-header","body":"label-view","title":" "},"w":48,"h":3,"minW":2,"minH":1,"maxW":48,"maxH":36,"component":{"api":{},"visualization":{"background":null,"fontSize":18,"textAlign":"left","padding":[0,18],"sideways":false,"fontWeight":"bold","text":"Block"}},"x":0,"y":47,"static":true},{"i":"widget15","widget":{"header":"default-header","body":"line-chart-view","title":"Number of Disk Blocks Read"},"w":48,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_blks_read","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":61,"static":true},{"i":"widget17","widget":{"header":"default-header","body":"line-chart-view","title":"Number of Rows Inserted"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_tup_inserted","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":75,"static":true},{"i":"widget18","widget":{"header":"default-header","body":"line-chart-view","title":"Time Spent Reading Data File Blocks (ms)"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_blk_read_time","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":50,"static":true},{"i":"widget19","widget":{"header":"default-header","body":"line-chart-view","title":"Time Spent Writing Data File Blocks (ms)"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_blk_write_time","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":50,"static":true},{"i":"widget20","widget":{"header":"default-header","body":"label-view","title":" "},"w":48,"h":3,"minW":2,"minH":1,"maxW":48,"maxH":36,"component":{"api":{},"visualization":{"background":null,"fontSize":18,"textAlign":"left","padding":[0,18],"sideways":false,"fontWeight":"bold","text":"Row"}},"x":0,"y":72,"static":true},{"i":"widget16","widget":{"header":"default-header","body":"line-chart-view","title":"Number of Rows Updated"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_tup_updated","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":75,"static":true},{"i":"widget21","widget":{"header":"default-header","body":"stack-bar-chart-view","title":"Number of Transactions Committed"},"w":24,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_xact_commit","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":110,"static":true},{"i":"widget22","widget":{"header":"default-header","body":"line-chart-view","title":"Number of Rows Returned"},"w":48,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_tup_returned","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":97,"static":true},{"i":"widget23","widget":{"header":"default-header","body":"line-chart-view","title":"Number of Rows Fetched"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_tup_fetched","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":86,"static":true},{"i":"widget24","widget":{"header":"default-header","body":"line-chart-view","title":"Number of Rows Deleted"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_tup_deleted","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":86,"static":true},{"i":"widget25","widget":{"header":"default-header","body":"label-view","title":" "},"w":48,"h":3,"minW":2,"minH":1,"maxW":48,"maxH":36,"component":{"api":{},"visualization":{"background":null,"fontSize":18,"textAlign":"left","padding":[0,18],"sideways":false,"fontWeight":"bold","text":"Transaction"}},"x":0,"y":107,"static":true},{"i":"widget26","widget":{"header":"default-header","body":"stack-bar-chart-view","title":"Number of Transactions Rolled Back"},"w":24,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"pg_stat_database_xact_rollback","entityId":"","type":"PostgreSQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":110,"static":true}]',
  'Postgres', (select id from auth_resource3 where name='dashboard|admin|Postgres'), 'admin', 'admin', NULL, true);
INSERT INTO public.dashboard2 (id, created_date, modified_date, layout, title, auth_resource_id, created_by, modified_by, description, "share")
  VALUES(nextval('hibernate_sequence'), '2020-04-28 09:23:14.286', '2020-04-28 09:23:44.213', '[{"i":"widget0","widget":{"header":"default-header","body":"line-chart-view","title":"CPU Usage (%)","description":"Redis Pod에 대한 CPU 사용량"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_cpu_usage_core_by_workload","entityId":"redis-master,redis-slave","type":"workload","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":7,"static":true},{"i":"widget1","widget":{"header":"default-header","body":"line-chart-view","title":"Memory Usage (GiB)"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_memory_usage_bytes_by_workload","entityId":"redis-master,redis-slave","type":"workload","filter":""}},"visualization":{"showLegend":true}},"x":12,"y":7,"static":true},{"i":"widget2","widget":{"header":"default-header","body":"line-chart-view","title":"Network Transmit (KB)"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_network_transmit_by_workload","entityId":"redis-master,redis-slave","type":"workload"}},"visualization":{"showLegend":true}},"x":24,"y":7,"static":true},{"i":"widget3","widget":{"header":"default-header","body":"line-chart-view","title":"Network Recieved (KiB)"},"w":12,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"imxc","metricId":"container_network_receive_by_workload","entityId":"redis-master,redis-slave","type":"workload"}},"visualization":{"showLegend":true}},"x":36,"y":7,"static":true},{"i":"widget4","widget":{"header":"default-header","body":"stat-view","title":"Redis Up Count"},"w":12,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"redis_up","entityId":"","type":"Redis","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[{"color":"#32AC2D","value":"1"}]}},"x":0,"y":0,"static":true},{"i":"widget5","widget":{"header":"default-header","body":"stat-view","title":"Connected Clients Count"},"w":12,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"redis_connected_clients","entityId":"","type":"Redis","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":12,"y":0,"static":true},{"i":"widget6","widget":{"header":"default-header","body":"stat-view","title":"Blocked Client Count"},"w":12,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"redis_blocked_clients","entityId":"","type":"Redis","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":null,"baseColor":"#409EFF","thresholds":[],"showLegend":true}},"x":36,"y":0,"static":true},{"i":"widget7","widget":{"header":"default-header","body":"horizontal-bar-chart-view","title":"Calls per command"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"redis_commands_total","entityId":"","type":"Redis","filter":""}},"visualization":{"showLegend":true,"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":null,"baseColor":"#409EFF","thresholds":[]}},"x":0,"y":26,"static":true},{"i":"widget8","widget":{"header":"default-header","body":"line-chart-view","title":"Command duration"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"redis_commands_duration_seconds","entityId":"","type":"Redis","filter":"","jspdCluster":null}},"visualization":{"showLegend":true}},"x":24,"y":26,"static":true},{"i":"widget9","widget":{"header":"default-header","body":"stat-view","title":"Rejected Client Count"},"w":12,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"redis_rejected_connections","entityId":"","type":"Redis","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":24,"y":0,"static":true},{"i":"widget10","widget":{"header":"default-header","body":"line-chart-view","title":"DB Key"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"redis_db_keys","entityId":"","type":"Redis","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":37,"static":true},{"i":"widget11","widget":{"header":"default-header","body":"line-chart-view","title":"DB Expired Key"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"redis_expired_keys","entityId":"","type":"Redis","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":37,"static":true},{"widget":{"header":"default-header","body":"stat-view","title":"Connected Slave"},"w":16,"h":9,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"redis_connected_slaves","entityId":"","type":"Redis","filter":""}},"visualization":{"showLegend":true,"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"i":"widget12","static":true,"x":0,"y":17},{"widget":{"header":"default-header","body":"line-chart-view","title":"Slave Offset Bytes"},"w":16,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"redis_connected_slave_offset_bytes","entityId":"","type":"Redis","filter":""}},"visualization":{"showLegend":true}},"i":"widget13","static":true,"x":16,"y":17},{"widget":{"header":"default-header","body":"line-chart-view","title":"Slave Lag Seconds"},"w":16,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"redis_connected_slave_lag_seconds","entityId":"","type":"Redis","filter":""}},"visualization":{"showLegend":true}},"i":"widget14","static":true,"x":32,"y":17}]',
  'Redis', (select id from auth_resource3 where name='dashboard|admin|Redis'), 'admin', 'admin', NULL, true);
INSERT INTO public.dashboard2 (id, created_date, modified_date, layout, title, auth_resource_id, created_by, modified_by, description, "share")
  VALUES(nextval('hibernate_sequence'), '2020-04-28 09:23:14.286', '2020-04-28 09:23:44.213', '[{"i":"widget0","widget":{"header":"default-header","body":"stat-view","title":"4xx Error Per Seconds"},"w":8,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_4xx_error_rate_last_5m","entityId":"","type":"Traefik","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"rgba(255, 0, 0, 1)","thresholds":[],"showLegend":true}},"x":8,"y":0,"static":true},{"i":"widget1","widget":{"header":"default-header","body":"stat-view","title":"5xx Error Per Seconds"},"w":8,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_5xx_error_rate_last_5m","entityId":"","type":"Traefik","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"rgba(255, 0, 0, 1)","thresholds":[]}},"x":16,"y":0,"static":true},{"i":"widget2","widget":{"header":"default-header","body":"line-chart-view","title":"Pod CPU Utilization (Core)"},"w":24,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"traefik","metricId":"container_cpu_usage_core_by_workload","entityId":"deploymentList,traefik","type":"workload"}},"visualization":{"showLegend":true}},"x":0,"y":7,"static":true},{"i":"widget3","widget":{"header":"default-header","body":"stat-view","title":"Total Request Per Seconds"},"w":8,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_http_requests_rate_last_5m","entityId":"","type":"Traefik","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":0,"y":0,"static":true},{"i":"widget4","widget":{"header":"default-header","body":"stat-view","title":"Bad Request Count (10m)"},"w":8,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_http_requests_bad_total_last_10m","entityId":"","type":"Traefik","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":null,"baseColor":"rgba(255, 0, 0, 1)","thresholds":[]}},"x":32,"y":0,"static":true},{"i":"widget5","widget":{"header":"default-header","body":"stat-view","title":"Avg. Response Duration (10m)"},"w":8,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_http_response_time_ms","entityId":"","type":"Traefik","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"rgba(64, 158, 255, 1)","thresholds":[]}},"x":40,"y":0,"static":true},{"i":"widget6","widget":{"header":"default-header","body":"stat-view","title":"Total Request Count (10m)"},"w":8,"h":7,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_http_requests_total_last_10m","entityId":"","type":"Traefik","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":null,"baseColor":"#409EFF","thresholds":[]}},"x":24,"y":0,"static":true},{"i":"widget7","widget":{"header":"default-header","body":"line-chart-view","title":"Pod Memory Utilization (GiB)"},"w":24,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"traefik","metricId":"container_memory_working_set_bytes_by_workload","entityId":"deploymentList,traefik","type":"workload"}},"visualization":{"showLegend":true}},"x":24,"y":7,"static":true},{"widget":{"header":"default-header","body":"line-chart-view","title":"ENTRYPOINT - Open Connections"},"w":24,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_entrypoint_open_connections","entityId":"","type":"Traefik","filter":""}},"visualization":{"showLegend":true}},"i":"widget8","static":true,"x":0,"y":26},{"widget":{"header":"default-header","body":"line-chart-view","title":"SERVICE - Open Connections"},"w":24,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_service_open_connections","entityId":"","type":"Traefik","filter":""}},"visualization":{"showLegend":true}},"i":"widget9","static":true,"x":24,"y":26},{"widget":{"header":"default-header","body":"stack-bar-chart-view","title":"Used Sockets"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_soket_used","entityId":"","type":"Traefik","filter":""}},"visualization":{"showLegend":true}},"i":"widget10","static":true,"x":0,"y":35},{"widget":{"header":"default-header","body":"stack-bar-chart-view","title":"Access to services / sec"},"w":24,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_http_requests_rate_by_service","entityId":"","type":"Traefik","filter":""}},"visualization":{"showLegend":true}},"i":"widget11","static":true,"x":0,"y":16},{"widget":{"header":"default-header","body":"stack-bar-chart-view","title":"Access to Entrypoints / sec"},"w":24,"h":10,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_http_requests_rate_by_entrypoint","entityId":"","type":"Traefik","filter":""}},"visualization":{"showLegend":true}},"i":"widget12","static":true,"x":24,"y":16},{"widget":{"header":"default-header","body":"horizontal-bar-chart-view","title":"Horizontal Bar Chart"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"traefik_status_code_count","entityId":"","type":"Traefik","filter":""}},"visualization":{"showLegend":true}},"i":"widget13","static":true,"x":24,"y":35}]',
  'Traefik', (select id from auth_resource3 where name='dashboard|admin|Traefik'), 'admin', 'admin', NULL, true);
INSERT INTO public.dashboard2 (id, created_date, modified_date, layout, title, auth_resource_id, created_by, modified_by, description, "share")
  VALUES(nextval('hibernate_sequence'), '2020-04-28 09:23:14.286', '2020-04-28 09:23:44.213', '[{"i":"widget0","widget":{"header":"default-header","body":"stat-view","title":"Current QPS"},"w":8,"h":8,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_query_per_second","entityId":"","type":"MySQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[],"showLegend":true}},"x":16,"y":0,"static":true},{"i":"widget1","widget":{"header":"default-header","body":"stat-view","title":"InnoDB Buffer Pool Size (GiB)"},"w":8,"h":8,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_Innodb_buffer_pool_size","entityId":"","type":"MySQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[],"showLegend":true}},"x":8,"y":0,"static":true},{"i":"widget2","widget":{"header":"default-header","body":"stat-view","title":"Number of Connection Attempts"},"w":8,"h":8,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_global_status_connections","entityId":"","type":"MySQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":40,"y":0,"static":true},{"i":"widget3","widget":{"header":"default-header","body":"stat-view","title":"Max Connection","description":"Maximum permitted number of simultaneous client connections. By default, this is 151."},"w":8,"h":8,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_global_variables_max_connections","entityId":"","type":"MySQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":24,"y":0,"static":true},{"i":"widget4","widget":{"header":"default-header","body":"stat-view","title":"Number of Max Used Connection","description":"Maximum number of connections that have been in use simultaneously since the server started."},"w":8,"h":8,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_global_status_max_used_connections","entityId":"","type":"MySQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":32,"y":0,"static":true},{"i":"widget5","widget":{"header":"default-header","body":"stat-view","title":"Instance Up Count"},"w":8,"h":8,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_up","entityId":"","type":"MySQL","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[],"showLegend":true}},"x":0,"y":0,"static":true},{"i":"widget6","widget":{"header":"default-header","body":"line-chart-view","title":"Buffer Cache Hit Ratio"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_cache_hit_ratio","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":19,"static":true},{"i":"widget7","widget":{"header":"default-header","body":"line-chart-view","title":"Disk R/W Bytes"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_disk_io","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":8,"static":true},{"i":"widget8","widget":{"header":"default-header","body":"line-chart-view","title":"Buffer I/O Bytes"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_buffer_io","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":19,"static":true},{"i":"widget9","widget":{"header":"default-header","body":"line-chart-view","title":"Network Recieved / Transmit (KiB)"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_bytes_received_sent","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":8,"static":true},{"i":"widget10","widget":{"header":"default-header","body":"stack-bar-chart-view","title":"Number of Locks"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_status_locks","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":30,"static":true},{"i":"widget11","widget":{"header":"default-header","body":"line-chart-view","title":"MySQL Questions"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_global_status_questions","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"x":24,"y":30,"static":true},{"i":"widget12","widget":{"header":"default-header","body":"line-chart-view","title":"Line Chart"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_threads_total","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":41,"static":true},{"widget":{"header":"default-header","body":"horizontal-bar-chart-view","title":"Command Executed"},"w":24,"h":11,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"mysql_global_status_commands_total","entityId":"","type":"MySQL","filter":""}},"visualization":{"showLegend":true}},"i":"widget13","static":true,"x":24,"y":41}]',
  'MySQL / MariaDB', (select id from auth_resource3 where name='dashboard|admin|MySQL / MariaDB'), 'admin', 'admin', NULL, true);
INSERT INTO public.dashboard2 (id, created_date, modified_date, layout, title, auth_resource_id, created_by, modified_by, description, "share")
  VALUES(nextval('hibernate_sequence'), '2020-04-28 09:23:14.286', '2020-04-28 09:23:44.213', '[{"i":"widget0","widget":{"header":"default-header","body":"stat-view","title":"Up"},"w":9,"h":9,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"nginx_ingress_nginx_up","entityId":"","type":"Nginx-Ingress","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":0,"y":0,"static":true},{"i":"widget1","widget":{"header":"default-header","body":"line-chart-view","title":"CPU Usage (%)"},"w":12,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"nginx-ingress","metricId":"container_cpu_usage_core_by_workload","entityId":"deploymentList,nginx-ingress-nginx-ingress","type":"workload"}},"visualization":{"showLegend":true}},"x":0,"y":9,"static":true},{"i":"widget2","widget":{"header":"default-header","body":"line-chart-view","title":"Memory Usage (GiB)"},"w":12,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"nginx-ingress","metricId":"container_memory_usage_by_workload","entityId":"deploymentList,nginx-ingress-nginx-ingress","type":"workload"}},"visualization":{"showLegend":true}},"x":12,"y":9,"static":true},{"i":"widget3","widget":{"header":"default-header","body":"stat-view","title":"Connected Clients Count"},"w":10,"h":9,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"nginx_ingress_nginx_connections_active","entityId":"","type":"Nginx-Ingress","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":null,"baseColor":"#409EFF","thresholds":[],"showLegend":true}},"x":9,"y":0,"static":true},{"i":"widget4","widget":{"header":"default-header","body":"line-chart-view","title":"Network Transmit (KB)"},"w":12,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"nginx-ingress","metricId":"container_network_transmit_by_workload","entityId":"deploymentList,nginx-ingress-nginx-ingress","type":"workload"}},"visualization":{"showLegend":true}},"x":24,"y":9,"static":true},{"i":"widget5","widget":{"header":"default-header","body":"line-chart-view","title":"Network Recieved (KiB)"},"w":12,"h":9,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"nginx-ingress","metricId":"container_network_receive_by_workload","entityId":"deploymentList,nginx-ingress-nginx-ingress","type":"workload"}},"visualization":{"showLegend":true}},"x":36,"y":9,"static":true},{"i":"widget6","widget":{"header":"default-header","body":"stat-view","title":"Nginx Ingress last reload status"},"w":10,"h":9,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"nginx_ingress_controller_nginx_last_reload_status","entityId":"","type":"Nginx-Ingress","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[],"showLegend":true}},"x":19,"y":0,"static":true},{"i":"widget7","widget":{"header":"default-header","body":"stat-view","title":"Nginx Ingress reload success total"},"w":10,"h":9,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"nginx_ingress_controller_nginx_reloads_total","entityId":"","type":"Nginx-Ingress","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":29,"y":0,"static":true},{"i":"widget8","widget":{"header":"default-header","body":"stat-view","title":"Nginx Ingress reload error total"},"w":9,"h":9,"minW":6,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":true,"range":false,"clusterId":"cloudmoa","namespace":"","metricId":"nginx_ingress_controller_nginx_reload_errors_total","entityId":"","type":"Nginx-Ingress","filter":""}},"visualization":{"showGauge":false,"showPercent":false,"min":null,"max":null,"decimals":2,"baseColor":"#409EFF","thresholds":[]}},"x":39,"y":0,"static":true},{"i":"widget10","widget":{"header":"default-header","body":"line-chart-view","title":"Nginx Ingress Http Request Seconds"},"w":48,"h":15,"minW":8,"minH":4,"maxW":48,"maxH":18,"component":{"api":{"uri":"metric.chart","params":{"unique":false,"range":true,"clusterId":"cloudmoa","namespace":"","metricId":"nginx_ingress_nginx_http_requests_second","entityId":"","type":"Nginx-Ingress","filter":""}},"visualization":{"showLegend":true}},"x":0,"y":18,"static":true}]',
  'Nginx-Ingress', (select id from auth_resource3 where name='dashboard|admin|Nginx-Ingress'), 'admin', 'admin', NULL, true);



-- 리포트 메일 발송 관련 테이블 추가
CREATE TABLE public.report_group (
    id bigint NOT NULL,
    created_by character varying(255),
    created_date timestamp without time zone,
    modified_by character varying(255),
    modified_date timestamp without time zone,
    users text,
    name character varying(255)
);
ALTER TABLE public.report_group OWNER TO admin;

ALTER TABLE ONLY public.report_group ADD CONSTRAINT report_group_pkey PRIMARY KEY (id);

CREATE TABLE public.report_group_registry (
    id bigint NOT NULL,
    report_template_id bigint NOT NULL,
    report_group_id bigint NOT NULL
);

ALTER TABLE public.report_group_registry OWNER TO admin;

ALTER TABLE ONLY public.report_group_registry ADD CONSTRAINT report_group_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.report_group_registry ADD CONSTRAINT report_group_registry_template_id_fk FOREIGN KEY (report_template_id) REFERENCES public.report_template(id);
ALTER TABLE ONLY public.report_group_registry ADD CONSTRAINT report_group_registry_group_id_fk FOREIGN KEY (report_group_id) REFERENCES public.report_group(id);

-- CLOUD-13633; 대시보드 관련 패치
-- Traefik 대시보드 지원 관련 metric meta 추가
-- Auto-generated SQL script #202303161740
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_uptime','Traefik Uptime','Traefik Process Uptime','time() - process_start_time_seconds{job="cmoa-traefik"}','Instance','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_soket_used','Traefik Socket Used','Number of sockets Traefik is using','process_open_fds{job=~"cmoa-traefik"}','Instance','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,in_use,message)
	VALUES ('traefik_http_requests_rate_last_5m','Traefik HTTP Requests Rate','Number of http requests per second received by Traefik within 5 minutes','sum(rate(traefik_service_requests_total[5m]))','Request','Traefik',true,'CLST:{{$labels.xm_clst_id}} NS:{{$labels.xm_namespace}} POD:{{$labels.xm_pod_id}}  Trafik HTTP Request Rate :{{humanize $value}}|{threshold}.');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,in_use,message)
	VALUES ('traefik_http_requests_rate_by_service','Traefik HTTP Requets Rate by Service','Number of http requests per second grouped by service within 5 minutes','sum(rate(traefik_service_requests_total[5m])) by (service)','Request','Traefik',true,'CLST:{{$labels.xm_clst_id}} NS:{{$labels.xm_namespace}} POD:{{$labels.xm_pod_id}}  Trafik HTTP Request Rate :{{humanize $value}}|{threshold}.');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,in_use,message)
	VALUES ('traefik_http_requests_rate_by_entrypoint','Traefik HTTP Requets Rate by Entrypoint','Number of http requests per second grouped by entrypoint within 5 minutes','sum(rate(traefik_entrypoint_requests_total[5m])) by (entrypoint)','Request','Traefik',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_4xx_error_rate_last_5m','Traefik 4xx Error Rate','4xx error requests per second rate within 5 minutes','sum(rate(traefik_service_requests_total{code=~"4[0-9]{2}"}[5m]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'CLST:{{$labels.xm_clst_id}} NS:{{$labels.xm_namespace}} POD:{{$labels.xm_pod_id}}  Trafik 4xx Error Rate :{{humanize $value}}|{threshold}.');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_5xx_error_rate_last_5m','Traefik 5xx Error Rate','5xx error requests per second rate within 5 minutes','sum(rate(traefik_service_requests_total{code=~"5[0-9]{2}"}[5m]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'CLST:{{$labels.xm_clst_id}} NS:{{$labels.xm_namespace}} POD:{{$labels.xm_pod_id}}  Trafik 5xx Error Rate :{{humanize $value}}|{threshold}.');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_http_requests_4xx_total_last_10m','Traefik HTTP Requests 4xx Total Last 10m','Number of 4xx error requests in 10 minutes','sum(increase(traefik_service_requests_total{code=~"4[0-9]{2}"}[10m]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_http_requests_5xx_total_last_10m','Traefik HTTP Requests 5xx Total Last 10m','Number of 5xx error requests in 10 minutes','sum(increase(traefik_service_requests_total{code=~"5[0-9]{2}"}[10m]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_http_requests_4xx_total_last_1h','Traefik HTTP Requests 4xx Total Last 1h','Number of 4xx error requests in 1 hour','sum(increase(traefik_service_requests_total{code=~"4[0-9]{2}"}[1h]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_http_requests_5xx_total_last_1h','Traefik HTTP Requests 4xx Total Last 1h','Number of 5xx error requests in 1 hour','sum(increase(traefik_service_requests_total{code=~"5[0-9]{2}"}[1h]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,in_use,message)
	VALUES ('traefik_http_response_time_ms','Traefik HTTP Response Time Milisecond','Traefik HTTP Response Time (ms)','sum(increase(traefik_service_request_duration_seconds_sum[5m])) / sum(increase(traefik_entrypoint_requests_total[5m])) * 1000','Response','Traefik',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,in_use,message)
	VALUES ('traefik_entrypoint_open_connections','Traefik Entrypoint Open Connections','The current count of open connections on an entrypoint','sum(traefik_entrypoint_open_connections) by (method)','Entrypoint','Traefik',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,in_use,message)
	VALUES ('traefik_service_open_connections','Traefik Service Open Connections','The current count of open connections on an service','sum(traefik_service_open_connections) by (method)','Service','Traefik',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_http_requests_total_last_10m','Traefik HTTP Requests Total Last 10m','Number requests in 10 minutes','sum(increase(traefik_service_requests_total{}[10m]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'CLST:{{$labels.xm_clst_id}} NS:{{$labels.xm_namespace}} POD:{{$labels.xm_pod_id}}  Trafik Request Count (10m) :{{humanize $value}}|{threshold}.');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('traefik_http_requests_total_last_1h','Traefik HTTP Requests Total Last 1h','Number requests in 1 hour','sum(increase(traefik_service_requests_total{}[1h]))','Request','Traefik','xm_clst_id, xm_namespace, xm_pod_id',true,'CLST:{{$labels.xm_clst_id}} NS:{{$labels.xm_namespace}} POD:{{$labels.xm_pod_id}}  Trafik Request Count (1h) :{{humanize $value}}|{threshold}.');

-- MySQL-MariaDB 대시보드 지원 관련 metric meta 추가
-- Auto-generated SQL script #202303201205
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message)
	VALUES ('mysql_query_per_second','Query Per Second','Based on the queries reported by MySQL''s SHOW STATUS command, it is the number of statements executed by the server within the last second.','irate(mysql_global_status_queries{}[5m])','Query','MySQL','instance',true,true,'CLST:{{$labels.xm_clst_id}} NS:{{$labels.xm_namespace}} MySQL QPS :{{humanize $value}}%|{threshold}%.');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('mysql_Innodb_buffer_pool_size','InnoDB Buffer Pool Size in GiB','Describes a storage area called the buffer pool for caching data and indexes in memory.','mysql_global_variables_innodb_buffer_pool_size / 1024 / 1024 / 1024','InnoDB','MySQL','instance',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('mysql_Innodb_buffer_pool_size_gib_with_limit','InnoDB Buffer Pool Size with Limit','Describes a storage area called the buffer pool for caching data and indexes in memory.','(mysql_global_variables_innodb_buffer_pool_size{} * 100) / on (xm_pod_id,xm_cont_name) imxc_kubernetes_container_resource_limit_memory{xm_pod_id!~"|POD", pod_state="Running"}','InnoDB','MySQL','instance',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('mysql_global_status_questions','MySQL Questions','The number of statements executed by the server.','rate(mysql_global_status_questions{}[5m])','Query','MySQL','instance',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('mysql_global_status_max_used_connections','Max Used Connections','Maximum number of connections that have been in use simultaneously since the server started.','mysql_global_status_max_used_connections','Connection','MySQL','instance',true,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,message)
	VALUES ('mysql_global_variables_max_connections','Max Connections','Maximum permitted number of simultaneous client connections. By default, this is 151.','mysql_global_variables_max_connections','Connection','MySQL','instance',true,'None');

-- Auto-generated SQL script #202303201412
UPDATE public.metric_meta2
	SET expr='max(max_over_time(mysql_global_status_threads_connected[5m])  or mysql_global_status_threads_connected )'
	WHERE id='mysql_global_status_connections';
UPDATE public.metric_meta2
	SET groupby_keys='instance'
	WHERE id='mysql_global_status_connections';
-- Auto-generated SQL script #202303210950
DELETE FROM public.metric_meta2
	WHERE id='mysql_global_status_cache_hit_ratio';

-- Auto-generated SQL script #202303210950
UPDATE public.metric_meta2
SET expr = e'sum by (data_type, xm_clst_id, xm_namespace, xm_node_id, instance) (
label_replace(irate(mysql_global_status_innodb_buffer_pool_write_requests[5m]), "data_type", "write", "", "") or
label_replace(irate(mysql_global_status_innodb_buffer_pool_read_requests[5m]), "data_type", "read", "", "") )'
WHERE id LIKE 'mysql#_buffer#_io' ESCAPE '#';

-- Auto-generated SQL script #202303210950
UPDATE public.metric_meta2
SET expr = e'sum by (data_type, xm_clst_id, xm_namespace, xm_node_id, instance) (
 label_replace(rate(mysql_global_status_bytes_received [1m])/1024, "data_type", "received", "", "") or
 label_replace(rate(mysql_global_status_bytes_sent [1m])/1024, "data_type", "sent", "", ""))'
WHERE id LIKE 'mysql#_bytes#_received#_sent' ESCAPE '#';

-- Nginx Ingress 대시보드 지원 관련 metric meta 추가
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message) VALUES('nginx_ingress_nginx_up','Nginx Ingress Up','Nginx Ingress Up','sum by (xm_clst_id, xm_namespace, xm_node_id, instance, class) (nginx_ingress_nginx_up)','Pod','Nginx-Ingress','',true,false,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message) VALUES('nginx_ingress_nginx_connections_active','Nginx Ingress Connection Active','Nginx Ingress Client Connection Active','sum by (xm_clst_id, xm_namespace, xm_node_id, instance, class) (nginx_ingress_nginx_connections_active)','Connection','Nginx-Ingress','',true,false,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message) VALUES('nginx_ingress_controller_nginx_last_reload_status','Nginx Ingress last reload status','Status of the last NGINX reload','sum by (xm_clst_id, xm_namespace, xm_node_id, instance, class) (nginx_ingress_controller_nginx_reload_errors_total)','Config','Nginx-Ingress','',true,false,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message) VALUES('nginx_ingress_controller_nginx_reload_errors_total','Nginx Ingress reload error total','Number of unsuccessful NGINX reloads','sum by (xm_clst_id, xm_namespace, xm_node_id, instance, class) (nginx_ingress_controller_nginx_reload_errors_total)','Config','Nginx-Ingress','',true,false,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message) VALUES('nginx_ingress_controller_nginx_reloads_total','Nginx Ingress reload success total','Number of successful NGINX reloads','sum by (xm_clst_id, xm_namespace, xm_node_id, instance, class) (nginx_ingress_controller_nginx_reloads_total)','Config','Nginx-Ingress','',true,false,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message) VALUES('nginx_ingress_nginx_http_requests_total','Nginx Ingress Http Request Total','Total http requests','sum by (xm_clst_id, xm_namespace, xm_node_id, instance, class) (nginx_ingress_nginx_http_requests_total)','Request','Nginx-Ingress','',true,false,'None');
INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message) VALUES('nginx_ingress_nginx_http_requests_second','Nginx Ingress Http Request Seconds','Http request per second','sum by (xm_clst_id, xm_namespace, xm_node_id, instance, class) (rate(nginx_ingress_nginx_http_requests_total[1m]))','Request','Nginx-Ingress','',true,false,'None');
