ALTER TABLE alert_rule ADD COLUMN IF NOT EXISTS warning_sign character VARYING(255);
ALTER TABLE alert_rule ADD COLUMN IF NOT EXISTS critical_sign character VARYING(255);

CREATE TABLE IF NOT EXISTS public.license_policy (
	policy_id character varying(255) NOT NULL,
	policy_desc character varying(255),
	term_year integer NOT NULL,
	term_month integer NOT NULL,
	term_day integer NOT NULL,
	license_type character varying(255) NOT NULL,
	allowable_range character varying(255) NOT NULL,
	storage_capacity character varying(255) NOT NULL,
	cluster_count character varying(255) NOT NULL,
	node_count character varying(255) NOT NULL,
	pod_count character varying(255) NOT NULL,
	service_count character varying(255) NOT NULL,
	core_count character varying(255) NOT NULL,
	host_ids character varying(255) NOT NULL,
	user_division character varying(255) NOT NULL,
	created_date timestamp without time zone,
    modified_date timestamp without time zone
)

ALTER TABLE ONLY public.license_policy
    ADD CONSTRAINT license_policy_pkey PRIMARY KEY (policy_id);


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('node_contextswitch_and_filedescriptor','Node contextswitch and filedescriptor','Node contextswitch and filedescriptor','sum by(xm_clst_id, xm_node_id, data_type) (
        label_replace(node_filefd_allocated {{filter}}, "data_type", "file descriptor" ,  "", "") or
        label_replace(rate(node_context_switches_total {{filter}}[1m]), "data_type", "context switches", "" ,  ""))','File','Node',NULL,false,false,'Node contextswitch and filedescriptor','2020-05-28 12:38:21.587','2020-05-28 12:38:21.587')
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('node_contextswitch_and_filedescriptor','Node contextswitch and filedescriptor','Node contextswitch and filedescriptor','sum by(xm_clst_id, xm_node_id, data_type) (
                  label_replace(node_filefd_allocated {{filter}}, "data_type", "file descriptor" ,  "", "") or
                  label_replace(rate(node_context_switches_total {{filter}}[1m]), "data_type", "context switches", "" ,  ""))','File','Node',NULL,false,false,'Node contextswitch and filedescriptor','2020-05-28 12:38:21.587','2020-05-28 12:38:21.587')
      	WHERE public.metric_meta2.id = 'node_contextswitch_and_filedescriptor';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_cpu_user_by_workload',  'Container CPU User By workload (%)',  'Container CPU Usage(User)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_user_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100',  'CPU',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU User (%):{{humanize $value}}%|{threshold}%.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_cpu_user_by_workload',  'Container CPU User By workload (%)',  'Container CPU Usage(User)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_user_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100',  'CPU',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU User (%):{{humanize $value}}%|{threshold}%.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_cpu_user_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_cpu_system_core_by_workload',  'Container CPU System By workload (Core)',  'Container CPU(Core)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_system_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)',  'CPU',  'Workload',  NULL, TRUE, FALSE, 'CLST:{{$labels.xm_clst_id}}  DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU System (Core) (System):{{humanize $value}}%|{threshold}%.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_cpu_system_core_by_workload',  'Container CPU System By workload (Core)',  'Container CPU(Core)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_system_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)',  'CPU',  'Workload',  NULL, TRUE, FALSE, 'CLST:{{$labels.xm_clst_id}}  DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU System (Core) (System):{{humanize $value}}%|{threshold}%.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_cpu_system_core_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_cpu_usage_core_by_workload',  'Container CPU Usage By workload (Core)',  'Container CPU Usage (Core)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_usage_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)',  'CPU',  'Workload',  NULL, TRUE, FALSE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}}  CPU Usage (Core):{{humanize $value}}|{threshold}.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_cpu_usage_core_by_workload',  'Container CPU Usage By workload (Core)',  'Container CPU Usage (Core)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_usage_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)',  'CPU',  'Workload',  NULL, TRUE, FALSE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}}  CPU Usage (Core):{{humanize $value}}|{threshold}.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_cpu_usage_core_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_cpu_user_core_by_workload',  'Container CPU User By workload (Core)',  'Container CPU Usage (User)(Core)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_user_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)',  'CPU',  'Workload',  NULL, TRUE, FALSE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}}  CPU User (Core):{{humanize $value}}|{threshold}.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_cpu_user_core_by_workload',  'Container CPU User By workload (Core)',  'Container CPU Usage (User)(Core)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_user_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)',  'CPU',  'Workload',  NULL, TRUE, FALSE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}}  CPU User (Core):{{humanize $value}}|{threshold}.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_cpu_user_core_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_cpu_system_by_workload',  'Container CPU System By workload (%)',  'Container CPU Usage (System)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_system_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100',  'CPU',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU System (%):{{humanize $value}}%|{threshold}%.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_cpu_system_by_workload',  'Container CPU System By workload (%)',  'Container CPU Usage (System)',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_system_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100',  'CPU',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU System (%):{{humanize $value}}%|{threshold}%.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_cpu_system_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_cpu_usage_by_workload',  'Container CPU Usage By workload (%)',  'Container CPU Usage',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_usage_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100',  'CPU',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU Usage (%):{{humanize $value}}%|{threshold}%',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_cpu_usage_by_workload',  'Container CPU Usage By workload (%)',  'Container CPU Usage',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_cpu_usage_seconds_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100',  'CPU',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} CPU Usage (%):{{humanize $value}}%|{threshold}%',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_cpu_usage_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_fs_reads_by_workload',  'Container Filesystem Read Bytes By workload (KiB)',  'Cumulative count of bytes read / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_fs_reads_bytes_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Reads:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_fs_reads_by_workload',  'Container Filesystem Read Bytes By workload (KiB)',  'Cumulative count of bytes read / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_fs_reads_bytes_total{xm_cont_name!="POD"} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Reads:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_fs_reads_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_fs_limit_bytes_by_workload',  'Container Filesystem Limit Bytes By workload (GiB)',  'Number of bytes that can be consumed by the container on this filesystem / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_fs_limit_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Limit:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_fs_limit_bytes_by_workload',  'Container Filesystem Limit Bytes By workload (GiB)',  'Number of bytes that can be consumed by the container on this filesystem / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_fs_limit_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Limit:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_fs_limit_bytes_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_fs_usage_bytes_by_workload',  'Container Filesystem Used Bytes By workload (GiB)',  'Number of bytes that are consumed by the container on this filesystem / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_fs_usage_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Used:{{humanize $value}}GiB||{threshold}GiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_fs_usage_bytes_by_workload',  'Container Filesystem Used Bytes By workload (GiB)',  'Number of bytes that are consumed by the container on this filesystem / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_fs_usage_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Used:{{humanize $value}}GiB||{threshold}GiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_fs_usage_bytes_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_fs_writes_by_workload',  'Container Filesystem Write Bytes By workload (KiB)',  'Cumulative count of bytes written / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_fs_writes_bytes_total{xm_cont_name!="POD"}[1m]) + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Writes:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_fs_writes_by_workload',  'Container Filesystem Write Bytes By workload (KiB)',  'Cumulative count of bytes written / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_fs_writes_bytes_total{xm_cont_name!="POD"}[1m]) + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Writes:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_fs_writes_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_fs_usage_by_workload',  'Container Filesystem Usage By workload (%)',  'Container File System Usage: 100 * (Used Bytes / Limit Bytes) (not contain persistent volume)',  'sum by (xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) ((container_fs_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)/ (((container_fs_limit_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100) > 0) or (container_fs_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"}  + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1000)',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.o
           wner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Usage:{{humanize $value}}%|{threshold}%.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_fs_usage_by_workload',  'Container Filesystem Usage By workload (%)',  'Container File System Usage: 100 * (Used Bytes / Limit Bytes) (not contain persistent volume)',  'sum by (xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) ((container_fs_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)/ (((container_fs_limit_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) * 100) > 0) or (container_fs_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"}  + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1000)',  'Filesystem',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.o
          wner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Filesystem Usage:{{humanize $value}}%|{threshold}%.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_fs_usage_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_memory_max_usage_bytes_by_workload',  'Container Memory Max Used By workload (GiB)',  'Maximum memory usage recorded in bytes / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_max_usage_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Max Memory Usage:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_memory_max_usage_bytes_by_workload',  'Container Memory Max Used By workload (GiB)',  'Maximum memory usage recorded in bytes / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_max_usage_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Max Memory Usage:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_memory_max_usage_bytes_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_memory_usage_bytes_by_workload',  'Container Memory Used By workload (GiB)',  'Current memory usage in GiB, this includes all memory regardless of when it was accessed',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_usage_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)  / 1024 / 1024 / 1024',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Used Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_memory_usage_bytes_by_workload',  'Container Memory Used By workload (GiB)',  'Current memory usage in GiB, this includes all memory regardless of when it was accessed',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_usage_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)  / 1024 / 1024 / 1024',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Used Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_memory_usage_bytes_by_workload';



INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_memory_usage_by_workload',  'Container Memory Usage By workload (%)',  'Container Memory usage compared to limit if limit is non-zero or 1GiB if limit is zero',  'sum by (xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) ((container_memory_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / (((container_spec_memory_limit_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)) > 0) * 100) or sum by (xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) ((container_memory_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"}  + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)  / 1024 / 1024 / 1024 *100)',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Memory Usage:{{humanize $value}}%|{threshold}%.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_memory_usage_by_workload',  'Container Memory Usage By workload (%)',  'Container Memory usage compared to limit if limit is non-zero or 1GiB if limit is zero',  'sum by (xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) ((container_memory_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / (((container_spec_memory_limit_bytes{xm_entity_type="Container", xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)) > 0) * 100) or sum by (xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) ((container_memory_usage_bytes{xm_entity_type="Container", xm_cont_name!="POD"}  + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0)  / 1024 / 1024 / 1024 *100)',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Memory Usage:{{humanize $value}}%|{threshold}%.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_memory_usage_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_memory_swap_by_workload',  'Container Memory Swap By workload (GiB)',  'Container swap usage in bytes / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_swap{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Swap Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_memory_swap_by_workload',  'Container Memory Swap By workload (GiB)',  'Container swap usage in bytes / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_swap{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Swap Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_memory_swap_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_memory_working_set_bytes_by_workload',  'Container Memory Working Set By workload (GiB)',  'Current working set in GiB, this includes recently accessed memory, dirty memory, and kernel memory',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_working_set_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name)  group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024 / 1024 / 1024',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Working Set Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_memory_working_set_bytes_by_workload',  'Container Memory Working Set By workload (GiB)',  'Current working set in GiB, this includes recently accessed memory, dirty memory, and kernel memory',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_working_set_bytes{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name)  group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024 / 1024 / 1024',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Working Set Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_memory_working_set_bytes_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_memory_cache_by_workload',  'Container Memory Cache By workload (GiB)',  'Number of bytes of page cache memory / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_cache{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name)  group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Cache Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_memory_cache_by_workload',  'Container Memory Cache By workload (GiB)',  'Number of bytes of page cache memory / 1073741824',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (container_memory_cache{xm_cont_name!="POD"} + on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name)  group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1073741824',  'Memory',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Cache Memory:{{humanize $value}}GiB|{threshold}GiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_memory_cache_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_network_receive_by_workload',  'Container Network Receive By workload (KiB)',  'Network device statistic receive_bytes / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_network_receive_bytes_total{} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name)  group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Network',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Network Receive Usage:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_network_receive_by_workload',  'Container Network Receive By workload (KiB)',  'Network device statistic receive_bytes / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_network_receive_bytes_total{} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name)  group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Network',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Network Receive Usage:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_network_receive_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('container_network_transmit_by_workload',  'Container Network Transmit By workload (KiB)',  'Network device statistic transmit_bytes / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_network_transmit_bytes_total{} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Network',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Network Transmit Usage:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('container_network_transmit_by_workload',  'Container Network Transmit By workload (KiB)',  'Network device statistic transmit_bytes / 1024',  'sum by(xm_clst_id, xm_namespace, owner_name, xm_pod_id, xm_cont_name) (rate(container_network_transmit_bytes_total{} [1m])+ on (xm_clst_id, xm_namespace, xm_pod_id, xm_cont_name) group_left(owner_name) imxc_kubernetes_container_resource_limit_cpu{{filter}} * 0) / 1024',  'Network',  'Workload',  NULL, TRUE, TRUE, 'CLST:{{$labels.xm_clst_id}} DP:{{$labels.owner_name}} CT:{{$labels.xm_cont_name}} PD:{{$labels.xm_pod_id}} Network Transmit Usage:{{humanize $value}}KiB|{threshold}KiB.',  now(),  now())
      	WHERE public.metric_meta2.id = 'container_network_transmit_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('count_pod_not_running_by_workload','Number of Pods not running By Workload','Number of Pods not running (pod_state)','count by (xm_clst_id, xm_pod_id,xm_cont_id, xm_cont_name, entity_type, xm_namespace, pod_state) (imxc_kubernetes_container_resource_limit_cpu{pod_state!="Running", {filter}})','State','Workload',null,true,false,'CLST:{{$labels.xm_clst_id}} POD:{{$labels.xm_pod_id}} State:{{$labels.pod_state}}.',now(),now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('count_pod_not_running_by_workload','Number of Pods not running By Workload','Number of Pods not running (pod_state)','count by (xm_clst_id, xm_pod_id,xm_cont_id, xm_cont_name, entity_type, xm_namespace, pod_state) (imxc_kubernetes_container_resource_limit_cpu{pod_state!="Running", {filter}})','State','Workload',null,true,false,'CLST:{{$labels.xm_clst_id}} POD:{{$labels.xm_pod_id}} State:{{$labels.pod_state}}.',now(),now())
      	WHERE public.metric_meta2.id = 'count_pod_not_running_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('count_container_not_running_by_workload','Number of Containers not running By Workload','Number of Containers not running (container_state)','count by (xm_clst_id, xm_pod_id, xm_cont_id, xm_cont_name, entity_type, xm_namespace, container_state) (imxc_kubernetes_container_resource_limit_cpu{container_state!="Running", {filter}})','State','Workload',null,true,false,'CLST:{{$labels.xm_clst_id}} CONT:{{$labels.xm_cont_name}} State:{{$labels.container_state}}.',now(),now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('count_container_not_running_by_workload','Number of Containers not running By Workload','Number of Containers not running (container_state)','count by (xm_clst_id, xm_pod_id, xm_cont_id, xm_cont_name, entity_type, xm_namespace, container_state) (imxc_kubernetes_container_resource_limit_cpu{container_state!="Running", {filter}})','State','Workload',null,true,false,'CLST:{{$labels.xm_clst_id}} CONT:{{$labels.xm_cont_name}} State:{{$labels.container_state}}.',now(),now())
      	WHERE public.metric_meta2.id = 'count_container_not_running_by_workload';


INSERT INTO public.metric_meta2 (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
    VALUES ('cotainer_restart_count_by_workload','Number of Containers Restart','Number of Containers Restart (10m)','increase(imxc_kubernetes_container_restart_count{{filter}}[10m])>1','State','Workload',null,true,false,'CLST:{{$labels.xm_clst_id}} CONT:{{$labels.xm_cont_name}} RESTARTCOUNT FOR 10MINUTE:{{humanize $value}}.',now(),now())
    ON CONFLICT (id)
    DO
      	UPDATE SET (id,meta_name,description,expr,resource_type,entity_type,groupby_keys,in_use,anomaly_score,message,created_date,modified_date)
      	= ('cotainer_restart_count_by_workload','Number of Containers Restart','Number of Containers Restart (10m)','increase(imxc_kubernetes_container_restart_count{{filter}}[10m])>1','State','Workload',null,true,false,'CLST:{{$labels.xm_clst_id}} CONT:{{$labels.xm_cont_name}} RESTARTCOUNT FOR 10MINUTE:{{humanize $value}}.',now(),now())
      	WHERE public.metric_meta2.id = 'cotainer_restart_count_by_workload';


INSERT INTO public.agent_install_file_info (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
VALUES (4, 'node-exporter', 'agent', 'Node에 관련된 Metric 시계열 데이터를 수집하여 고객사 클러스터에 설치된 Prometheus에 전달하는 역할을 합니다.', '---
       apiVersion: v1
       kind: Service
       metadata:
         annotations:
           prometheus.io/scrape: ''true''
         labels:
           app: cloudmoa-node-exporter
           name: cloudmoa-node-exporter
         name: cloudmoa-node-exporter
         namespace: $CLOUDMOA_NAMESPACE
       spec:
         clusterIP: None
         ports:
           - name: scrape
             port: 9110
             protocol: TCP
         selector:
           app: cloudmoa-node-exporter
         type: ClusterIP
       ---
       apiVersion: apps/v1
       kind: DaemonSet
       metadata:
         name: cloudmoa-node-exporter
         namespace: $CLOUDMOA_NAMESPACE
       spec:
         selector:
           matchLabels:
             app: cloudmoa-node-exporter
         template:
           metadata:
             labels:
               app: cloudmoa-node-exporter
             name: cloudmoa-node-exporter
           spec:
             tolerations:
               - effect: NoSchedule
                 operator: Exists
               - effect: NoExecute
                 operator: Exists
             containers:
               - image: $DOCKER_REGISTRY_URL/prom/node-exporter
                 name: cloudmoa-node-exporter
                 ports:
                   - containerPort: 9110
                     hostPort: 9110
                     name: scrape
                 args:
                   - --path.procfs=/host/proc
                   - --path.sysfs=/host/sys
                   - --path.rootfs=/host/root
                   - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|run|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/)
                   - --collector.tcpstat
                   - --web.listen-address=:9110
                 # --log.level=debug
                 resources:
                   limits:
                     cpu: 250m
                     memory: 180Mi
                   requests:
                     cpu: 102m
                     memory: 180Mi
                 volumeMounts:
                   - mountPath: /host/proc
                     name: proc
                     readOnly: false
                   - mountPath: /host/sys
                     name: sys
                     readOnly: false
                   - mountPath: /host/root
                     mountPropagation: HostToContainer
                     name: root
                     readOnly: true
             hostNetwork: true
             hostPID: true
             securityContext:
               runAsNonRoot: true
               runAsUser: 65534
             volumes:
               - hostPath:
                   path: /proc
                 name: proc
               - hostPath:
                   path: /sys
                 name: sys
               - hostPath:
                   path: /
                 name: root
       ', true, '2021-03-11 13:41:02.000000', '2021-03-11 13:41:06.000000', null)
ON CONFLICT (id)
DO
   UPDATE SET (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
        = (4, 'node-exporter', 'agent', 'Node에 관련된 Metric 시계열 데이터를 수집하여 고객사 클러스터에 설치된 Prometheus에 전달하는 역할을 합니다.', '---
          apiVersion: v1
          kind: Service
          metadata:
            annotations:
              prometheus.io/scrape: ''true''
            labels:
              app: cloudmoa-node-exporter
              name: cloudmoa-node-exporter
            name: cloudmoa-node-exporter
            namespace: $CLOUDMOA_NAMESPACE
          spec:
            clusterIP: None
            ports:
              - name: scrape
                port: 9110
                protocol: TCP
            selector:
              app: cloudmoa-node-exporter
            type: ClusterIP
          ---
          apiVersion: apps/v1
          kind: DaemonSet
          metadata:
            name: cloudmoa-node-exporter
            namespace: $CLOUDMOA_NAMESPACE
          spec:
            selector:
              matchLabels:
                app: cloudmoa-node-exporter
            template:
              metadata:
                labels:
                  app: cloudmoa-node-exporter
                name: cloudmoa-node-exporter
              spec:
                tolerations:
                  - effect: NoSchedule
                    operator: Exists
                  - effect: NoExecute
                    operator: Exists
                containers:
                  - image: $DOCKER_REGISTRY_URL/prom/node-exporter
                    name: cloudmoa-node-exporter
                    ports:
                      - containerPort: 9110
                        hostPort: 9110
                        name: scrape
                    args:
                      - --path.procfs=/host/proc
                      - --path.sysfs=/host/sys
                      - --path.rootfs=/host/root
                      - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|run|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/)
                      - --collector.tcpstat
                      - --web.listen-address=:9110
                    # --log.level=debug
                    resources:
                      limits:
                        cpu: 250m
                        memory: 180Mi
                      requests:
                        cpu: 102m
                        memory: 180Mi
                    volumeMounts:
                      - mountPath: /host/proc
                        name: proc
                        readOnly: false
                      - mountPath: /host/sys
                        name: sys
                        readOnly: false
                      - mountPath: /host/root
                        mountPropagation: HostToContainer
                        name: root
                        readOnly: true
                hostNetwork: true
                hostPID: true
                securityContext:
                  runAsNonRoot: true
                  runAsUser: 65534
                volumes:
                  - hostPath:
                      path: /proc
                    name: proc
                  - hostPath:
                      path: /sys
                    name: sys
                  - hostPath:
                      path: /
                    name: root
          ', true, '2021-03-11 13:41:02.000000', '2021-03-11 13:41:06.000000', null)
    WHERE public.agent_install_file_info.id = 4;


INSERT INTO public.agent_install_file_info (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
VALUES (3, 'prometheus', 'agent', 'Prometheus는 다양한 Exporter들과 연결될 수 있으며, 기본적으로 Node Exporter와 cAdvisor를 통해 수집한 Metric 데이터를 Kafka를 통해 수집 클러스터에 전달하는 역할을 합니다.', '---
       # VERSION : 20190227142300

       apiVersion: v1
       kind: ConfigMap
       metadata:
         name: cloudmoa-prometheus-configuration
         namespace: $CLOUDMOA_NAMESPACE
       data:
         scaling.rules: |
           groups:
           - name: scaleup
             rules :
             - alert : ScaleUpRule
               expr: job:webapp_config_open_sessions_current_count:sum > 15
               annotations:
                 summary: "Scale up when current sessions is greater than 15"
                 description: "Firing when total sessions active greater than 15"
         prometheus.yml: |
           global:
             scrape_interval:     15s
             # Attach these labels to any time series or alerts when communicating with
             # external systems.
             external_labels:
               monitor: ''5s-monitor''

             #kafka writer only
             no_local_disk_write: true

           # A scrape configuration for running Prometheus on a Kubernetes cluster.
           # This uses separate scrape configs for cluster components (i.e. API server, node)
           # and services to allow each to use different authentication configs.
           #
           # Kubernetes labels will be added as Prometheus labels on metrics via the
           # `labelmap` relabeling action.
           #

           #
           # rule_files:
           # - "scaling.rules"

           # i suppose my code in the remote kafka write is something wrong ... should append a double quote character at the end of the url
           remote_write:
           - url: kafka://$COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT/remote_prom?encoding=proto3&compression=snappy

           scrape_configs:

             # Scrape config for nodes (kubelet).
             #
             # Rather than connecting directly to the node, the scrape is proxied though the
             # Kubernetes apiserver.  This means it will work if Prometheus is running out of
             # cluster, or can''t connect to nodes for some other reason (e.g. because of
             # firewalling).
             - job_name: ''kubernetes-kubelet''

               # Default to scraping over https. If required, just disable this or change to
               # `http`.
               scheme: https
               # This TLS & bearer token file config is used to connect to the actual scrape
               # endpoints for cluster components. This is separate to discovery auth
               # configuration because discovery & scraping are two separate concerns in
               # Prometheus. The discovery auth config is automatic if Prometheus runs inside
               # the cluster. Otherwise, more config options have to be provided within the
               # <kubernetes_sd_config>.
               tls_config:
                 ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
               bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
               kubernetes_sd_configs:
               - role: node
               relabel_configs:
               - action: labelmap
                 regex: __meta_kubernetes_node_label_(.+)
               - target_label: __address__
                 replacement: kubernetes.default.svc:443
               - source_labels: [__meta_kubernetes_node_name]
                 regex: (.+)
                 target_label: __metrics_path__
                 replacement: /api/v1/nodes/${1}/proxy/metrics
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: xm_node_id
               - target_label: xm_clst_id
                 replacement: ''$CLOUDMOA_CLUSTER_ID''
               - target_label: xm_entity_type
                 replacement: ''Node''

               metric_relabel_configs:
               - source_labels: [ __name__ ]
                 regex: (kubelet_running_pod_count)
                 action: keep

             # copied from https://github.com/kayrus/prometheus-kubernetes/blob/master/prometheus-configmap.yaml
             - job_name: ''kubernetes-node-exporter''
               tls_config:
                 ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
               bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
               kubernetes_sd_configs:
               - role: node

               relabel_configs:
               - action: labelmap
                 regex: __meta_kubernetes_node_label_(.+)
               - source_labels: [__meta_kubernetes_role]
                 action: replace
                 target_label: kubernetes_role
               - source_labels: [__address__]
                 regex: ''(.*):10250''
                 replacement: ''${1}:9110''
                 target_label: __address__
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: __instance__
                 # set "name" value to "job"
               - source_labels: [job]
                 regex: ''kubernetes-(.*)''
                 replacement: ''${1}''
                 target_label: name
               - target_label: xm_clst_id
                 replacement: ''$CLOUDMOA_CLUSTER_ID''
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: xm_node_id
               - target_label: xm_entity_type
                 replacement: ''Node''
               - source_labels: [__meta_kubernetes_namespace]
                 separator: ;
                 regex: (.*)
                 target_label: xm_namespace
                 replacement: $1
                 action: replace
               metric_relabel_configs:
               - source_labels: [ __name__ ]
                 regex: (node_boot_time_seconds|node_context_switches_total|node_cpu_frequency_max_hertz|node_cpu_package_throttles_total|node_cpu_seconds_total|node_disk_io_time_seconds_total|node_disk_read_bytes_total|node_disk_read_time_seconds_total|node_disk_reads_completed_total|node_disk_write_time_seconds_total|node_disk_writes_completed_total|node_disk_written_bytes_total|node_filefd_allocated|node_filesystem_avail_bytes|node_filesystem_free_bytes|node_filesystem_size_bytes|node_load1|node_load15|node_load5|node_memory_Active_bytes|node_memory_Buffers_bytes|node_memory_Cached_bytes|node_memory_MemAvailable_bytes|node_memory_MemFree_bytes|node_memory_MemTotal_bytes|node_memory_SwapCached_bytes|node_memory_SwapFree_bytes|node_memory_SwapTotal_bytes|node_network_receive_bytes_total|node_network_receive_bytes_total|node_network_transmit_bytes_total|node_network_transmit_bytes_total)
                 action: keep


             - job_name: ''kubernetes-cadvisor''

               # Default to scraping over https. If required, just disable this or change to
               # `http`.
               scheme: https

               tls_config:
                 ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                 insecure_skip_verify: true
               bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token

               kubernetes_sd_configs:
               - role: node
               metrics_path: /metrics/cadvisor

               relabel_configs:
               - action: labelmap
                 regex: __meta_kubernetes_node_label_(.+)
               - target_label: xm_clst_id
                 replacement: ''$CLOUDMOA_CLUSTER_ID''
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: xm_node_id
               - target_label: xm_entity_type
                 replacement: ''Container''

               metric_relabel_configs:
               - source_labels: [namespace]
                 target_label: xm_namespace
               - source_labels: [pod_name]
                 target_label: xm_pod_id
               - source_labels: [container_name]
                 target_label: xm_cont_name
               - source_labels: [id]
                 target_label: xm_cont_id
               - source_labels: [container_name]
                 regex: (.+)
                 action: keep
               - source_labels: [ __name__ ]
                 regex: (container_cpu_cfs_throttled_seconds_total|container_cpu_system_seconds_total|container_cpu_usage_seconds_total|container_cpu_user_seconds_total|container_fs_limit_bytes|container_fs_reads_bytes_total|container_fs_usage_bytes|container_fs_writes_bytes_total|container_last_seen|container_memory_cache|container_memory_max_usage_bytes|container_memory_swap|container_memory_usage_bytes|container_memory_working_set_bytes|container_network_receive_bytes_total|container_network_transmit_bytes_total|container_spec_memory_limit_bytes)
                 action: keep
       ---
       apiVersion: v1
       kind: Service
       metadata:
         name: cloudmoa-prometheus
         namespace: $CLOUDMOA_NAMESPACE
       spec:
         ports:
           - port: 9090
             protocol: TCP
             targetPort: 9090
         selector:
           app: cloudmoa-prometheus
         type: ClusterIP
       ---
       apiVersion: apps/v1
       kind: Deployment
       metadata:
         name: cloudmoa-prometheus
         namespace: $CLOUDMOA_NAMESPACE
         labels:
           app: cloudmoa-prometheus
       spec:
         selector:
           matchLabels:
             app: cloudmoa-prometheus
         replicas: 1
         strategy:
           type: Recreate
         template:
           metadata:
             labels:
               app: cloudmoa-prometheus
           spec:
             containers:
               - name: cloudmoa-prometheus
                 image: $DOCKER_REGISTRY_URL/imxc/metric-agent:$IMAGE_TAG
                 ports:
                   - containerPort: 9090
                 args:
                   - --config.file=/etc/prometheus/prometheus.yml
                 #- --log.level=debug
                 resources:
                   requests:
                     cpu: 100m
                     memory: 512Mi
                   limits:
                     cpu: 300m
                     memory: 1000Mi
                 volumeMounts:
                   - mountPath: "/prometheus"
                     name: data
                   - mountPath: /etc/prometheus/
                     name: config-volume
                 env:
                   - name: LOG_LEVEL
                     value: "INFO"
                   - name: LOG_MAXAGE
                     value: "1"
                   - name: CLUSTER_ID
                     value: $CLOUDMOA_CLUSTER_ID
                   - name: API_SERVER_LICENSE
                     value: $COLLTION_SERVER_API_IP:8080

             restartPolicy: Always
             volumes:
               - emptyDir: {}
                 name: data
               - name: config-volume
                 configMap:
                   name: cloudmoa-prometheus-configuration
       ', true, '2021-03-11 13:39:07.000000', '2021-03-11 13:39:09.000000', '1.15')
ON CONFLICT (id)
DO
   UPDATE SET (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
        = (3, 'prometheus', 'agent', 'Prometheus는 다양한 Exporter들과 연결될 수 있으며, 기본적으로 Node Exporter와 cAdvisor를 통해 수집한 Metric 데이터를 Kafka를 통해 수집 클러스터에 전달하는 역할을 합니다.', '---
          # VERSION : 20190227142300

          apiVersion: v1
          kind: ConfigMap
          metadata:
            name: cloudmoa-prometheus-configuration
            namespace: $CLOUDMOA_NAMESPACE
          data:
            scaling.rules: |
              groups:
              - name: scaleup
                rules :
                - alert : ScaleUpRule
                  expr: job:webapp_config_open_sessions_current_count:sum > 15
                  annotations:
                    summary: "Scale up when current sessions is greater than 15"
                    description: "Firing when total sessions active greater than 15"
            prometheus.yml: |
              global:
                scrape_interval:     15s
                # Attach these labels to any time series or alerts when communicating with
                # external systems.
                external_labels:
                  monitor: ''5s-monitor''

                #kafka writer only
                no_local_disk_write: true

              # A scrape configuration for running Prometheus on a Kubernetes cluster.
              # This uses separate scrape configs for cluster components (i.e. API server, node)
              # and services to allow each to use different authentication configs.
              #
              # Kubernetes labels will be added as Prometheus labels on metrics via the
              # `labelmap` relabeling action.
              #

              #
              # rule_files:
              # - "scaling.rules"

              # i suppose my code in the remote kafka write is something wrong ... should append a double quote character at the end of the url
              remote_write:
              - url: kafka://$COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT/remote_prom?encoding=proto3&compression=snappy

              scrape_configs:

                # Scrape config for nodes (kubelet).
                #
                # Rather than connecting directly to the node, the scrape is proxied though the
                # Kubernetes apiserver.  This means it will work if Prometheus is running out of
                # cluster, or can''t connect to nodes for some other reason (e.g. because of
                # firewalling).
                - job_name: ''kubernetes-kubelet''

                  # Default to scraping over https. If required, just disable this or change to
                  # `http`.
                  scheme: https
                  # This TLS & bearer token file config is used to connect to the actual scrape
                  # endpoints for cluster components. This is separate to discovery auth
                  # configuration because discovery & scraping are two separate concerns in
                  # Prometheus. The discovery auth config is automatic if Prometheus runs inside
                  # the cluster. Otherwise, more config options have to be provided within the
                  # <kubernetes_sd_config>.
                  tls_config:
                    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
                  kubernetes_sd_configs:
                  - role: node
                  relabel_configs:
                  - action: labelmap
                    regex: __meta_kubernetes_node_label_(.+)
                  - target_label: __address__
                    replacement: kubernetes.default.svc:443
                  - source_labels: [__meta_kubernetes_node_name]
                    regex: (.+)
                    target_label: __metrics_path__
                    replacement: /api/v1/nodes/${1}/proxy/metrics
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: xm_node_id
                  - target_label: xm_clst_id
                    replacement: ''$CLOUDMOA_CLUSTER_ID''
                  - target_label: xm_entity_type
                    replacement: ''Node''

                  metric_relabel_configs:
                  - source_labels: [ __name__ ]
                    regex: (kubelet_running_pod_count)
                    action: keep

                # copied from https://github.com/kayrus/prometheus-kubernetes/blob/master/prometheus-configmap.yaml
                - job_name: ''kubernetes-node-exporter''
                  tls_config:
                    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
                  kubernetes_sd_configs:
                  - role: node

                  relabel_configs:
                  - action: labelmap
                    regex: __meta_kubernetes_node_label_(.+)
                  - source_labels: [__meta_kubernetes_role]
                    action: replace
                    target_label: kubernetes_role
                  - source_labels: [__address__]
                    regex: ''(.*):10250''
                    replacement: ''${1}:9110''
                    target_label: __address__
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: __instance__
                    # set "name" value to "job"
                  - source_labels: [job]
                    regex: ''kubernetes-(.*)''
                    replacement: ''${1}''
                    target_label: name
                  - target_label: xm_clst_id
                    replacement: ''$CLOUDMOA_CLUSTER_ID''
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: xm_node_id
                  - target_label: xm_entity_type
                    replacement: ''Node''
                  - source_labels: [__meta_kubernetes_namespace]
                    separator: ;
                    regex: (.*)
                    target_label: xm_namespace
                    replacement: $1
                    action: replace
                  metric_relabel_configs:
                  - source_labels: [ __name__ ]
                    regex: (node_boot_time_seconds|node_context_switches_total|node_cpu_frequency_max_hertz|node_cpu_package_throttles_total|node_cpu_seconds_total|node_disk_io_time_seconds_total|node_disk_read_bytes_total|node_disk_read_time_seconds_total|node_disk_reads_completed_total|node_disk_write_time_seconds_total|node_disk_writes_completed_total|node_disk_written_bytes_total|node_filefd_allocated|node_filesystem_avail_bytes|node_filesystem_free_bytes|node_filesystem_size_bytes|node_load1|node_load15|node_load5|node_memory_Active_bytes|node_memory_Buffers_bytes|node_memory_Cached_bytes|node_memory_MemAvailable_bytes|node_memory_MemFree_bytes|node_memory_MemTotal_bytes|node_memory_SwapCached_bytes|node_memory_SwapFree_bytes|node_memory_SwapTotal_bytes|node_network_receive_bytes_total|node_network_receive_bytes_total|node_network_transmit_bytes_total|node_network_transmit_bytes_total)
                    action: keep


                - job_name: ''kubernetes-cadvisor''

                  # Default to scraping over https. If required, just disable this or change to
                  # `http`.
                  scheme: https

                  tls_config:
                    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                    insecure_skip_verify: true
                  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token

                  kubernetes_sd_configs:
                  - role: node
                  metrics_path: /metrics/cadvisor

                  relabel_configs:
                  - action: labelmap
                    regex: __meta_kubernetes_node_label_(.+)
                  - target_label: xm_clst_id
                    replacement: ''$CLOUDMOA_CLUSTER_ID''
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: xm_node_id
                  - target_label: xm_entity_type
                    replacement: ''Container''

                  metric_relabel_configs:
                  - source_labels: [namespace]
                    target_label: xm_namespace
                  - source_labels: [pod_name]
                    target_label: xm_pod_id
                  - source_labels: [container_name]
                    target_label: xm_cont_name
                  - source_labels: [id]
                    target_label: xm_cont_id
                  - source_labels: [container_name]
                    regex: (.+)
                    action: keep
                  - source_labels: [ __name__ ]
                    regex: (container_cpu_cfs_throttled_seconds_total|container_cpu_system_seconds_total|container_cpu_usage_seconds_total|container_cpu_user_seconds_total|container_fs_limit_bytes|container_fs_reads_bytes_total|container_fs_usage_bytes|container_fs_writes_bytes_total|container_last_seen|container_memory_cache|container_memory_max_usage_bytes|container_memory_swap|container_memory_usage_bytes|container_memory_working_set_bytes|container_network_receive_bytes_total|container_network_transmit_bytes_total|container_spec_memory_limit_bytes)
                    action: keep
          ---
          apiVersion: v1
          kind: Service
          metadata:
            name: cloudmoa-prometheus
            namespace: $CLOUDMOA_NAMESPACE
          spec:
            ports:
              - port: 9090
                protocol: TCP
                targetPort: 9090
            selector:
              app: cloudmoa-prometheus
            type: ClusterIP
          ---
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: cloudmoa-prometheus
            namespace: $CLOUDMOA_NAMESPACE
            labels:
              app: cloudmoa-prometheus
          spec:
            selector:
              matchLabels:
                app: cloudmoa-prometheus
            replicas: 1
            strategy:
              type: Recreate
            template:
              metadata:
                labels:
                  app: cloudmoa-prometheus
              spec:
                containers:
                  - name: cloudmoa-prometheus
                    image: $DOCKER_REGISTRY_URL/imxc/metric-agent:$IMAGE_TAG
                    ports:
                      - containerPort: 9090
                    args:
                      - --config.file=/etc/prometheus/prometheus.yml
                    #- --log.level=debug
                    resources:
                      requests:
                        cpu: 100m
                        memory: 512Mi
                      limits:
                        cpu: 300m
                        memory: 1000Mi
                    volumeMounts:
                      - mountPath: "/prometheus"
                        name: data
                      - mountPath: /etc/prometheus/
                        name: config-volume
                    env:
                      - name: LOG_LEVEL
                        value: "INFO"
                      - name: LOG_MAXAGE
                        value: "1"
                      - name: CLUSTER_ID
                        value: $CLOUDMOA_CLUSTER_ID
                      - name: API_SERVER_LICENSE
                        value: $COLLTION_SERVER_API_IP:8080

                restartPolicy: Always
                volumes:
                  - emptyDir: {}
                    name: data
                  - name: config-volume
                    configMap:
                      name: cloudmoa-prometheus-configuration
          ', true, '2021-03-11 13:39:07.000000', '2021-03-11 13:39:09.000000', '1.15')
    WHERE public.agent_install_file_info.id = 3;


INSERT INTO public.agent_install_file_info (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
VALUES (2, 'agent', 'agent', '관제 대상 클러스터의 Topology 데이터를 수집하여 Kafka를 통해 수집 클러스터에 전달하는 역할을 하며, 그 밖에 API 서버와의 TCP 연결을 통해 관리 기능, Log Viewer 기능 등을 수행합니다.', '---
       apiVersion: rbac.authorization.k8s.io/v1
       kind: ClusterRole
       metadata:
         name: cloudmoa-cluster-role
       rules:
         - nonResourceURLs:
             - "*"
           verbs:
             - get
         - apiGroups:
             - metrics.k8s.io
           resources:
             - pods
             - nodes
           verbs:
             - get
             - list
             - watch
         - apiGroups:
             - ""
           resources:
             - pods
           verbs:
             - get
             - list
             - watch
             - update
         - apiGroups:
             - ""
           resources:
             - services
           verbs:
             - get
             - list
             - watch
             - update
         - apiGroups:
             - ""
           resources:
             - nodes/stats
             - endpoints
             - namespaces
             - events
           verbs:
             - get
             - list
             - watch
         - apiGroups:
             - apps
           resources:
             - daemonsets
             - deployments
             - deployments/scale
             - replicasets
             - replicasets/scale
             - statefulsets
             - statefulsets/scale
           verbs:
             - get
             - list
             - watch
         - apiGroups:
             - batch
           resources:
             - jobs
           verbs:
             - get
             - list
             - watch
             - update
         - apiGroups:
             - batch
           resources:
             - cronjobs
           verbs:
             - get
             - list
             - update
         - apiGroups:
             - storage.j8s.io
           resources:
             - storageclasses
           verbs:
             - get
             - list
         - apiGroups:
             - networking.k8s.io
           resources:
             - ingresses
           verbs:
             - get
             - list
         - apiGroups:
             - extensions
           resources:
             - ingresses
           verbs:
             - get
             - list
         - apiGroups:
             - policy
           resources:
             - podsecuritypolicies
           verbs:
             - use
           resourceNames:
             - imxc-ps
         - apiGroups:
             - certificates.k8s.io
           resourceNames:
             - kubernetes.io/kube-apiserver-client-kubelet
           resources:
             - signers
           verbs:
             - approve
         - apiGroups:
             - certificates.k8s.io
           resourceNames:
             - kubernetes.io/kubelet-serving
           resources:
             - signers
           verbs:
             - approve
         - apiGroups:
             - ""
           resources:
             - nodes
           verbs:
             - get
             - list
             - watch
             - proxy
         - apiGroups:
             - ""
           resources:
             - nodes/log
             - nodes/metrics
             - nodes/proxy
             - nodes/spec
             - nodes/stats
           verbs:
             - ''*''
         - apiGroups:
             - ''*''
           resources:
             - ''*''
           verbs:
             - get
             - list
             - watch
       ---
       apiVersion: rbac.authorization.k8s.io/v1
       kind: ClusterRoleBinding
       metadata:
         name: cloudmoa-restricted-rb
         namespace: $CLOUDMOA_NAMESPACE
       subjects:
         - kind: ServiceAccount
           name: default
           namespace: $CLOUDMOA_NAMESPACE
       roleRef:
         kind: ClusterRole
         name: cloudmoa-cluster-role
         apiGroup: rbac.authorization.k8s.io
       ---
       apiVersion: policy/v1beta1
       kind: PodSecurityPolicy
       metadata:
         name: cloudmoa-psp
         namespace: $CLOUDMOA_NAMESPACE
       spec:
         privileged: true
         seLinux:
           rule: RunAsAny
         supplementalGroups:
           rule: RunAsAny
         runAsUser:
           rule: RunAsAny
         fsGroup:
           rule: RunAsAny
         hostPorts:
           - max: 65535
             min: 0
         hostNetwork: true
         hostPID: true
         volumes:
           - configMap
           - secret
           - emptyDir
           - hostPath
           - projected
           - downwardAPI
           - persistentVolumeClaim
       ---
       apiVersion: apps/v1
       kind: DaemonSet
       metadata:
         name: cloudmoa-agent
         namespace: $CLOUDMOA_NAMESPACE
         labels:
           app: cloudmoa-agent
       spec:
         selector:
           matchLabels:
             app: cloudmoa-agent
         template:
           metadata:
             labels:
               app: cloudmoa-agent
           spec:
             hostNetwork: true
             hostPID: true
             tolerations:
             - effect: NoSchedule
               operator: Exists
             - effect: NoExecute
               operator: Exists
             containers:
             - name: cloudmoa-agent
               image: $DOCKER_REGISTRY_URL/imxc/imxc-agent:$IMAGE_TAG
               imagePullPolicy: Always
               resources:
                 requests:
                   cpu: 200m
                   memory: 512Mi
                 limits:
                   cpu: 500m
                   memory: 600Mi
               securityContext:
                 privileged: true
               volumeMounts:
               - mountPath: /host/usr/bin
                 name: bin-volume
               - mountPath: /var/run/docker.sock
                 name: docker-volume
               - mountPath: /host/proc
                 name: proc-volume
               - mountPath: /root
                 name: root-volume
               - mountPath: /log
                 name: log-volume
               env:
                 - name: KAFKA_SERVER
                   value: $COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT
                 - name: CLUSTER_ID
                   value: $CLOUDMOA_CLUSTER_ID
                 - name: API_SERVER
                   value: $COLLTION_SERVER_API_IP:$COLLECTION_SERVER_API_NETTY_PORT
                 - name: ROOT_DIRECTORY
                   value: /root
                 - name: NODE_NAME
                   valueFrom:
                     fieldRef:
                       apiVersion: v1
                       fieldPath: spec.nodeName
                 - name: LOG_LEVEL
                   value: "DEBUG"
                 - name: API_SERVER_LICENSE
                   value: $COLLTION_SERVER_API_IP:8080

             volumes:
             - name: bin-volume
               hostPath:
                 path: /usr/bin
                 type: Directory
             - name: docker-volume
               hostPath:
                 path: /var/run/docker.sock
             - name: proc-volume
               hostPath:
                 path: /proc
             - name: root-volume
               hostPath:
                 path: /
             - name: log-volume
               hostPath:
                 path: /home', true, '2021-03-11 13:37:48.000000', '2021-03-11 13:37:51.000000', null)
ON CONFLICT (id)
DO
   UPDATE SET (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
        = (2, 'agent', 'agent', '관제 대상 클러스터의 Topology 데이터를 수집하여 Kafka를 통해 수집 클러스터에 전달하는 역할을 하며, 그 밖에 API 서버와의 TCP 연결을 통해 관리 기능, Log Viewer 기능 등을 수행합니다.', '---
          apiVersion: rbac.authorization.k8s.io/v1
          kind: ClusterRole
          metadata:
            name: cloudmoa-cluster-role
          rules:
            - nonResourceURLs:
                - "*"
              verbs:
                - get
            - apiGroups:
                - metrics.k8s.io
              resources:
                - pods
                - nodes
              verbs:
                - get
                - list
                - watch
            - apiGroups:
                - ""
              resources:
                - pods
              verbs:
                - get
                - list
                - watch
                - update
            - apiGroups:
                - ""
              resources:
                - services
              verbs:
                - get
                - list
                - watch
                - update
            - apiGroups:
                - ""
              resources:
                - nodes/stats
                - endpoints
                - namespaces
                - events
              verbs:
                - get
                - list
                - watch
            - apiGroups:
                - apps
              resources:
                - daemonsets
                - deployments
                - deployments/scale
                - replicasets
                - replicasets/scale
                - statefulsets
                - statefulsets/scale
              verbs:
                - get
                - list
                - watch
            - apiGroups:
                - batch
              resources:
                - jobs
              verbs:
                - get
                - list
                - watch
                - update
            - apiGroups:
                - batch
              resources:
                - cronjobs
              verbs:
                - get
                - list
                - update
            - apiGroups:
                - storage.j8s.io
              resources:
                - storageclasses
              verbs:
                - get
                - list
            - apiGroups:
                - networking.k8s.io
              resources:
                - ingresses
              verbs:
                - get
                - list
            - apiGroups:
                - extensions
              resources:
                - ingresses
              verbs:
                - get
                - list
            - apiGroups:
                - policy
              resources:
                - podsecuritypolicies
              verbs:
                - use
              resourceNames:
                - imxc-ps
            - apiGroups:
                - certificates.k8s.io
              resourceNames:
                - kubernetes.io/kube-apiserver-client-kubelet
              resources:
                - signers
              verbs:
                - approve
            - apiGroups:
                - certificates.k8s.io
              resourceNames:
                - kubernetes.io/kubelet-serving
              resources:
                - signers
              verbs:
                - approve
            - apiGroups:
                - ""
              resources:
                - nodes
              verbs:
                - get
                - list
                - watch
                - proxy
            - apiGroups:
                - ""
              resources:
                - nodes/log
                - nodes/metrics
                - nodes/proxy
                - nodes/spec
                - nodes/stats
              verbs:
                - ''*''
            - apiGroups:
                - ''*''
              resources:
                - ''*''
              verbs:
                - get
                - list
                - watch
          ---
          apiVersion: rbac.authorization.k8s.io/v1
          kind: ClusterRoleBinding
          metadata:
            name: cloudmoa-restricted-rb
            namespace: $CLOUDMOA_NAMESPACE
          subjects:
            - kind: ServiceAccount
              name: default
              namespace: $CLOUDMOA_NAMESPACE
          roleRef:
            kind: ClusterRole
            name: cloudmoa-cluster-role
            apiGroup: rbac.authorization.k8s.io
          ---
          apiVersion: policy/v1beta1
          kind: PodSecurityPolicy
          metadata:
            name: cloudmoa-psp
            namespace: $CLOUDMOA_NAMESPACE
          spec:
            privileged: true
            seLinux:
              rule: RunAsAny
            supplementalGroups:
              rule: RunAsAny
            runAsUser:
              rule: RunAsAny
            fsGroup:
              rule: RunAsAny
            hostPorts:
              - max: 65535
                min: 0
            hostNetwork: true
            hostPID: true
            volumes:
              - configMap
              - secret
              - emptyDir
              - hostPath
              - projected
              - downwardAPI
              - persistentVolumeClaim
          ---
          apiVersion: apps/v1
          kind: DaemonSet
          metadata:
            name: cloudmoa-agent
            namespace: $CLOUDMOA_NAMESPACE
            labels:
              app: cloudmoa-agent
          spec:
            selector:
              matchLabels:
                app: cloudmoa-agent
            template:
              metadata:
                labels:
                  app: cloudmoa-agent
              spec:
                hostNetwork: true
                hostPID: true
                tolerations:
                - effect: NoSchedule
                  operator: Exists
                - effect: NoExecute
                  operator: Exists
                containers:
                - name: cloudmoa-agent
                  image: $DOCKER_REGISTRY_URL/imxc/imxc-agent:$IMAGE_TAG
                  imagePullPolicy: Always
                  resources:
                    requests:
                      cpu: 200m
                      memory: 512Mi
                    limits:
                      cpu: 500m
                      memory: 600Mi
                  securityContext:
                    privileged: true
                  volumeMounts:
                  - mountPath: /host/usr/bin
                    name: bin-volume
                  - mountPath: /var/run/docker.sock
                    name: docker-volume
                  - mountPath: /host/proc
                    name: proc-volume
                  - mountPath: /root
                    name: root-volume
                  - mountPath: /log
                    name: log-volume
                  env:
                    - name: KAFKA_SERVER
                      value: $COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT
                    - name: CLUSTER_ID
                      value: $CLOUDMOA_CLUSTER_ID
                    - name: API_SERVER
                      value: $COLLTION_SERVER_API_IP:$COLLECTION_SERVER_API_NETTY_PORT
                    - name: ROOT_DIRECTORY
                      value: /root
                    - name: NODE_NAME
                      valueFrom:
                        fieldRef:
                          apiVersion: v1
                          fieldPath: spec.nodeName
                    - name: LOG_LEVEL
                      value: "DEBUG"
                    - name: API_SERVER_LICENSE
                      value: $COLLTION_SERVER_API_IP:8080

                volumes:
                - name: bin-volume
                  hostPath:
                    path: /usr/bin
                    type: Directory
                - name: docker-volume
                  hostPath:
                    path: /var/run/docker.sock
                - name: proc-volume
                  hostPath:
                    path: /proc
                - name: root-volume
                  hostPath:
                    path: /
                - name: log-volume
                  hostPath:
                    path: /home', true, '2021-03-11 13:37:48.000000', '2021-03-11 13:37:51.000000', null)
    WHERE public.agent_install_file_info.id = 2;


INSERT INTO public.agent_install_file_info (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
VALUES (6, 'prometheus', 'agent', 'Prometheus는 다양한 Exporter들과 연결될 수 있으며, 기본적으로 Node Exporter와 cAdvisor를 통해 수집한 Metric 데이터를 Kafka를 통해 수집 클러스터에 전달하는 역할을 합니다.', '---
       # VERSION : 20190227142300

       apiVersion: v1
       kind: ConfigMap
       metadata:
         name: cloudmoa-prometheus-configuration
         namespace: $CLOUDMOA_NAMESPACE
       data:
         scaling.rules: |
           groups:
           - name: scaleup
             rules :
             - alert : ScaleUpRule
               expr: job:webapp_config_open_sessions_current_count:sum > 15
               annotations:
                 summary: "Scale up when current sessions is greater than 15"
                 description: "Firing when total sessions active greater than 15"
         prometheus.yml: |
           global:
             scrape_interval:     15s
             # Attach these labels to any time series or alerts when communicating with
             # external systems.
             external_labels:
               monitor: ''5s-monitor''

             #kafka writer only
             no_local_disk_write: true

           # A scrape configuration for running Prometheus on a Kubernetes cluster.
           # This uses separate scrape configs for cluster components (i.e. API server, node)
           # and services to allow each to use different authentication configs.
           #
           # Kubernetes labels will be added as Prometheus labels on metrics via the
           # `labelmap` relabeling action.
           #

           #
           # rule_files:
           # - "scaling.rules"

           # i suppose my code in the remote kafka write is something wrong ... should append a double quote character at the end of the url
           remote_write:
           - url: kafka://$COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT/remote_prom?encoding=proto3&compression=snappy

           scrape_configs:

             # Scrape config for nodes (kubelet).
             #
             # Rather than connecting directly to the node, the scrape is proxied though the
             # Kubernetes apiserver.  This means it will work if Prometheus is running out of
             # cluster, or can''t connect to nodes for some other reason (e.g. because of
             # firewalling).
             - job_name: ''kubernetes-kubelet''

               # Default to scraping over https. If required, just disable this or change to
               # `http`.
               scheme: https
               # This TLS & bearer token file config is used to connect to the actual scrape
               # endpoints for cluster components. This is separate to discovery auth
               # configuration because discovery & scraping are two separate concerns in
               # Prometheus. The discovery auth config is automatic if Prometheus runs inside
               # the cluster. Otherwise, more config options have to be provided within the
               # <kubernetes_sd_config>.
               tls_config:
                 ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
               bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
               kubernetes_sd_configs:
               - role: node
               relabel_configs:
               - action: labelmap
                 regex: __meta_kubernetes_node_label_(.+)
               - target_label: __address__
                 replacement: kubernetes.default.svc:443
               - source_labels: [__meta_kubernetes_node_name]
                 regex: (.+)
                 target_label: __metrics_path__
                 replacement: /api/v1/nodes/${1}/proxy/metrics
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: xm_node_id
               - target_label: xm_clst_id
                 replacement: ''$CLOUDMOA_CLUSTER_ID''
               - target_label: xm_entity_type
                 replacement: ''Node''
               metric_relabel_configs:
               - source_labels: [ __name__ ]
                 regex: (kubelet_running_pod_count)
                 action: keep

             # copied from https://github.com/kayrus/prometheus-kubernetes/blob/master/prometheus-configmap.yaml
             - job_name: ''kubernetes-node-exporter''
               tls_config:
                 ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
               bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
               kubernetes_sd_configs:
               - role: node

               relabel_configs:
               - action: labelmap
                 regex: __meta_kubernetes_node_label_(.+)
               - source_labels: [__meta_kubernetes_role]
                 action: replace
                 target_label: kubernetes_role
               - source_labels: [__address__]
                 regex: ''(.*):10250''
                 replacement: ''${1}:9110''
                 target_label: __address__
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: __instance__
                 # set "name" value to "job"
               - source_labels: [job]
                 regex: ''kubernetes-(.*)''
                 replacement: ''${1}''
                 target_label: name
               - target_label: xm_clst_id
                 replacement: ''$CLOUDMOA_CLUSTER_ID''
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: xm_node_id
               - target_label: xm_entity_type
                 replacement: ''Node''
               - source_labels: [__meta_kubernetes_namespace]
                 separator: ;
                 regex: (.*)
                 target_label: xm_namespace
                 replacement: $1
                 action: replace
               metric_relabel_configs:
               - source_labels: [ __name__ ]
                 regex: (node_boot_time_seconds|node_context_switches_total|node_cpu_frequency_max_hertz|node_cpu_package_throttles_total|node_cpu_seconds_total|node_disk_io_time_seconds_total|node_disk_read_bytes_total|node_disk_read_time_seconds_total|node_disk_reads_completed_total|node_disk_write_time_seconds_total|node_disk_writes_completed_total|node_disk_written_bytes_total|node_filefd_allocated|node_filesystem_avail_bytes|node_filesystem_free_bytes|node_filesystem_size_bytes|node_load1|node_load15|node_load5|node_memory_Active_bytes|node_memory_Buffers_bytes|node_memory_Cached_bytes|node_memory_MemAvailable_bytes|node_memory_MemFree_bytes|node_memory_MemTotal_bytes|node_memory_SwapCached_bytes|node_memory_SwapFree_bytes|node_memory_SwapTotal_bytes|node_network_receive_bytes_total|node_network_receive_bytes_total|node_network_transmit_bytes_total|node_network_transmit_bytes_total)
                 action: keep

             - job_name: ''kubernetes-cadvisor''

               # Default to scraping over https. If required, just disable this or change to
               # `http`.
               scheme: https

               tls_config:
                 ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                 insecure_skip_verify: true
               bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token

               kubernetes_sd_configs:
               - role: node
               metrics_path: /metrics/cadvisor

               relabel_configs:
               - action: labelmap
                 regex: __meta_kubernetes_node_label_(.+)
               - target_label: xm_clst_id
                 replacement: ''$CLOUDMOA_CLUSTER_ID''
               - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                 target_label: xm_node_id
               - target_label: xm_entity_type
                 replacement: ''Container''

               metric_relabel_configs:
               - source_labels: [namespace]
                 target_label: xm_namespace
               - source_labels: [pod]
                 target_label: xm_pod_id
               - source_labels: [container]
                 target_label: xm_cont_name
               - source_labels: [id]
                 target_label: xm_cont_id
               - source_labels: [container]
                 regex: (.+)
                 action: keep
               - source_labels: [ __name__ ]
                 regex: (container_cpu_cfs_throttled_seconds_total|container_cpu_system_seconds_total|container_cpu_usage_seconds_total|container_cpu_user_seconds_total|container_fs_limit_bytes|container_fs_reads_bytes_total|container_fs_usage_bytes|container_fs_writes_bytes_total|container_last_seen|container_memory_cache|container_memory_max_usage_bytes|container_memory_swap|container_memory_usage_bytes|container_memory_working_set_bytes|container_network_receive_bytes_total|container_network_transmit_bytes_total|container_spec_memory_limit_bytes)
                 action: keep
       ---
       apiVersion: v1
       kind: Service
       metadata:
         name: cloudmoa-prometheus
         namespace: $CLOUDMOA_NAMESPACE
       spec:
         ports:
           - port: 9090
             protocol: TCP
             targetPort: 9090
         selector:
           app: cloudmoa-prometheus
         type: ClusterIP
       ---
       apiVersion: apps/v1
       kind: Deployment
       metadata:
         name: cloudmoa-prometheus
         namespace: $CLOUDMOA_NAMESPACE
         labels:
           app: cloudmoa-prometheus
       spec:
         selector:
           matchLabels:
             app: cloudmoa-prometheus
         replicas: 1
         strategy:
           type: Recreate
         template:
           metadata:
             labels:
               app: cloudmoa-prometheus
           spec:
             containers:
               - name: cloudmoa-prometheus
                 image: $DOCKER_REGISTRY_URL/imxc/metric-agent:$IMAGE_TAG
                 ports:
                   - containerPort: 9090
                 args:
                   - --config.file=/etc/prometheus/prometheus.yml
                 #- --log.level=debug
                 resources:
                   requests:
                     cpu: 100m
                     memory: 512Mi
                   limits:
                     cpu: 300m
                     memory: 1000Mi
                 volumeMounts:
                   - mountPath: "/prometheus"
                     name: data
                   - mountPath: /etc/prometheus/
                     name: config-volume
                 env:
                   - name: LOG_LEVEL
                     value: "INFO"
                   - name: LOG_MAXAGE
                     value: "1"
                   - name: CLUSTER_ID
                     value: $CLOUDMOA_CLUSTER_ID
                   - name: API_SERVER_LICENSE
                     value: $COLLTION_SERVER_API_IP:8080

             restartPolicy: Always
             volumes:
               - emptyDir: {}
                 name: data
               - name: config-volume
                 configMap:
                   name: cloudmoa-prometheus-configuration
       ', false, '2021-03-11 13:39:07.000000', '2021-03-11 13:39:09.000000', '1.16')
ON CONFLICT (id)
DO
   UPDATE SET (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
        = (6, 'prometheus', 'agent', 'Prometheus는 다양한 Exporter들과 연결될 수 있으며, 기본적으로 Node Exporter와 cAdvisor를 통해 수집한 Metric 데이터를 Kafka를 통해 수집 클러스터에 전달하는 역할을 합니다.', '---
          # VERSION : 20190227142300

          apiVersion: v1
          kind: ConfigMap
          metadata:
            name: cloudmoa-prometheus-configuration
            namespace: $CLOUDMOA_NAMESPACE
          data:
            scaling.rules: |
              groups:
              - name: scaleup
                rules :
                - alert : ScaleUpRule
                  expr: job:webapp_config_open_sessions_current_count:sum > 15
                  annotations:
                    summary: "Scale up when current sessions is greater than 15"
                    description: "Firing when total sessions active greater than 15"
            prometheus.yml: |
              global:
                scrape_interval:     15s
                # Attach these labels to any time series or alerts when communicating with
                # external systems.
                external_labels:
                  monitor: ''5s-monitor''

                #kafka writer only
                no_local_disk_write: true

              # A scrape configuration for running Prometheus on a Kubernetes cluster.
              # This uses separate scrape configs for cluster components (i.e. API server, node)
              # and services to allow each to use different authentication configs.
              #
              # Kubernetes labels will be added as Prometheus labels on metrics via the
              # `labelmap` relabeling action.
              #

              #
              # rule_files:
              # - "scaling.rules"

              # i suppose my code in the remote kafka write is something wrong ... should append a double quote character at the end of the url
              remote_write:
              - url: kafka://$COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT/remote_prom?encoding=proto3&compression=snappy

              scrape_configs:

                # Scrape config for nodes (kubelet).
                #
                # Rather than connecting directly to the node, the scrape is proxied though the
                # Kubernetes apiserver.  This means it will work if Prometheus is running out of
                # cluster, or can''t connect to nodes for some other reason (e.g. because of
                # firewalling).
                - job_name: ''kubernetes-kubelet''

                  # Default to scraping over https. If required, just disable this or change to
                  # `http`.
                  scheme: https
                  # This TLS & bearer token file config is used to connect to the actual scrape
                  # endpoints for cluster components. This is separate to discovery auth
                  # configuration because discovery & scraping are two separate concerns in
                  # Prometheus. The discovery auth config is automatic if Prometheus runs inside
                  # the cluster. Otherwise, more config options have to be provided within the
                  # <kubernetes_sd_config>.
                  tls_config:
                    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
                  kubernetes_sd_configs:
                  - role: node
                  relabel_configs:
                  - action: labelmap
                    regex: __meta_kubernetes_node_label_(.+)
                  - target_label: __address__
                    replacement: kubernetes.default.svc:443
                  - source_labels: [__meta_kubernetes_node_name]
                    regex: (.+)
                    target_label: __metrics_path__
                    replacement: /api/v1/nodes/${1}/proxy/metrics
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: xm_node_id
                  - target_label: xm_clst_id
                    replacement: ''$CLOUDMOA_CLUSTER_ID''
                  - target_label: xm_entity_type
                    replacement: ''Node''
                  metric_relabel_configs:
                  - source_labels: [ __name__ ]
                    regex: (kubelet_running_pod_count)
                    action: keep

                # copied from https://github.com/kayrus/prometheus-kubernetes/blob/master/prometheus-configmap.yaml
                - job_name: ''kubernetes-node-exporter''
                  tls_config:
                    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
                  kubernetes_sd_configs:
                  - role: node

                  relabel_configs:
                  - action: labelmap
                    regex: __meta_kubernetes_node_label_(.+)
                  - source_labels: [__meta_kubernetes_role]
                    action: replace
                    target_label: kubernetes_role
                  - source_labels: [__address__]
                    regex: ''(.*):10250''
                    replacement: ''${1}:9110''
                    target_label: __address__
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: __instance__
                    # set "name" value to "job"
                  - source_labels: [job]
                    regex: ''kubernetes-(.*)''
                    replacement: ''${1}''
                    target_label: name
                  - target_label: xm_clst_id
                    replacement: ''$CLOUDMOA_CLUSTER_ID''
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: xm_node_id
                  - target_label: xm_entity_type
                    replacement: ''Node''
                  - source_labels: [__meta_kubernetes_namespace]
                    separator: ;
                    regex: (.*)
                    target_label: xm_namespace
                    replacement: $1
                    action: replace
                  metric_relabel_configs:
                  - source_labels: [ __name__ ]
                    regex: (node_boot_time_seconds|node_context_switches_total|node_cpu_frequency_max_hertz|node_cpu_package_throttles_total|node_cpu_seconds_total|node_disk_io_time_seconds_total|node_disk_read_bytes_total|node_disk_read_time_seconds_total|node_disk_reads_completed_total|node_disk_write_time_seconds_total|node_disk_writes_completed_total|node_disk_written_bytes_total|node_filefd_allocated|node_filesystem_avail_bytes|node_filesystem_free_bytes|node_filesystem_size_bytes|node_load1|node_load15|node_load5|node_memory_Active_bytes|node_memory_Buffers_bytes|node_memory_Cached_bytes|node_memory_MemAvailable_bytes|node_memory_MemFree_bytes|node_memory_MemTotal_bytes|node_memory_SwapCached_bytes|node_memory_SwapFree_bytes|node_memory_SwapTotal_bytes|node_network_receive_bytes_total|node_network_receive_bytes_total|node_network_transmit_bytes_total|node_network_transmit_bytes_total)
                    action: keep

                - job_name: ''kubernetes-cadvisor''

                  # Default to scraping over https. If required, just disable this or change to
                  # `http`.
                  scheme: https

                  tls_config:
                    ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
                    insecure_skip_verify: true
                  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token

                  kubernetes_sd_configs:
                  - role: node
                  metrics_path: /metrics/cadvisor

                  relabel_configs:
                  - action: labelmap
                    regex: __meta_kubernetes_node_label_(.+)
                  - target_label: xm_clst_id
                    replacement: ''$CLOUDMOA_CLUSTER_ID''
                  - source_labels: [__meta_kubernetes_node_label_kubernetes_io_hostname]
                    target_label: xm_node_id
                  - target_label: xm_entity_type
                    replacement: ''Container''

                  metric_relabel_configs:
                  - source_labels: [namespace]
                    target_label: xm_namespace
                  - source_labels: [pod]
                    target_label: xm_pod_id
                  - source_labels: [container]
                    target_label: xm_cont_name
                  - source_labels: [id]
                    target_label: xm_cont_id
                  - source_labels: [container]
                    regex: (.+)
                    action: keep
                  - source_labels: [ __name__ ]
                    regex: (container_cpu_cfs_throttled_seconds_total|container_cpu_system_seconds_total|container_cpu_usage_seconds_total|container_cpu_user_seconds_total|container_fs_limit_bytes|container_fs_reads_bytes_total|container_fs_usage_bytes|container_fs_writes_bytes_total|container_last_seen|container_memory_cache|container_memory_max_usage_bytes|container_memory_swap|container_memory_usage_bytes|container_memory_working_set_bytes|container_network_receive_bytes_total|container_network_transmit_bytes_total|container_spec_memory_limit_bytes)
                    action: keep
          ---
          apiVersion: v1
          kind: Service
          metadata:
            name: cloudmoa-prometheus
            namespace: $CLOUDMOA_NAMESPACE
          spec:
            ports:
              - port: 9090
                protocol: TCP
                targetPort: 9090
            selector:
              app: cloudmoa-prometheus
            type: ClusterIP
          ---
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: cloudmoa-prometheus
            namespace: $CLOUDMOA_NAMESPACE
            labels:
              app: cloudmoa-prometheus
          spec:
            selector:
              matchLabels:
                app: cloudmoa-prometheus
            replicas: 1
            strategy:
              type: Recreate
            template:
              metadata:
                labels:
                  app: cloudmoa-prometheus
              spec:
                containers:
                  - name: cloudmoa-prometheus
                    image: $DOCKER_REGISTRY_URL/imxc/metric-agent:$IMAGE_TAG
                    ports:
                      - containerPort: 9090
                    args:
                      - --config.file=/etc/prometheus/prometheus.yml
                    #- --log.level=debug
                    resources:
                      requests:
                        cpu: 100m
                        memory: 512Mi
                      limits:
                        cpu: 300m
                        memory: 1000Mi
                    volumeMounts:
                      - mountPath: "/prometheus"
                        name: data
                      - mountPath: /etc/prometheus/
                        name: config-volume
                    env:
                      - name: LOG_LEVEL
                        value: "INFO"
                      - name: LOG_MAXAGE
                        value: "1"
                      - name: CLUSTER_ID
                        value: $CLOUDMOA_CLUSTER_ID
                      - name: API_SERVER_LICENSE
                        value: $COLLTION_SERVER_API_IP:8080

                restartPolicy: Always
                volumes:
                  - emptyDir: {}
                    name: data
                  - name: config-volume
                    configMap:
                      name: cloudmoa-prometheus-configuration
          ', false, '2021-03-11 13:39:07.000000', '2021-03-11 13:39:09.000000', '1.16')
    WHERE public.agent_install_file_info.id = 6;


INSERT INTO public.agent_install_file_info (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
VALUES (7, 'jaeger', 'application', 'CloudMOA에서는 고객사에서 운영 중인 application의 TPS, 서비스 연관관계 등의 데이터를 얻기 위해서 Jaeger를 사용하며, Jaeger 사용을 위해 Jaeger-client, jaeger-agent, jaeger-collector의 설치가 필요합니다.
       ', '---
       apiVersion: v1
       kind: ConfigMap
       metadata:
         name: cloudmoa-jaeger-collector-configuration
         namespace: $CLOUDMOA_NAMESPACE
       data:
         strategies.json: |
           {
             "default_strategy": {
               "type": "probabilistic",
               "param": 0.1
             }
           }
       ---
       apiVersion: apps/v1
       kind: Deployment
       metadata:
         name: cloudmoa-jaeger-collector
         namespace: $CLOUDMOA_NAMESPACE
         labels:
           app: jaeger
           jaeger-infra: collector-deployment
       spec:
         selector:
           matchLabels:
             app: jaeger
         replicas: 1
         strategy:
           type: Recreate
         template:
           metadata:
             labels:
               app: jaeger
               jaeger-infra: collector-pod
           spec:
             securityContext:
               runAsNonRoot: true
               runAsUser: 65534
             containers:
               - image: $DOCKER_REGISTRY_URL/jaeger/jaeger-collector:$IMAGE_TAG
                 name: jaeger-collector
                 args:
                   - --sampling.strategies-file=/etc/jaeger-collector/strategies.json
                   - --sampling.strategies-reload-interval=60s
                 resources:
                   requests:
                     cpu: 100m
                     memory: 50Mi
                   limits:
                     cpu: 200m
                     memory: 100Mi
                 ports:
                   - containerPort: 14267
                     protocol: TCP
                   - containerPort: 14268
                     protocol: TCP
                   - containerPort: 9411
                     protocol: TCP
                   - containerPort: 14250
                     protocol: TCP
                   - containerPort: 14269
                     protocol: TCP
                 readinessProbe:
                   httpGet:
                     path: "/"
                     port: 14269
                 env:
                   - name: COLLECTOR_ZIPKIN_HTTP_PORT
                     value: "9411"
                   - name: SPAN_STORAGE_TYPE
                     value: kafka
                   - name: KAFKA_PRODUCER_BROKERS
                     value: $COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT
                   - name: LOG_LEVEL
                     value: "INFO"
                   - name: LOG_MAXAGE
                     value: "1"
                   - name: LOG_MAXBACKUPS
                     value: "3"
                   - name: LOG_MAXSIZE
                     value: "100"
                   - name: LOG_STDOUT
                     value: "TRUE"
                   - name: LOG_FILENAME
                     value: "jaeger-collector"
                   - name: CLUSTER_ID
                     value: $CLOUDMOA_CLUSTER_ID
                   - name: API_SERVER_LICENSE
                     value: $COLLTION_SERVER_API_IP:8080

                 volumeMounts:
                   - mountPath: /etc/jaeger-collector
                     name: config-volume

             volumes:
               - name: config-volume
                 configMap:
                   name: cloudmoa-jaeger-collector-configuration
       ---
       apiVersion: v1
       kind: Service
       metadata:
         name: cloudmoa-jaeger-collector
         namespace: $CLOUDMOA_NAMESPACE
         labels:
           app: jaeger
           jaeger-infra: collector-service
       spec:
         ports:
           - name: jaeger-collector-tchannel
             port: 14267
             protocol: TCP
             targetPort: 14267
           - name: jaeger-collector-metrics
             port: 14269
             targetPort: 14269
           - name: jaeger-collector-grpc
             port: 14250
             protocol: TCP
             targetPort: 14250
           - name: jaeger-collector-zipkin
             port: 9411
             targetPort: 9411
         selector:
           jaeger-infra: collector-pod
         type: ClusterIP
       ---
       apiVersion: v1
       kind: List
       items:
       - apiVersion: apps/v1
         kind: Deployment
         metadata:
           name: cloudmoa-jaeger-agent
           namespace: $CLOUDMOA_NAMESPACE
           labels:
             app: jaeger
             app.kubernetes.io/name: jaeger
             app.kubernetes.io/component: agent
         spec:
           selector:
             matchLabels:
               app: jaeger
           replicas: 1
           strategy:
             type: Recreate
           template:
             metadata:
               labels:
                 app: jaeger
                 app.kubernetes.io/name: jaeger
                 app.kubernetes.io/component: agent
               annotations:
                 prometheus.io/scrape: "true"
                 prometheus.io/port: "5778"
             spec:
               securityContext:
                 runAsNonRoot: true
                 runAsUser: 65534
               containers:
                 - image: $DOCKER_REGISTRY_URL/jaegertracing/jaeger-agent:$IMAGE_TAG
                   name: jaeger-agent
                   args: ["--reporter.grpc.host-port", "cloudmoa-jaeger-collector:14250"]
                   resources:
                     requests:
                       cpu: 100m
                       memory: 50Mi
                     limits:
                       cpu: 200m
                       memory: 100Mi
                   ports:
                     - containerPort: 5775
                       protocol: UDP
                     - containerPort: 6831
                       protocol: UDP
                     - containerPort: 6832
                       protocol: UDP
                     - containerPort: 5778
                       protocol: TCP
                   env:
                     - name: LOG_LEVEL
                       value: "INFO"
                     - name: LOG_MAXAGE
                       value: "1"
                     - name: LOG_MAXBACKUPS
                       value: "3"
                     - name: LOG_MAXSIZE
                       value: "100"
                     - name: LOG_STDOUT
                       value: "TRUE"
                     - name: LOG_FILENAME
                       value: "jaeger-agent"

       - apiVersion: v1
         kind: Service
         metadata:
           name: jaeger-agent
           namespace: $CLOUDMOA_NAMESPACE
           labels:
             app: jaeger
             app.kubernetes.io/name: jaeger
             app.kubernetes.io/component: agent
         spec:
           ports:
             - name: agent-zipkin-thrift
               port: 5775
               protocol: UDP
               targetPort: 5775
             - name: agent-compact
               port: 6831
               protocol: UDP
               targetPort: 6831
             - name: agent-binary
               port: 6832
               protocol: UDP
               targetPort: 6832
             - name: agent-configs
               port: 5778
               protocol: TCP
               targetPort: 5778
           selector:
             app.kubernetes.io/name: jaeger
             app.kubernetes.io/component: agent
           type: ClusterIP', true, '2021-03-11 17:48:34.000000', '2021-03-11 17:48:39.000000', null)
ON CONFLICT (id)
DO
   UPDATE SET (id, name, type, description, yaml, use_yn, created_date, modified_date, version)
        = (7, 'jaeger', 'application', 'CloudMOA에서는 고객사에서 운영 중인 application의 TPS, 서비스 연관관계 등의 데이터를 얻기 위해서 Jaeger를 사용하며, Jaeger 사용을 위해 Jaeger-client, jaeger-agent, jaeger-collector의 설치가 필요합니다.
          ', '---
          apiVersion: v1
          kind: ConfigMap
          metadata:
            name: cloudmoa-jaeger-collector-configuration
            namespace: $CLOUDMOA_NAMESPACE
          data:
            strategies.json: |
              {
                "default_strategy": {
                  "type": "probabilistic",
                  "param": 0.1
                }
              }
          ---
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: cloudmoa-jaeger-collector
            namespace: $CLOUDMOA_NAMESPACE
            labels:
              app: jaeger
              jaeger-infra: collector-deployment
          spec:
            selector:
              matchLabels:
                app: jaeger
            replicas: 1
            strategy:
              type: Recreate
            template:
              metadata:
                labels:
                  app: jaeger
                  jaeger-infra: collector-pod
              spec:
                securityContext:
                  runAsNonRoot: true
                  runAsUser: 65534
                containers:
                  - image: $DOCKER_REGISTRY_URL/jaeger/jaeger-collector:$IMAGE_TAG
                    name: jaeger-collector
                    args:
                      - --sampling.strategies-file=/etc/jaeger-collector/strategies.json
                      - --sampling.strategies-reload-interval=60s
                    resources:
                      requests:
                        cpu: 100m
                        memory: 50Mi
                      limits:
                        cpu: 200m
                        memory: 100Mi
                    ports:
                      - containerPort: 14267
                        protocol: TCP
                      - containerPort: 14268
                        protocol: TCP
                      - containerPort: 9411
                        protocol: TCP
                      - containerPort: 14250
                        protocol: TCP
                      - containerPort: 14269
                        protocol: TCP
                    readinessProbe:
                      httpGet:
                        path: "/"
                        port: 14269
                    env:
                      - name: COLLECTOR_ZIPKIN_HTTP_PORT
                        value: "9411"
                      - name: SPAN_STORAGE_TYPE
                        value: kafka
                      - name: KAFKA_PRODUCER_BROKERS
                        value: $COLLTION_SERVER_KAFKA_IP:$COLLTION_SERVER_KAFKA_INTERFACE_PORT
                      - name: LOG_LEVEL
                        value: "INFO"
                      - name: LOG_MAXAGE
                        value: "1"
                      - name: LOG_MAXBACKUPS
                        value: "3"
                      - name: LOG_MAXSIZE
                        value: "100"
                      - name: LOG_STDOUT
                        value: "TRUE"
                      - name: LOG_FILENAME
                        value: "jaeger-collector"
                      - name: CLUSTER_ID
                        value: $CLOUDMOA_CLUSTER_ID
                      - name: API_SERVER_LICENSE
                        value: $COLLTION_SERVER_API_IP:8080

                    volumeMounts:
                      - mountPath: /etc/jaeger-collector
                        name: config-volume

                volumes:
                  - name: config-volume
                    configMap:
                      name: cloudmoa-jaeger-collector-configuration
          ---
          apiVersion: v1
          kind: Service
          metadata:
            name: cloudmoa-jaeger-collector
            namespace: $CLOUDMOA_NAMESPACE
            labels:
              app: jaeger
              jaeger-infra: collector-service
          spec:
            ports:
              - name: jaeger-collector-tchannel
                port: 14267
                protocol: TCP
                targetPort: 14267
              - name: jaeger-collector-metrics
                port: 14269
                targetPort: 14269
              - name: jaeger-collector-grpc
                port: 14250
                protocol: TCP
                targetPort: 14250
              - name: jaeger-collector-zipkin
                port: 9411
                targetPort: 9411
            selector:
              jaeger-infra: collector-pod
            type: ClusterIP
          ---
          apiVersion: v1
          kind: List
          items:
          - apiVersion: apps/v1
            kind: Deployment
            metadata:
              name: cloudmoa-jaeger-agent
              namespace: $CLOUDMOA_NAMESPACE
              labels:
                app: jaeger
                app.kubernetes.io/name: jaeger
                app.kubernetes.io/component: agent
            spec:
              selector:
                matchLabels:
                  app: jaeger
              replicas: 1
              strategy:
                type: Recreate
              template:
                metadata:
                  labels:
                    app: jaeger
                    app.kubernetes.io/name: jaeger
                    app.kubernetes.io/component: agent
                  annotations:
                    prometheus.io/scrape: "true"
                    prometheus.io/port: "5778"
                spec:
                  securityContext:
                    runAsNonRoot: true
                    runAsUser: 65534
                  containers:
                    - image: $DOCKER_REGISTRY_URL/jaegertracing/jaeger-agent:$IMAGE_TAG
                      name: jaeger-agent
                      args: ["--reporter.grpc.host-port", "cloudmoa-jaeger-collector:14250"]
                      resources:
                        requests:
                          cpu: 100m
                          memory: 50Mi
                        limits:
                          cpu: 200m
                          memory: 100Mi
                      ports:
                        - containerPort: 5775
                          protocol: UDP
                        - containerPort: 6831
                          protocol: UDP
                        - containerPort: 6832
                          protocol: UDP
                        - containerPort: 5778
                          protocol: TCP
                      env:
                        - name: LOG_LEVEL
                          value: "INFO"
                        - name: LOG_MAXAGE
                          value: "1"
                        - name: LOG_MAXBACKUPS
                          value: "3"
                        - name: LOG_MAXSIZE
                          value: "100"
                        - name: LOG_STDOUT
                          value: "TRUE"
                        - name: LOG_FILENAME
                          value: "jaeger-agent"

          - apiVersion: v1
            kind: Service
            metadata:
              name: jaeger-agent
              namespace: $CLOUDMOA_NAMESPACE
              labels:
                app: jaeger
                app.kubernetes.io/name: jaeger
                app.kubernetes.io/component: agent
            spec:
              ports:
                - name: agent-zipkin-thrift
                  port: 5775
                  protocol: UDP
                  targetPort: 5775
                - name: agent-compact
                  port: 6831
                  protocol: UDP
                  targetPort: 6831
                - name: agent-binary
                  port: 6832
                  protocol: UDP
                  targetPort: 6832
                - name: agent-configs
                  port: 5778
                  protocol: TCP
                  targetPort: 5778
              selector:
                app.kubernetes.io/name: jaeger
                app.kubernetes.io/component: agent
              type: ClusterIP', true, '2021-03-11 17:48:34.000000', '2021-03-11 17:48:39.000000', null)
    WHERE public.agent_install_file_info.id = 7;

--Menu Resource
--Infrastructure
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (0, 'Infrastructure', '01.Infrastructure', 0, NULL, (SELECT id FROM auth_resource3 WHERE name='menu|Infrastructure'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Infrastructure');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (1, 'Topology', NULL, 0, 'topologyInfra', (SELECT id FROM auth_resource3 WHERE name='menu|Infrastructure|Topology'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Infrastructure|Topology');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (2, 'Overview', NULL, 1, 'overViewInfra', (SELECT id FROM auth_resource3 WHERE name='menu|Infrastructure|Overview'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Infrastructure|Overview');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (3, 'Resource Usage', NULL, 2, 'resourceUsageInfra', (SELECT id FROM auth_resource3 WHERE name='menu|Infrastructure|Resource Usage'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Infrastructure|Resource Usage');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (4, 'Namespace', NULL, 3, 'namespaceInfra', (SELECT id FROM auth_resource3 WHERE name='menu|Infrastructure|Namespace'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Infrastructure|Namespace');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (5, 'Nodes', NULL, 4, 'nodesInfra', (select id from auth_resource3 where name='menu|Infrastructure|Nodes'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Infrastructure|Nodes');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (6, 'Node Details', NULL, 5, 'nodeDetailInfra', (select id from auth_resource3 where name='menu|Infrastructure|Node Details'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Infrastructure|Node Details');

--Workloads
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (10, 'Workloads', '02.Workload', 1, NULL, (select id from auth_resource3 where name='menu|Workloads'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Workloads');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (11, 'Overview', NULL, 0, 'overviewWorkloads', (select id from auth_resource3 where name='menu|Workloads|Overview'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Workloads|Overview');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (12, 'deployList', NULL, 1, 'deployListWorkloads', (select id from auth_resource3 where name='menu|Workloads|Deploy List'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Workloads|Deploy List');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (17, 'Jobs', NULL, 6, 'jobsWorkloads', (select id from auth_resource3 where name='menu|Workloads|Jobs'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Workloads|Jobs');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (18, 'Cron Jobs', NULL, 7, 'cronJobsWorkloads', (select id from auth_resource3 where name='menu|Workloads|Cron Jobs'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Workloads|Cron Jobs');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (19, 'Pods', NULL, 8, 'podsWorkloads', (select id from auth_resource3 where name='menu|Workloads|Pods'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Workloads|Pods');

--Services
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (20, 'Services', '03.Service', 2, NULL, (select id from auth_resource3 where name='menu|Services'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Services');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (21, 'DataCenter Service', NULL, 0, 'topologyServices', (select id from auth_resource3 where name='menu|Services|Topology'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Services|Topology');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (22, 'ServiceOverview', NULL, 1, 'overviewServices', (select id from auth_resource3 where name='menu|Services|Overview'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Services|Overview');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (23, 'Cluster Service', NULL, 2, 'detailServices', (select id from auth_resource3 where name='menu|Services|Structure'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Services|Structure');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (24, 'List', NULL, 3, 'serviceList', (select id from auth_resource3 where name='menu|Services|List'), 3)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 3
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Services|List');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (25, 'Detail', NULL, 4, 'slasServices', (select id from auth_resource3 where name='menu|Services|Detail'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Services|Detail');

--Statistics & Analysis
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (40, 'Statistics & Analysis', '06.Statistics&Analysis', 5, NULL, (select id from auth_resource3 where name='menu|Statistics & Analysis'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (41, 'Performance Trends', NULL, 0, 'performanceTrendSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Performance Trends'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Performance Trends');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (42, 'Alert Analysis', NULL, 2, 'alertAnalysisSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Alert Analysis'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Alert Analysis');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (43, 'Alert History', NULL, 3, 'alertHistorySA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Alert History'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Alert History');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (44, 'Anomaly Score Analysis', NULL, 4, 'anomalyScoreSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Anomaly Score'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Anomaly Score');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (45, 'Job History', NULL, 5, 'jobHistorySA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Job History'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Job History');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (46, 'Sparse Log Analysis', NULL, 6, 'sparseLogSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Sparse Logs'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Sparse Logs');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (47, 'Log Viewer', NULL, 7, 'logViewerSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Log Viewer'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Log Viewer');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (48, 'eventLog Analysis', NULL, 8, 'eventLogSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Event Logs'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Event Logs');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (49, 'Container Life Cycle', NULL, 9, 'containerLifecycleSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Container Life Cycle'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Container Life Cycle');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (50, 'Service Trace Analysis', NULL, 10, 'serviceTraceSA', (select id from auth_resource3 where name='menu|Statistics & Analysis|Service Traces'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Statistics & Analysis|Service Traces');

--Reports
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (60, 'Reports', '07.Report', 6, NULL, (select id from auth_resource3 where name='menu|Reports'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Reports');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (61, 'Documents', NULL, 0, 'documentReport', (select id from auth_resource3 where name='menu|Reports|Documents'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Reports|Documents');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (62, 'Templates', NULL, 1, 'reportSettings', (select id from auth_resource3 where name='menu|Reports|Templates'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Reports|Templates');

--Dashboards
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (65, 'Dashboards', '10.Dashboard', 7, NULL, (select id from auth_resource3 where name='menu|Dashboards'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Dashboards');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (66, 'Documents', NULL, 0, 'documentDashboard', (select id from auth_resource3 where name='menu|Dashboards|Documents'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Dashboards|Documents');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (67, 'Templates', NULL, 1, 'templateDashboard', (select id from auth_resource3 where name='menu|Dashboards|Templates'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Dashboards|Templates');

--Hosts
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (80, 'Hosts', '12.Hosts', 1, NULL, (select id from auth_resource3 where name='menu|Hosts'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Hosts');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (81, 'Topology', null, 0, 'topologyHost', (select id from auth_resource3 where name='menu|Hosts|Topology'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Hosts|Topology');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (82, 'Overview', NULL, 1, 'overviewHost', (select id from auth_resource3 where name='menu|Hosts|Overview'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Hosts|Overview');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (83, 'List', NULL, 2, 'listHost', (select id from auth_resource3 where name='menu|Hosts|List'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Hosts|List');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (84, 'Detail', NULL, 3, 'detailHost', (select id from auth_resource3 where name='menu|Hosts|Detail'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Hosts|Detail');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (85, 'Group', NULL, 4, 'groupHost', (select id from auth_resource3 where name='menu|Hosts|Group'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Hosts|Group');

--Settings
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (90, 'Settings', '08.Setting', 10, NULL, (select id from auth_resource3 where name='menu|Settings'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (91, 'User', NULL, 0, 'userGroupSettings', (select id from auth_resource3 where name='menu|Settings|User & Group'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|User & Group');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (92, 'Alerts', NULL, 1, 'alertSettings', (select id from auth_resource3 where name='menu|Settings|Alerts'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Alerts');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (93, 'Host Alerts', NULL, 2, 'hostAlertSettings', (select id from auth_resource3 where name='menu|Settings|Host Alerts'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Host Alerts');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (94, 'Sparse Logs', NULL, 3, 'sparseLogSettings', (select id from auth_resource3 where name='menu|Settings|Sparse Logs'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Sparse Logs');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (96, 'Metric Meta', NULL, 5, 'metricMetaSettings', (select id from auth_resource3 where name='menu|Settings|Metric Meta'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Metric Meta');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (97, 'Appearance', NULL, 6, 'appearanceSettings', (select id from auth_resource3 where name='menu|Settings|General'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|General');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (98, 'Notification', NULL, 7, 'notificationsSettings', (select id from auth_resource3 where name='menu|Settings|Notification'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Notification');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (99, 'Agent', NULL, 8, 'agentSettings', (select id from auth_resource3 where name='menu|Settings|Agent'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Agent');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (100, 'Alias', NULL, 9, 'aliasSettings', (select id from auth_resource3 where name='menu|Settings|Alias'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Alias');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (101, 'License', NULL, 10, 'validationLicense', (select id from auth_resource3 where name='menu|Settings|License'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|License');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (102, 'agent Installation', NULL, 11, 'agentInstallationSettings', (select id from auth_resource3 where name='menu|Settings|Agent Installation'), 2)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 2
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Settings|Agent Installation');

--Health Check
INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (121, 'Health Check', '09.HealthCheck', 9, 'healthCHeck', (select id from auth_resource3 where name='menu|Health Check'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Health Check');

INSERT INTO public.menu_meta (id, description, icon, "position", url, auth_resource3_id, scope_level)
VALUES (122, 'Check Script', NULL, 0, 'checkScript', (select id from auth_resource3 where name='menu|Health Check|Check Script'), 0)
ON CONFLICT (id)
    DO
    UPDATE SET scope_level = 0
    WHERE public.menu_meta.auth_resource3_id = (SELECT id FROM auth_resource3 WHERE name = 'menu|Health Check|Check Script');

INSERT INTO public.license_policy
(policy_id, policy_desc, term_year, term_month, term_day, license_type, allowable_range, storage_capacity, cluster_count, node_count, pod_count, service_count, core_count, host_ids, user_division, created_date, modified_date)
VALUES('promotion_license', '프로모션 기간에 사용자들에게 발급되는 라이선스', 0, 0, 14, 'trial', '0', 'unlimited', '1', '10', 'unlimited', 'unlimited', 'unlimited', 'unlimited', '1', now(), null);